The Document
A config has aninitial_node, a map of nodes keyed by name, and an optional list of global_functions. Here is the food-ordering example in full:
flow.yaml
The full example, with its complete prompts and its
handlers.py, is in
examples/flows/yaml/food_ordering/.Keys
At the top level,initial_node names the node the flow starts in, nodes holds the nodes keyed by name, and global_functions lists tools offered at every node. The key under nodes is the node’s name: it is what initial_node and every transition_to refer to.
A node has:
task_messages(required): what the LLM should do at this node, each entry with aroleandcontent.role_message: the bot’s role, sent as the LLM’s system instruction and kept until another node sets its own.functions: the tools the node offers. See Functions.pre_actionsandpost_actions: see Actions.context_strategy:appendorreset. See Context Strategies.respond_immediately: whether the LLM responds as soon as the node is entered. Defaults to true.
role_message and each task message’s content may contain {{ key }} placeholders, filled from the manager’s state each time the node is entered. See Placeholders. Every field, with its validation rules, is in the FlowConfig reference.
Loading a Config
FlowConfig is a Pydantic model, so model_validate is the loader for a dict you built or fetched yourself.
Splitting Out Long Prompts
A YAML config loaded withfrom_file can pull text in from another file with !include, resolved relative to the config’s own directory. This keeps a long prompt out of the graph:
!include is available with from_file, and with from_yaml when you pass base_dir. It is not available in JSON.
Validation
A config is checked in two stages. On load, its structure: the top level is a mapping,initial_node names a defined node, every transition_to names a defined node, tool names are unique within a node and across global_functions, a transition_only entry has both a description and a plain node name to transition to, an ordinary entry has no description, and every action is well-formed. A failure raises a Pydantic ValidationError.
When the Flow is constructed, its references into your code: every tool it names exists in the handlers, is callable, and is a valid direct function; every action handler it names exists. These are collected and reported together as a single FlowReferenceError, rather than stopping at the first, so one run surfaces every miss.
FlowProblem with a stable code, so you can handle them programmatically.
Joining a Config to Code
AFlow is a config joined to the Python it names:
handlers can be:
- A module, as above — the usual case. Its top-level functions are looked up by name.
- A mapping of names to callables, when you want to build the namespace yourself or expose a tool under a different name than the function has.
- A list or tuple of either, when tools and action handlers live in separate modules.
FlowManager:
NodeConfig
The node the flow starts in, ready to pass to
FlowManager.initialize().list
The config’s global functions, ready to pass to
FlowManager(global_functions=...). A fresh list each time, so you can extend
it with tools defined in code.NodeConfig
Any node by name, for the rare case where code needs to jump into the graph
directly. Raises
FlowError if the config has no such node.Loading a Flow Per Session
Because the config is just a document, the bot doesn’t have to ship with it. Fetch the flow a session calls for, seed the facts its prompts refer to, and initialize:Tooling
The config format’s JSON Schema is published in the Pipecat repository atsrc/pipecat/flows/flow_config.schema.json. Point your editor at it for completion and inline validation while writing a config, or vendor it into a tool that generates one.
The Pipecat Flows Visual Editor lets you design a flow visually rather than by hand.
Next Steps
Functions
Tool entries, transition-only functions, and branch tables
State Management
Placeholders, cross-node state, and global functions
Actions
Built-in and custom actions in a config
FlowConfig Reference
Every field, loader, and validation rule