Conditional Steps
Constructor parameters for the workflow Condition class, which branches execution based on an evaluator.
| Parameter | Type | Default | Description |
|---|---|---|---|
evaluator | Union[Callable[[StepInput], bool], Callable[[StepInput], Awaitable[bool]], bool, str] | True | Function, boolean, or CEL expression string that selects the branch |
steps | WorkflowSteps | Required | Steps to execute if the condition is met (if branch) |
else_steps | Optional[WorkflowSteps] | None | Steps to execute if the condition is not met (else branch) |
name | Optional[str] | None | Name of the condition step |
description | Optional[str] | None | Description of the condition step |
human_review | HumanReview | HumanReview(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.
| Parameter | Type | Default | Description |
|---|---|---|---|
requires_confirmation | bool | False | Pause before evaluating the condition. Approval evaluates evaluator; rejection follows on_reject |
confirmation_message | Optional[str] | None | Message shown to user when requesting decision |
on_reject | Union[OnReject, str] | OnReject.skip | Action when rejected: OnReject.else_branch (execute else_steps; raw string value "else"), skip, cancel |
on_error | Union[OnError, str] | OnError.skip | Action 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),
)