Control steps
reduce
Folds a list into one value by running the same steps for each item in order.
How it works
overmust produce a list. The body (do) runs once per item, in order.{{accumulator}}holds the running value, starting atinitial. Each run's result becomes the next{{accumulator}}.{{item}}and{{index}}are available too.
Limits
- Always runs one item at a time. For independent per-item work,
mapfirst and reduce its results. - The body can't contain another
maporreduce.
Input
initialany
Starting accumulator value (any JSON; may use templates). Defaults to null.
The list to fold — usually a template like {{E1.results}} that resolves to an array.
Result
Later steps read these as {{<step id>.<field>}}.
countinteger
How many items ran.
resultobject
The final value of the accumulator.
- id: E1
tool_name: reduce
input:
over: "{{input.over}}"
do: "{{input.do}}"{
"count": 3,
"result": {
"…": "…"
}
}