The Flow
object exposes useful information about the current flow and allows transitioning between steps in the flow.
Flow
object gives you control over how the agent moves between steps in a flow. It is most commonly used inside transition functions, where deterministic logic determines what happens next.
flow.goto_step()
call in a function is executed. To prevent accidental overrides, always use return
immediately after a goto_step()
call — unless you’re explicitly chaining transitions.current_step
(Property)string
Returns: The name of the current step the agent is in.
goto_step(step_name)
(Method)flow.goto_step()
to move the agent to another step in the flow. This replaces the current step’s prompt and functions with those of the target step.
return
immediately after calling goto_step()
to avoid silent failures. Only the final call in a function is executed.go_to_step_two
, the LLM may generate irrelevant responses like “Okay, moving on.” Use intent-based names like check_user_info
or verify_email
to anchor model behavior.current_step
for step-aware debugging or conditional re-routing.conv.exit_flow()
and are visually marked in yellow in the Flow Editor.