Skip to main content

NodeConfig

Configuration for a single node in a conversation flow. task_messages is the only required field.
task_messages
list[dict]
required
List of message dicts defining the current node’s objectives. These tell the LLM what to do in this conversation state.
name
str
Identifier for the node. Useful for debug logging. If not provided, a UUID is generated automatically.
role_message
str
The bot’s role and personality as a plain string. Sent as the LLM’s system instruction via LLMUpdateSettingsFrame. Once set, the system instruction persists across node transitions until a new node explicitly sets role_message again.
role_messages
list[dict[str, Any]]
deprecated
Deprecated list-of-dicts format for the bot’s role and personality. Use role_message (str) instead. Will be removed in 2.0.0.
functions
list[FlowsFunctionSchema | FlowsDirectFunction]
List of function definitions available in this node. Accepts FlowsFunctionSchema objects or direct functions. See Function Types.
pre_actions
list[ActionConfig]
Actions to execute before LLM inference when transitioning to this node. See ActionConfig.
post_actions
list[ActionConfig]
Actions to execute after LLM inference when transitioning to this node. If respond_immediately is False, post-actions are deferred until after the first LLM response in this node. See ActionConfig.
context_strategy
ContextStrategyConfig
Strategy for managing conversation context when transitioning to this node. Overrides the default strategy set on FlowManager. See ContextStrategyConfig.
respond_immediately
bool
default:"True"
Whether to trigger LLM inference immediately upon entering the node. Set to False when you want to wait for user input before the LLM responds (e.g., after a tts_say pre-action that asks a question).

FlowsFunctionSchema

Dataclass for defining function call schemas with Flows-specific properties. Provides a uniform way to define functions that works across all LLM providers.
name
str
required
Name of the function. This is used to identify the function in LLM tool calls.
description
str
required
Description of what the function does. The LLM uses this to decide when to call the function.
properties
dict[str, Any]
required
Dictionary defining the function’s parameters using JSON Schema format.
required
list[str]
required
List of required parameter names from properties.
handler
FunctionHandler
required
Function handler to process the function call. Can be a modern handler (args, flow_manager), legacy handler (args), or zero-arg handler (). Legacy and zero-arg handlers are deprecated. The handler returns any JSON-serializable value, or a ConsolidatedFunctionResult tuple to also specify the next node.
cancel_on_interruption
bool
default:"False"
Whether to cancel this function call when the user interrupts. Set to True if you want the function call to be cancelled when the user speaks.
timeout_secs
float
default:"None"
Optional per-tool timeout in seconds. Overrides the global function_call_timeout_secs set on the LLM service. When None, the global timeout is used.

Methods

to_function_schema

Convert to a standard FunctionSchema for use with LLMs. Strips Flows-specific fields (handler, cancel_on_interruption, timeout_secs).

Example

ActionConfig

TypedDict for configuring actions that execute during node transitions.
type
str
required
Action type identifier. Must match a registered action handler. Built-in types are "tts_say", "end_conversation", and "function".
handler
Callable
default:"None"
Action handler function. Required for custom action types if not previously registered via FlowManager.register_action(). Can be a legacy handler (action) or modern handler (action, flow_manager).
text
str
default:"None"
Text to speak for the tts_say action, or the optional goodbye message for the end_conversation action.
append_text_to_context
bool
default:"True"
For the built-in TTS actions (tts_say and end_conversation), whether the spoken text is appended to the LLM context. Defaults to True.
Additional fields are allowed and passed through to the handler. For example, a "notify_slack" action could include "channel" and "text" fields.

Built-in Action Types

Example

ContextStrategy

Enum defining strategies for managing conversation context during node transitions.

ContextStrategyConfig

Dataclass for configuring context management behavior.
strategy
ContextStrategy
required
The context management strategy to use. See ContextStrategy.
summary_prompt
str
default:"None"
Prompt text for generating a conversation summary. Required when using RESET_WITH_SUMMARY (deprecated). The LLM uses this prompt to summarize the conversation before resetting context.
Raises: ValueError if summary_prompt is not provided when using RESET_WITH_SUMMARY (deprecated).

