OptionalactionExecute action per iteration
Boolean expression evaluated before each iteration
OptionalcontinueContinue processing if an iteration fails (default: false)
OptionaldelayDelay between iterations in milliseconds (default: 0)
OptionalitemVariable name for attempt context (default: "attempt")
OptionalmaxMaximum iterations. undefined takes the default (100); 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 ?? 100), 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 While 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