Skip to content

Transform Step

TransformStepDescription reshapes data without an LLM call. It is cheap, fast, and deterministic. Use it to format, extract, filter, or join prior output.

FieldTypeDefaultPurpose
transform_type"extract" | "format" | "aggregate" | "filter" | "map"(required)The kind of transformation.
input_keystr"$history[-1]"A reference for the input. An unresolved reference becomes "".
output_formatstr | NoneNoneTemplate for format; the input is available as {input}.
expressionstr | NoneNoneRegular expression for extract / filter.
map_templatestr | NoneNonePer-item template for map; the item is available as {item}.
transform_typeBehaviour
extractre.findall(expression, str(input)), a list of matches. Without expression, returns the input unchanged.
formatoutput_format.format(input=input). Without output_format, str(input).
aggregateA list is joined with newlines; anything else becomes str(input).
filterKeeps list items (or lines of a string) where re.search(expression, ...) matches. Without expression, returns the input unchanged.
mapApplies map_template.format(item=item) to every list item. Non-list input is returned unchanged.

result_data holds the transformed value; result is that value as a string (JSON for non-strings).

from mmar_carl import TransformStepDescription, TransformStepConfig
TransformStepDescription(
number=3,
title="Format summary",
dependencies=[2],
config=TransformStepConfig(
transform_type="format",
input_key="$metadata.step_2",
output_format="Summary: {input}",
),
)

$metadata.step_2 is step 2’s result value. $history[-1] would give the whole history entry instead, including the Step N. Title header.