Control steps
map
Runs the same steps once for each item in a list and collects the results.
How it works
overmust produce a list. The body (do) runs once per item, with{{item}}and{{index}}available.concurrencyruns that many items at once. Use it only when items don't depend on each other.onError: skipleaves failed items out ofresultsand lists them infailed, withfailed_count, instead of failing the plan.
Limits
- The body can contain
agent,ask,filter,routeandexit, but not anothermaporreduce. Call a plan for nested iteration. asksteps in the body run one item at a time.
Input
concurrencyinteger
Maximum items in flight; 1 (default) runs items one at a time.
onErrorenum<string>
fail (default): a failing item fails the step. skip: failed items are left out of results and listed in failed.
Available options: fail, skip
The list to iterate — usually a template like {{E0.issues}} that resolves to an array.
Result
Later steps read these as {{<step id>.<field>}}.
countinteger
How many items ran.
failedobject[]
With onError: skip: the items that failed.
failed.[].errorstring
Why it failed.
failed.[].indexinteger
The failed item's position in the list.
failed.[].itemobject
The failed item.
failed_countinteger
With onError: skip: how many items failed.
resultsobject[]
Each item's result, in input order.
- id: E1
tool_name: map
input:
over: "{{input.over}}"
do: "{{input.do}}"{
"count": 2,
"failed": [
{
"error": "tool error: …",
"index": 2,
"item": {
"…": "…"
}
}
],
"failed_count": 1,
"results": [
{
"…": "…"
},
{
"…": "…"
}
]
}