Hello World Example
View the full source code on GitHub
Prerequisites
Pipecat Flows is included with Pipecat. Install Pipecat with the services used in this example:Define the Nodes
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.Initial Node
The initial node sets the bot’s personality viarole_message, gives it a task via task_messages, and lists the function the LLM will call when the user answers:
End Node
The end node thanks the user and ends the conversation via theend_conversation post-action:
Write the Function
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:
(result, next_node). The result is provided to the LLM as context, and the next node is where the conversation transitions to.
Build the Pipeline and FlowManager
Set up a standard Pipecat pipeline, then create aFlowManager and initialize it when a client connects:
See the full source
code
for the complete runnable example.
Next Steps
Nodes & Messages
Learn about node configuration and message types
Functions
Understand node and edge functions
Examples
Explore more complex examples
API Reference
Complete technical reference