Skip to main content
Run steps repeatedly until an end condition is met or max iterations reached.

How It Works

  1. generate and evaluate steps execute sequentially.
  2. After each iteration, end_condition receives all step outputs from that iteration.
  3. If it returns True, the loop stops.
  4. If max_iterations is reached, the loop stops regardless.

Parameters

Callable[[List[StepOutput]], bool]
Called after each iteration. Return True to stop. Supports sync and async.
int
default:"3"
Maximum iterations before stopping.

Tracking Iterations

Use the LoopIterationEvent to monitor progress: