Conditional Steps

Constructor parameters for the workflow Condition class, which branches execution based on an evaluator.

ParameterTypeDefaultDescription
evaluatorUnion[Callable[[StepInput], bool], Callable[[StepInput], Awaitable[bool]], bool, str]TrueFunction, boolean, or CEL expression string that selects the branch
stepsWorkflowStepsRequiredSteps to execute if the condition is met (if branch)
else_stepsOptional[WorkflowSteps]NoneSteps to execute if the condition is not met (else branch)
nameOptional[str]NoneName of the condition step
descriptionOptional[str]NoneDescription of the condition step
human_reviewHumanReviewHumanReview(on_reject=OnReject.else_branch)Human review configuration. See the fields below.

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 before evaluating the condition. Approval evaluates evaluator; rejection follows on_reject
confirmation_messageOptional[str]NoneMessage shown to user when requesting decision
on_rejectUnion[OnReject, str]OnReject.skipAction when rejected: OnReject.else_branch (execute else_steps; raw string value "else"), skip, cancel
on_errorUnion[OnError, str]OnError.skipAction when a sub-step fails: skip (log and stop remaining sub-steps), fail (re-raise), pause (pause for HITL retry or skip)

When human_review is omitted, Condition creates HumanReview(on_reject=OnReject.else_branch). An explicitly supplied HumanReview() uses its own OnReject.skip default. Set on_reject=OnReject.else_branch explicitly when rejection should run else_steps.

Constructor example (install agno first):

from agno.workflow.condition import Condition
from agno.workflow.step import Step
from agno.workflow.types import HumanReview, StepInput, StepOutput, OnReject

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

prepare_step = Step(name="prepare", executor=prepare)
step = Condition(
    steps=[prepare_step], evaluator=True,
    human_review=HumanReview(requires_confirmation=True, on_reject=OnReject.else_branch),
)