Build your first conversation flow with Pipecat Flows.
This guide walks through the Hello World example — a two-node conversation flow where the bot asks for a favorite color, records the answer, and says goodbye.
A flow is a graph of nodes. Each node gives the LLM a task and the functions it needs. This example has two nodes: one to ask a question and one to end the conversation.
The initial node sets the bot’s personality via role_message, gives it a task via task_messages, and lists the function the LLM will call when the user answers:
from pipecat_flows import FlowManager, NodeConfigdef create_initial_node() -> NodeConfig: return NodeConfig( name="initial", role_message="You are an inquisitive child. Use very simple language. Ask simple questions. You must ALWAYS use one of the available functions to progress the conversation. Your responses will be converted to audio. Avoid outputting special characters and emojis.", task_messages=[ { "role": "developer", "content": "Say 'Hello world' and ask what is the user's favorite color.", } ], functions=[record_favorite_color], )
The end node thanks the user and ends the conversation via the end_conversation post-action:
def create_end_node() -> NodeConfig: return NodeConfig( name="end", task_messages=[ { "role": "developer", "content": "Thank the user for answering and end the conversation", } ], post_actions=[{"type": "end_conversation"}], )
Nodes can be defined as plain dicts or as NodeConfig objects — both work
identically.
When the LLM calls the function, it processes the result and returns the next node. record_favorite_color is a direct function: its first parameter is flow_manager, the rest (here, color) become the function’s parameters, and Flows derives the schema (advertised to the LLM) from the signature and docstring:
async def record_favorite_color( flow_manager: FlowManager, color: str,) -> tuple[str, NodeConfig]: """Record the color the user said is their favorite. Args: color: The user's favorite color. """ print(f"Your favorite color is: {color}") return color, create_end_node()
The function returns a tuple of (result, next_node). The result is provided to the LLM as context, and the next node is where the conversation transitions to.