Prerequisites: Familiarity with Python and Flows. This page covers writing code to control flow routing.
flow.goto_step() or conv.goto_flow(). Transition functions control how your agent moves between steps within a flow — or between flows entirely.
flow.goto_step()moves the agent to another step in the current flow. This must be a flow function (scoped to the flow).conv.goto_flow()moves the agent to a different flow. This can be called from a flow function or a global function.
Recognising transition vs global functions in the UI
Global functions are distinguished in flow steps by the function symbol . You can edit them from the flow editor, but changes apply everywhere the function is used in Agent Studio.

Viewing and managing flow functions
To view and manage transition functions, click the Flow functions button in the bottom-right corner of the Flow Editor. This opens a searchable modal showing all flow functions associated with the current flow.
- From a step — open the step’s context menu and select an existing transition or create a new one.
- From the Flow Functions modal — view, rename, delete, or connect transitions to steps.
Creating a transition function
- Connect two steps — if no transition exists, linking two steps prompts you to create one.
- Name your transition — you’ll be asked to name the new function. Use a retrospective, intent-based name.
- Handle name conflicts — if the name is already in use, the UI shows an error. Rename before proceeding.
- View usage references — after creation, the UI shows how many times the function is referenced in prompts.

flow.goto_step() signature
step_name(required) — the name of the target step, exactly as it appears in the Flow Editor. This is case-sensitive.condition_label(optional) — a label for the transition edge. In Function steps, this label appears on the edge in the visual editor and can help with readability, but routing is determined by your code, not the label.
Example: conditional transition logic
A transition function typically checks state and moves to the appropriate step:Switching to a different flow with conv.goto_flow()
Use conv.goto_flow() when the conversation needs to leave the current flow entirely — for example, to start an identity verification or escalation flow.
conv.goto_flow().
Naming functions
Function names directly shape LLM behavior. Use retrospective, intent-based names that describe what just happened or what was resolved — not where the flow is going next.- Good:
last_name_given,phone_number_collected,reservation_confirmed - Also good:
save_postcode,check_availability - Avoid:
goto_next_step,continue_flow,go_to_collect_phone_number
start_confirmation can cause the model to narrate its own flow logic (“Okay, moving on to confirmation now”).
Some teams use past-tense verbs for transition functions (
phone_number_given) and present-tense for global functions (get_status_of_order). Pick a convention and keep it consistent across your project.Common mistakes
- Avoid
- Instead, use
Never chain multiple function calls in a single step. This increases the failure rate and makes flow behavior unpredictable.
Best practices
- Always use
returnimmediately afterflow.goto_step()orconv.goto_flow(). Omitting it can lead to unexpected behavior — only the lastgoto_step()call in a function is executed. - Keep transition functions focused — one decision, one outcome.
- Transition functions are only visible to the LLM if referenced in the current step’s prompt.
- Use them to encapsulate branching logic and control step sequencing — not to generate agent responses.
- If your transition function needs to trigger user-facing output, return a message string instead of calling
goto_step(). These are two separate patterns — don’t mix them in the same code path.
Related reading
- Flow object —
goto_step()andcurrent_stepreference - Conversation object —
goto_flow()andexit_flow()reference - Triggering flows — all the ways to start a flow
- No-code flows — Default steps vs Function steps

