What is FlowsAgent?
FlowsAgent integrates Pipecat Flows into the subagents framework. It provides structured, node-based conversations where each node defines what the agent says, what functions are available, and where the conversation goes next.
Use FlowsAgent when you need deterministic conversation paths — like booking flows, intake forms, or multi-step processes — that would be hard to control with a free-form LLM prompt. You can have multiple FlowsAgent instances in the same system, each with its own conversation paths, and hand off between them or combine them with LLMAgent for free-form sections.
Creating a FlowsAgent
SubclassFlowsAgent and implement three methods:
FlowsAgent requires a context_aggregator parameter. Pass the same
LLMContextAggregatorPair instance that your main agent uses, so the flows
agent can share conversation context.Defining node functions
Node functions are async methods that receive aFlowManager and any parameters the LLM extracted. They return a tuple of (result, next_node):
name— an identifier for the nodetask_messages— messages injected when entering the node (guide the LLM)functions— which functions are available at this node
Conditional branching
Node functions can return different next nodes based on results:Ending the flow
Usepost_actions with "end_conversation" to end the flow:
Mixing with LLM agents
A common pattern is combining aFlowsAgent with an LLMAgent router. The router handles free-form conversation and transfers to the flows agent when structured input is needed:
Resuming flows
When aFlowsAgent is reactivated (for example, after being handed off and then handed back), it resumes from build_resume_node() instead of build_initial_node():
Global tools
You can add tools that are available at every node using the@tool decorator:
@tool on a FlowsAgent are available at every node, regardless of the node’s functions list. This is useful for escape hatches like transferring to another agent.
Install the Flows extra to use
FlowsAgent: