Loop Open¶
Initializes a generalized loop that can behave like a for-loop, a while-loop, or a hybrid of both. It emits a LOOP state dictionary plus passthrough data slots to be fed into a matching Loop Close node for iterative processing. The loop can be driven by start/step/end and/or a boolean expression evaluated each iteration.

Usage¶
Use this node to automate repeated execution of a section of your workflow. Connect the LOOP output to the LOOP input of a Loop Close node. Configure start, step, and end for for-loop behavior, set condition for while-loop behavior, or combine both. Feed any data you want to persist/update across iterations via data and aux inputs; wire the corresponding outputs from Loop Open to the matching inputs on Loop Close to carry state forward.
Inputs¶
| Field | Required | Type | Description | Example |
|---|---|---|---|---|
| start | True | INT | Initial loop index. Acts as the starting value for iteration. | 1 |
| step | True | INT | Amount to increment (or decrement if negative) the loop index each iteration. | 1 |
| end | True | INT | Boundary value at which the loop should stop. With positive step, iteration stops when index reaches or passes end; with negative step, when it crosses end in the opposite direction. | 10 |
| condition | True | STRING | Expression that must evaluate to True for the loop to execute this iteration. Leave as 'True' to run purely by start/step/end. Common variables you can reference: start, end, step, index, finished, data, aux, aux2, aux3, aux4. | index < end and step != 0 |
| index_override | False | ANY | Manually override the current index. Useful for custom stepping or to jump iterations. | 5 |
| data | False | ANY | Primary payload to iterate over or accumulate/transform across iterations. | my_initial_state_object |
| aux | False | ANY | Auxiliary payload carried through the loop alongside data. | {'running_total': 0} |
| aux2 | False | ANY | Additional auxiliary payload carried through the loop. | ['collected_items'] |
| aux3 | False | ANY | Additional auxiliary payload carried through the loop. | intermediate_result |
| aux4 | False | ANY | Additional auxiliary payload carried through the loop. | {'flags': ['seen', 'validated']} |
Outputs¶
| Field | Type | Description | Example |
|---|---|---|---|
| LOOP | ANY | Dictionary describing current loop state. Typical keys: id, start, end, step, index, finished, last_id, condition_open. | {'id': 123456, 'start': 1, 'end': 10, 'step': 1, 'index': 1, 'finished': False, 'last_id': ' |
| data | ANY | Pass-through of the data payload for use in the loop body and preservation across iterations. | my_initial_state_object |
| aux | ANY | Pass-through of auxiliary payload 1. | {'running_total': 0} |
| aux2 | ANY | Pass-through of auxiliary payload 2. | ['collected_items'] |
| aux3 | ANY | Pass-through of auxiliary payload 3. | intermediate_result |
| aux4 | ANY | Pass-through of auxiliary payload 4. | {'flags': ['seen', 'validated']} |
Important Notes¶
- Condition semantics: The condition is a string expression evaluated with access to loop variables like index, start, end, step and your data/aux inputs. If empty, it defaults to True.
- For vs While: Set step to 0 to emulate a pure while-loop controlled only by condition. Provide both condition and step to create a hybrid loop that stops when either limit is reached.
- Bounds and direction: Positive step stops when index >= end; negative step stops when index <= end.
- Index override: Use index_override to jump to a specific index for the next iteration (advanced control).
- Pairing required: Always connect this node to a Loop Close node via the LOOP output to actually iterate.
- Data persistence: To preserve evolving state across iterations, wire the corresponding data/aux outputs from Loop Open into the matching inputs on Loop Close.
Troubleshooting¶
- Loop never runs: Ensure condition evaluates to True on the first iteration and that start/step/end aren't immediately marking the loop as finished.
- Infinite or stalled loop: Verify that step is non-zero when using for-loop semantics and that condition will eventually become False; with step=0, ensure condition becomes False based on your data/aux updates.
- Unexpected early stop: Check end relative to start and the sign of step; a mismatched direction can end immediately.
- Condition errors: If referencing variables, confirm they exist (e.g., index, data, aux) and the expression is valid.
- State not carrying over: Make sure you connect data/aux outputs from Loop Open to the matching inputs of Loop Close so updates persist between iterations.