On this page
Loop
Workflow reference | Expression contexts
Kind: Loop
Configuration object: loop
Use Loop to execute a nested workflow repeatedly. Iterations are sequential, while independent steps inside the body can run concurrently. Enter the container in the editor to configure its body and connections.
Inputs
The loop receives the current input and named bindings. Its body inherits named bindings and provides:
| Binding | Meaning |
|---|---|
input |
Current item or iteration input. |
item |
Same typed value as the current iteration input. |
index |
Zero-based iteration number. |
previous |
Previous body result; initially the loop's original input. |
original |
Original loop input, unchanged. |
For ForEach, the current input is the selected array item. For Repeat and Until, it is the previous result, beginning with the original input. For Poll, every body execution receives the original input.
Configuration
| Property | Default | Usage |
|---|---|---|
mode |
ForEach |
ForEach, Repeat, Until, or Poll. |
body |
Empty workflow named "Loop body" |
Nested schema-version-1 workflow. Runnable bodies need at least one node. |
items |
Input expression | Array-producing expression for ForEach. The expression object must remain valid in other modes too. |
count |
3 |
Repeat count, 0-100. For Repeat, cannot exceed maximumIterations. |
maximumIterations |
10 |
1-100 for ForEach, Repeat, and Until; 1-1,000 for Poll. |
intervalSeconds |
0 |
Poll requires 1-3,600 seconds. Other modes permit zero. |
until |
Unset | Optional Boolean expression evaluated after each Until or Poll body result. |
| Mode | Execution and termination |
|---|---|
ForEach |
Evaluates items once and processes every element. An array larger than maximumIterations fails the run before any iteration starts. |
Repeat |
Executes exactly count times, unless interrupted by failure, cancellation, or timeout. |
Until |
Executes a body, evaluates until, and stops on true or at maximumIterations. Without a predicate, it reaches the configured bound. |
Poll |
Runs immediately, then uses interval ticks between later iterations. Body executions do not overlap. An optional until predicate stops on true; reaching the bound with a configured false predicate fails the step. |
Without until, Poll retains its fixed, bounded refresh behavior. With until, it checks the terminal condition after every response, including the first. The background-job automation uses this to stop on completed or failed status and then explicitly requires a completed result.
After an Until or Poll body result, predicate bindings input and result refer to that result. Iteration values such as index, original, and the earlier previous are also available.
Outputs
ForEach returns an ordered array of body results. An empty item array returns []. Repeat, Until, and Poll return their last body result. A zero-count Repeat returns its original input. Reaching an Until bound completes with the last result and reports that the iteration bound was reached.
A body with one active terminal data output returns that typed value. Several active terminal outputs are combined into named text sections; design one terminal Expression when an iteration must return structured JSON. A body with no active terminal data outputs returns null.
Example
{
"id": "normalize-items",
"name": "Normalize each label",
"kind": "Loop",
"loop": {
"mode": "ForEach",
"items": { "function": "input", "value": "input" },
"maximumIterations": 10,
"body": {
"schemaVersion": 1,
"id": "normalize-item-body",
"name": "Normalize one label",
"nodes": [
{
"id": "trim-item",
"name": "Trim the label",
"kind": "Expression",
"expression": {
"function": "trim",
"arguments": [
{ "function": "input", "value": "input" }
]
}
}
],
"edges": []
}
}
}
Input [" Alpha ", " Beta "] produces ["Alpha","Beta"].
Operational notes
The loop node's timeout covers all iterations. The body's workflow timeout bounds each body execution; child node timeouts are also enforced. The root workflow deadline remains an outer bound. Polling intervals and nested executions consume these deadlines and the run's node-execution budget.
Keep node IDs globally unique across all bodies. Connections remain inside their graph; containers pass data through their input and terminal outputs. Run-scoped variables can retain state between iterations, with exactly one writer node and acyclic inferred dependencies.