Example

flows_tool_options Decorator

Decorator that overrides a function’s default call options. It’s optional — a function works without it.
@flows_direct_function is a deprecated alias of @flows_tool_options. It still works but emits a DeprecationWarning; use @flows_tool_options instead.

Example

The function can then be passed directly in a node’s functions list:

Deprecated: flows_direct_function

Deprecated. The @flows_direct_function decorator has been renamed to @flows_tool_options. The old name still works but emits a DeprecationWarning and will be removed in a future version. Update your code to use @flows_tool_options instead.

FlowsDirectFunction

Type alias for direct functions with automatic metadata extraction. Any async callable matching this signature can be used as a direct function in node configurations.
Direct functions must accept flow_manager: FlowManager as the first parameter, followed by any named parameters described in the function’s docstring. Python’s Protocol system cannot express “any concrete named-parameter list”, so this is defined as a generic Callable. Runtime validation is handled by FlowsDirectFunctionWrapper.validate_function.

NO_RESPONSE

Sentinel value used in ConsolidatedFunctionResult to indicate that a function should finish without an immediate response or node transition.
When a function returns NO_RESPONSE as the second element:
  • The function result is added to the conversation context
  • No LLM inference is triggered
  • No node transition occurs
  • The next response is triggered by something else (e.g., user input or another worker)
This is useful for multi-worker handoffs where control is passed to another worker that should respond next, or when a function needs to pause the conversation until an external event occurs. For functions that transition to a new node, use respond_immediately: False in NodeConfig instead.

Type Aliases

FlowResult

Deprecated. No replacement. FlowResult is no longer required or referenced by any handler type, and Pipecat’s upstream function-call-result contract is Any — define your own TypedDict or return any JSON-serializable value. Will be removed in 2.0.0.
Optional convention TypedDict for status/error results. The status field indicates the outcome. The optional error field contains an error message if execution failed. Additional fields are allowed and passed through to the LLM.

FlowArgs

Type alias for function handler arguments. Contains the parameters extracted from the LLM’s function call. Each invocation gets its own dict, so handlers may mutate it freely.
In 2.0.0, this alias is planned to widen to Mapping[str, Any] to align with Pipecat’s typing. Handlers that only read args will be unaffected; handlers that mutate args will need to keep the annotation as dict[str, Any] explicitly.

ConsolidatedFunctionResult

Return type for consolidated function handlers that both do work and specify the next node:
  • First element: Any JSON-serializable value (or None for transition-only functions)
  • Second element: The next node as a NodeConfig, None to stay on the current node and respond, or NO_RESPONSE to finish without transitioning or responding

FlowFunctionHandler

Type for modern function handlers that receive both arguments and the FlowManager instance. Args:
  • args (FlowArgs): Dictionary of arguments from the function call.
  • flow_manager (FlowManager): Reference to the FlowManager instance.
Returns: Any JSON-serializable value, or a ConsolidatedFunctionResult tuple to also specify the next node.

ZeroArgFunctionHandler

Deprecated. Zero-argument function handlers are deprecated and will be removed in 2.0.0. Update handlers to accept (args, flow_manager) instead.
Type for function handlers that take no arguments. The flow manager detects the signature automatically and emits a DeprecationWarning. Returns: Any JSON-serializable value, or a ConsolidatedFunctionResult tuple to also specify the next node.

LegacyFunctionHandler

Deprecated. Single-argument function handlers are deprecated and will be removed in 2.0.0. Update handlers to accept (args, flow_manager) instead.
Type for legacy function handlers that only receive arguments. Both legacy and modern handlers are supported; the flow manager detects the signature automatically and emits a DeprecationWarning. Args:
  • args (FlowArgs): Dictionary of arguments from the function call.
Returns: Any JSON-serializable value, or a ConsolidatedFunctionResult tuple to also specify the next node.