Skip to main content

Flows choreograph multi-step processes. At any given moment, the model only sees the current step’s prompt and tools.

A good flow keeps each step focused on a single task. Use Python for branching, validation, and routing logic, and use prompts for conversational behavior.

File structure

Flows live under the flows/ directory.
The flow directory name is derived from the flow’s name field, converted to lowercase snake_case. A flow named Booking Flow must live in flows/booking_flow/. If the directory name does not match, the ADK will not recognize the flow.

What flows are for

Flows are best used when the agent needs to move through a structured process such as:
  • collecting information in a defined order
  • confirming details before taking action
  • calling APIs or deterministic logic at specific points
  • handling success, failure, and retry paths explicitly

Default steps

LLM-driven steps for collecting information and transitioning based on conditions.

Advanced steps

Steps that call transition functions from the prompt instead of relying on built-in conditions.

Function steps

Deterministic Python steps for routing, validation, and API calls.
Default and advanced steps can both override project-level ASR, VAD, barge-in, and LLM settings for a single turn — see step settings below.

Entering a flow

A flow can be entered in several ways.

From code

This enters the flow at its configured start step.

Via a returned transition

Within a flow

This is only available inside flow functions.

Flow configuration

Each flow includes a flow_config.yaml file that defines the flow itself.

Fields

Example

Step types

A step represents the agent’s current position in the flow. There are three step types:
  1. default steps
  2. advanced steps
  3. function steps

Default steps

