Dive

Control steps

map

Runs the same steps once for each item in a list and collects the results.

How it works

  • over must produce a list. The body (do) runs once per item, with {{item}} and {{index}} available.
  • concurrency runs that many items at once. Use it only when items don't depend on each other.
  • onError: skip leaves failed items out of results and lists them in failed, with failed_count, instead of failing the plan.

Limits

  • The body can contain agent, ask, filter, route and exit, but not another map or reduce. Call a plan for nested iteration.
  • ask steps in the body run one item at a time.

Input

Maximum items in flight; 1 (default) runs items one at a time.

doobject | object[]required
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

overanyrequired

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.

Why it failed.

The failed item's position in the list.

The failed item.

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": [
    {
      "…": "…"
    },
    {
      "…": "…"
    }
  ]
}