Skip to main content
Example use cases: Quality improvement loops, retry mechanisms, iterative refinement A Loop repeats its steps until the end_condition returns True or max_iterations (default 3) is reached. The end condition can be a Python function, a CEL expression string, or omitted to always run the maximum number of iterations. Workflows loop steps diagram

Example

iterative_workflow.py

Iteration Output Forwarding

By default, each iteration starts from the original loop StepInput (forward_iteration_output=False). With forward_iteration_output=True, the next iteration receives an updated StepInput: input remains the original workflow input, while previous_step_content and previous_step_outputs contain results from the preceding iteration.

Developer Resources

Reference

For complete API documentation, see Loop Steps Reference.