Skip to main content
Flows guide callers through structured, multi-step processes – collecting a booking reference, routing by account type, or verifying identity before transferring. example-main Flows are found under Build > Flows in Agent Studio. Use Managed Topics for simple question-and-answer interactions. Use flows when the conversation requires a specific sequence of steps, input validation, or branching logic. This page includes Python code. For no-code flows, see no-code flows.

How to trigger a flow

Three ways to start a flow:
  1. From code – call conv.goto_flow("Reservation flow") in a function
  2. From a Managed Topic – type /Flow in the Actions field
  3. From another flow – use conv.goto_flow() in a Function step or transition function
See triggering flows for detailed instructions and examples. APIs do not trigger flows directly. Flows orchestrate steps, and Function steps can call APIs.

How flows work

Each flow is made up of:
  • Steps: Self-contained conversation states, made up of:
    • Text prompts, just like Knowledge topics.
    • Global functions and transition functions: Logic blocks that validate input, call APIs, store values, and move the conversation forward.
That means as each step is sequentially processed, the LLM sees:
  • The current step’s text prompt.
  • A list of available functions with names, descriptions, and arguments.
What the LLM doesn’t see:
  • Previous step prompts.
  • Any system context, unless it’s surfaced in the prompt or state.
Previous steps are not visible to the LLM. Each prompt must be self-contained.

LLM interaction model

When the agent is inside a flow step, this is the input order:
  1. System prompt (includes Behavior and Agent agent configuration).
  2. Any relevant Knowledge topics (if applicable).

Knowledge function visibility in flows

To make global Knowledge functions available while a flow is running, enable this in your agent’s Voice configuration or Chat configuration settings (under the advanced LLM configuration section). Contact your PolyAI representative if you need help enabling this setting.

Key techniques

These techniques require Python. See Code-driven flows in the sidebar.

Connecting steps

In the Flow Editor:
  • Use /Steps in the prompt to connect to the next step
  • Add named transition functions to manage movement between states
  • Use the Flow Functions modal to see all transitions in one place
Always include an exit step in your flow. Un-exited flows can cause hallucinations.
Use descriptive function names like check_reservation_match, not vague ones like step_two – this helps the LLM reason correctly.

Standard entity types

Define the kind of input your agent collects (Alphanumeric, Number, Date, Time, Phone number, Name, Address, Free text, Multiple choice). See entity types for configuration.

Next steps

Example flow

A complete reservation confirmation flow with step-by-step walkthrough.

No-code flows

Build flows visually with prompts and entity extraction – no Python required.

Transition functions

Write Python logic to control how your agent moves between steps.

ASR biasing

Improve voice transcription accuracy for structured inputs.

Few-shot prompting

Use examples in prompts to improve accuracy and reduce ambiguity.

Flow object

Python reference for goto_step() and current_step.
Last modified on April 20, 2026