Skip to content

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.
Preview

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

FieldRequiredTypeDescriptionExample
startTrueINTInitial loop index. Acts as the starting value for iteration.1
stepTrueINTAmount to increment (or decrement if negative) the loop index each iteration.1
endTrueINTBoundary 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
conditionTrueSTRINGExpression 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_overrideFalseANYManually override the current index. Useful for custom stepping or to jump iterations.5
dataFalseANYPrimary payload to iterate over or accumulate/transform across iterations.my_initial_state_object
auxFalseANYAuxiliary payload carried through the loop alongside data.{'running_total': 0}
aux2FalseANYAdditional auxiliary payload carried through the loop.['collected_items']
aux3FalseANYAdditional auxiliary payload carried through the loop.intermediate_result
aux4FalseANYAdditional auxiliary payload carried through the loop.{'flags': ['seen', 'validated']}

Outputs

FieldTypeDescriptionExample
LOOPANYDictionary 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': ''}
dataANYPass-through of the data payload for use in the loop body and preservation across iterations.my_initial_state_object
auxANYPass-through of auxiliary payload 1.{'running_total': 0}
aux2ANYPass-through of auxiliary payload 2.['collected_items']
aux3ANYPass-through of auxiliary payload 3.intermediate_result
aux4ANYPass-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.