Behavior
- Increments the counter variable on each iteration
- Checks the exit condition (if configured) before each iteration
- Routes to
Loopto continue,Exitwhen the exit condition is met, orMaxwhen max iterations are reached
Configuration
| Parameter | Type | Default | Range | Description |
|---|---|---|---|---|
maxIterations | number | 3 | 1–100 | Maximum number of loop iterations |
counterVariable | string | "loop_count" | — | Variable name that stores the current iteration number |
exitCondition | string | "" | — | Expression that, when truthy, triggers the Exit path |
continueOnError | boolean | false | — | Continue looping even if a node in the loop body errors |
Output handles
| Handle | Description |
|---|---|
| Loop | Continue to the next iteration — connect this to the first node in the loop body |
| Exit | Exit condition was met |
| Max | Maximum iterations reached |
Use cases
Retry pattern
Retry pattern
Loop up to 3 times around an API Call node. On
API.SUCCESS, take the Exit path. On API.ERROR, loop again. After 3 failures, the Max path plays an error message and ends the call.Multi-item collection
Multi-item collection
Loop to collect multiple data points from the caller (e.g., “Enter item 1… Enter item 2…”). Use
{{loop_count}} in the TTS text to indicate which item number.Menu replay
Menu replay