Skip to main content

Overview

FlowManager orchestrates conversation flows by managing state transitions, function registration, and message handling across different LLM providers.

Configuration

All parameters are keyword-only.
worker
PipelineWorker
required
Pipeline worker instance used for queueing frames into the pipeline.
task
PipelineWorker
deprecated
Deprecated: Use worker instead. This parameter is deprecated and will be removed in 2.0.0.Pipeline worker instance used for queueing frames into the pipeline.
llm
LLMService | LLMSwitcher
required
LLM service instance or an LLMSwitcher for switching between providers at runtime. Any LLMService subclass is supported, including OpenAI-compatible services (Groq, Together, Cerebras, DeepSeek, etc.), Anthropic, Google Gemini, and AWS Bedrock.
context_aggregator
Any
required
Context aggregator for managing conversation context. Typically created using LLMContextAggregatorPair from pipecat.processors.aggregators.llm_response_universal.
context_strategy
ContextStrategyConfig
Default context strategy for managing conversation context during node transitions. Can be overridden per-node via NodeConfig.context_strategy. See ContextStrategyConfig.
transport
BaseTransport
default:"None"
Transport instance for communication (e.g., DailyTransport). When provided, accessible via the transport property in function and action handlers.
global_functions
list[FlowsFunctionSchema | FlowsDirectFunction]
default:"None"
Functions that will be available at every node. These are registered once during initialization and automatically included alongside node-specific functions. Useful for capabilities like “transfer to human” that should be accessible from any conversation state.

Properties

state

Shared state dictionary that persists across node transitions. Use this to store and retrieve conversation data such as user preferences, collected information, or any data that needs to be accessible across different nodes.

transport

The transport instance provided during initialization, or None if not set. Use this to interact with the communication platform (e.g., mute participants, access room info).

current_node

The identifier of the currently active conversation node. Returns None before initialization or if no node has been set.

worker

The pipeline worker instance used for frame queueing. Use this for advanced flow control such as queuing custom frames.

task

Deprecated: Use worker instead. This property is deprecated and will be removed in 2.0.0.
Alias for worker. Maintained for backward compatibility.

Methods

initialize

Initialize the flow manager. Must be called before any node transitions can occur. Raises: FlowInitializationError if initialization fails.

set_node_from_config

Transition to a new conversation node. Used to manually trigger node transitions. The node name is taken from the name field in the config, or a UUID is generated if not provided. Raises: FlowTransitionError if the manager is not initialized. FlowError if node setup fails.
In most cases, prefer returning the next node from a consolidated function handler instead of calling this method directly.

get_current_context

Get the current conversation context as a list of messages, including developer messages, user messages, and assistant responses. Raises: FlowError if the context aggregator is not available.

register_action

Register a handler for a custom action type. The handler can be either a modern handler (action, flow_manager) or a legacy handler (action). Legacy single-argument handlers are deprecated and will be removed in 2.0.0.
Once registered, the action can be used in node pre_actions or post_actions:

Usage

Basic Setup

Using Global Functions