OptionalactionExecute action per iteration
Path in payload to array to iterate over
OptionalcontinueContinue processing if an iteration fails (default: false)
OptionaldelayDelay between iterations in milliseconds (default: 0)
OptionalexecutionExecution mode for iterations (default: 'sequential')
OptionalindexVariable name for loop index (default: "index")
OptionalitemVariable name for current item (default: "item")
OptionalmaxMaximum number of iterations to process concurrently when executionMode='parallel' (default: 10) Only applies when executionMode='parallel'. Controls batch size to prevent resource exhaustion. Recommended values:
OptionalmaxMaximum iterations. undefined takes the default (1000); any other value is the limit,
INCLUDING 0, which means zero iterations rather than unlimited.
This corrects a long-standing comment that said 0=unlimited. The engines have always
computed Math.min(collection.length, maxIterations ?? 1000), so zero has always meant
zero — the comment described an intent the code never implemented.
OptionalpromptExecute a prompt per iteration.
The cheapest loop body there is: one model call per item with no agent wrapper, no reasoning loop, no guardrails and no run record. Right whenever an iteration is a single transformation — classify this, extract these fields, describe this column — and wrong the moment an iteration needs to decide what to do next, which is what a sub-agent is for.
OptionaloutputMapping?: stringJSON mapping from the prompt's response into the payload, per iteration.
OptionaltemplateParameters?: Record<string, string>Values bound into the prompt's template, alongside the loop's own item and index.
OptionalsubExecute sub-agent per iteration
Universal ForEach loop configuration used by all agent types. Flow agents convert AIAgentStep configuration to this format. Loop agents receive this from LLM responses.
Since
2.112.0