Loop Steps

Parameter reference for the Loop step class, which repeats a sequence of steps until max_iterations or an end_condition is met.

ParameterTypeDefaultDescription
stepsWorkflowStepsRequiredSteps to execute in each loop iteration
nameOptional[str]NoneName of the loop step
descriptionOptional[str]NoneDescription of the loop step
max_iterationsint3Maximum number of iterations for the loop
forward_iteration_outputboolFalseIf True, each iteration receives the previous iteration's output as input. If False, all iterations receive the original loop input
end_conditionOptional[Union[Callable[[List[StepOutput]], bool], Callable[[List[StepOutput]], Awaitable[bool]], str]]NoneFunction or CEL expression string to evaluate if the loop should end
human_reviewOptional[HumanReview]NoneAll HITL settings in a single config. See HumanReview Config.

HumanReview configuration

Pass these settings inside human_review=HumanReview(...). They are not direct constructor arguments. See HumanReview for the complete configuration and supported combinations.

ParameterTypeDefaultDescription
requires_confirmationboolFalsePause for user confirmation before starting the loop
confirmation_messageOptional[str]NoneMessage shown to user when requesting confirmation
requires_iteration_reviewboolFalsePause after each iteration so the user can review and approve, edit, or reject. See Loop HITL.
iteration_review_messageOptional[str]NoneMessage shown to user during iteration review
on_rejectUnion[OnReject, str]OnReject.skipAction when rejected: skip, cancel, retry
Constructor example (install agno first):
from agno.workflow.loop import Loop
from agno.workflow.step import Step
from agno.workflow.types import HumanReview, StepInput, StepOutput

def prepare(step_input: StepInput) -> StepOutput:
    return StepOutput(content=step_input.input)

prepare_step = Step(name="prepare", executor=prepare)
step = Loop(
    steps=[prepare_step], max_iterations=2,
    human_review=HumanReview(requires_confirmation=True),
)