Loop Open¶
Initializes a loop that can run a fixed number of iterations (for-loop style), conditionally (while-loop style), or a combination of both. It outputs a LOOP context object plus passthrough data channels that will be fed into the loop body and preserved across iterations when wired to a matching Loop Close node.

Usage¶
Use this node to start a looped section of your workflow. Connect the LOOP output to the LOOP input of a Loop Close node. Configure start, step, and end for a fixed iteration range, and/or provide a condition expression to control continuation. Pass any working data through the data and aux outputs to the Loop Close so changes are carried forward each iteration.
Inputs¶
| Field | Required | Type | Description | Example | 
|---|---|---|---|---|
| start | True | INT | Initial counter value for the loop index. | 1 | 
| step | True | INT | Amount to increment (positive) or decrement (negative) the index each iteration. Set to 0 to ignore range stepping and use only the condition. | 1 | 
| end | True | INT | Target boundary used with start and step to determine when the range-based loop is finished. | 10 | 
| condition | True | STRING | A boolean expression evaluated with loop context (e.g., index, start, step, end) and any passed data. The loop runs only while this evaluates to true. Use an empty string or "True" to always allow. | index < end and step != 0 | 
| index_override | False | * | Manually override the current loop index. Useful for complex stepping or jumping to a specific iteration. | 5 | 
| data | False | * | Primary data object to iterate on. Wire this to matching inputs on the Loop Close node to persist changes between iterations. | Image or JSON object | 
| aux | False | * | Auxiliary data to carry through the loop and preserve between iterations. | Mask or list | 
| aux2 | False | * | Second auxiliary data channel. | Integer counter | 
| aux3 | False | * | Third auxiliary data channel. | Text prompt | 
| aux4 | False | * | Fourth auxiliary data channel. | Settings dict | 
Outputs¶
| Field | Type | Description | Example | 
|---|---|---|---|
| LOOP | * | Loop context object (id, index, start, step, end, finished flag, etc.). Connect this to the LOOP input of Loop Close. | {"id": 123, "index": 1, "start": 1, "step": 1, "end": 10, "finished": false} | 
| data | * | Pass-through of the primary data for iteration. Wire to Loop Close to persist updates. | Image or JSON object | 
| aux | * | Pass-through of auxiliary data channel. | Mask or list | 
| aux2 | * | Pass-through of second auxiliary data channel. | Integer counter | 
| aux3 | * | Pass-through of third auxiliary data channel. | Text prompt | 
| aux4 | * | Pass-through of fourth auxiliary data channel. | Settings dict | 
Important Notes¶
- Connect LOOP to Loop Close: The LOOP output must be connected to a Loop Close node to establish and run the loop.
- For-loop vs While-loop: Use start/step/end for fixed iterations. Use condition for while-style continuation. Combine both: the loop stops when either the range completes or the condition becomes false.
- Pure while-loop: Set step to 0 to ignore range stepping and rely only on the condition.
- Index override: Supplying index_override forces the next iteration index. Use with care to avoid skipping beyond your intended bounds.
- Data persistence: To carry updated values across iterations, wire data/aux outputs from Loop Open to the corresponding inputs on Loop Close.
- Blocking behavior: If the condition evaluates to false at the start, the loop is prevented from executing and downstream nodes after Loop Open will not run.
Troubleshooting¶
- Loop never starts: Ensure the condition evaluates to true initially (e.g., index < end when using range stepping). If you only want range control, set condition to True.
- Loop stops immediately: Check the sign of step relative to start and end. For increasing sequences, step should be positive with start < end; for decreasing sequences, step should be negative with start > end.
- Data not updating across iterations: Confirm the data and aux outputs from Loop Open are connected to the corresponding inputs on Loop Close.
- Unexpected index jumps: Remove or adjust index_override if it forces the index beyond the intended range.
- Condition errors or unexpected results: Simplify the condition expression and verify referenced variables (e.g., index, start, step, end) are valid and produce a boolean outcome.
- Infinite loop risk: When using step = 0, ensure the condition will eventually become false based on your loop body logic.