Default steps live in steps/*.yaml. These steps use LLM logic to process information and transition based on configured conditions. They cannot call transition functions from their prompt. ASR biasing is automatically configured based on the entities requested in the step.

Fields

Default steps can also include any of the step settings below.

Prompt behavior

Default step prompts may use entity references such as:
They should not contain function calls.

Conditions

Conditions define how the agent transitions out of a default step. A condition can:
  • go to another step
  • exit the flow

Condition fields

child_step rules

Use the correct step identifier depending on target type:
  • Default step or advanced step: use the step’s name
  • Function step: use the Python filename without .py

Advanced steps

Advanced steps also live in steps/*.yaml. Unlike default steps, they don’t define conditions or extracted_entities — instead they transition by calling transition functions from the prompt.

Fields

Advanced steps can also include any of the step settings below.

Step settings

Both default and advanced steps can override project-level ASR, DTMF, VAD, barge-in, and LLM behavior for a single turn. Each settings block below is optional and sits at the top level of the step file — omit a block to inherit the project-level setting.

ASR biasing

Steps can tune ASR toward specific kinds of user input. Supported ASR biasing fields include:
  • alphanumeric
  • name_spelling
  • numeric
  • party_size
  • precise_date
  • relative_date
  • single_number
  • time
  • yes_no
  • address
  • custom_keywords

DTMF configuration

Steps can also define DTMF behavior, including:
  • inter_digit_timeout
  • max_digits
  • end_key
  • collect_while_agent_speaking
  • is_pii

ASR override

Override the speech recognition provider or model for this step.

VAD

Tune voice activity detection — how the platform decides the caller has started and stopped speaking.

Barge-in

Control whether the caller can interrupt the agent on this step.
Use this to protect a step the caller should hear in full, such as a legal disclaimer.

LLM

Override the model or its reasoning effort for a single step.
Raising reasoning effort on a step that has to weigh several conditions can improve reliability; lowering it on a simple collection step reduces latency.

Clearing a settings block

Removing a block from the step file clears that override on the next push — but only for asr, vad, barge_in, and llm. asr_biasing and dtmf_config deep-merge into their platform-side values instead, so to turn those off set is_enabled: false rather than deleting the block.

Step prompt design

Prompts should be used for:
  • collecting input
  • presenting information
  • shaping the conversational turn
Python should be used for:
  • comparisons
  • conditionals
  • routing
  • state-driven decisions
Do not put deterministic branching logic into promptsDo not encode logic like “If $x == 0 do A, else do B” in prompts. Put that logic in Python and transition to the correct step explicitly.

Prompt tips

  • use markdown headers to structure instructions
  • keep one clear purpose per step
  • include validation and edge cases where needed
  • use voice-friendly phrasing for spoken interactions
  • make transitions explicit

Function steps

Function steps live in function_steps/*.py. These are deterministic Python steps. They execute directly, with no model interpretation. Use them for:
  • API calls
  • validation
  • state updates
  • explicit routing

Signature

Important rules

Function steps:
  • cannot define extra parameters
  • cannot use @func_description
  • must control flow explicitly
  • must have a name that is unique across the whole project, not just within their own flow — a duplicate name in a different flow causes a build error
A function step must call either:
  • flow.goto_step(...)
  • conv.exit_flow()
and may also return a context string for the model.

Common uses

Validation

Check whether collected input is valid before the flow continues.

Routing

Move to the correct step based on deterministic logic.

External calls

Call APIs and store the results in state.

Error handling

Send the flow to an error step with a useful context string.

Transition functions

Transition functions live in functions/*.py inside a flow. They can be called from advanced-step prompts and are referenced using:
Unlike function steps, transition functions:
  • may define custom parameters
  • may have a description shown to the model
  • can be called by the model within the same flow
Logic reused across flows is usually better placed in global functions.

Validation

  • A step name must be unique within its flow, across step types.
  • A condition name must be 1 to 50 characters and unique within its step.
  • A condition’s child_step must be a step in the same flow.
  • inter_digit_timeout and max_digits (DTMF configuration) cannot be negative.
  • vad_start and vad_end (VAD) must be finite and non-negative — poly validate rejects a negative or infinite value.

Best practices

  • keep one clear purpose per step
  • start with a simple linear path, then add branching
  • use confirmation steps before function steps that change state
  • add explicit error and failure paths
  • use meaningful step names
  • test the full path from entry to exit
Prefer simple flows firstA clean A → B → C path is easier to reason about and test than a highly branched flow built too early.

Common mistakes

A flow function that does not advance the flow

Flow functions must always advance the flow. A function that returns without changing step or flow leaves the agent sitting in the same logical place with no clear next state.
A stuck flow is usually a control-flow bugIf a flow function does not move the agent forward, the conversation can become stuck in an invalid or confusing state.

Mixing conv.exit_flow() with navigation

Do not create a dedicated “Anything else?” step just to wrap up a flow. When the flow is finished, exit it and return the closing prompt there. Calling conv.exit_flow() and then also navigating does not do both — the navigation overrides the exit:
Pick one: exit the flow and return the closing content, or navigate to another step or flow. Never both.

end_turn=False while waiting for a reply

end_turn=False should only be used when the agent speaks and then immediately performs another action in the same turn, without waiting for input.
Using it after the agent asks a question produces awkward control flow, because the question should simply be part of the normal utterance. If the caller is expected to answer, put the full question in the utterance and let the turn end normally.

Others

  • encoding branching logic in prompts rather than Python
  • using internal IDs instead of resource names
  • putting too much deterministic logic into LLM-driven steps
  • reading entity values with conv.entities where a prompt reference would do — use {{entity:entity_name}} directly in the step prompt

Functions

Learn how global functions, transition functions, and function steps differ.

Topics

See how topics trigger flow entry via conv.goto_flow in their actions.

Entities

See how structured data collection fits into flow steps and conditions.

Resource architecture

Where facts belong in rules and topics versus logic in Python — the broader pattern behind the prompts-vs-code mistake above.

Return values reference (platform)

All supported function return shapes used in flow transitions — utterance, hangup, goto_flow, and combined dicts.

Conversation object reference (platform)

Full reference for conv.goto_flow, conv.exit_flow, flow.goto_step, and all other flow navigation methods.
Last modified on November 27, 2026