From 288b537903dc7915ef976c8c37c4928f6e7d9814 Mon Sep 17 00:00:00 2001 From: Paul Kompfner Date: Fri, 7 Nov 2025 14:26:54 -0500 Subject: [PATCH] Add `global_functions` to Pipecat Flows docs --- guides/features/pipecat-flows.mdx | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/guides/features/pipecat-flows.mdx b/guides/features/pipecat-flows.mdx index c4facddd..e98c00ee 100644 --- a/guides/features/pipecat-flows.mdx +++ b/guides/features/pipecat-flows.mdx @@ -413,11 +413,11 @@ async def on_first_participant_joined(transport, participant): For Static Flows, `initialize()` does not take any args. -## Cross-Node State +## Cross-Node Logic -Pipecat Flows supports cross-node state through the `flow_manager.state` dictionary. This persistent storage lets you share data across nodes throughout the entire conversation. +### State -**Basic usage** +Pipecat Flows supports cross-node state through the `flow_manager.state` dictionary. This persistent storage lets you share data across nodes throughout the entire conversation: ```python async def record_favorite_color_and_set_next_node( @@ -428,11 +428,25 @@ async def record_favorite_color_and_set_next_node( Here "record" means print to the console, but any logic could go here; Write to a database, make an API call, etc. """ - flow_manager.state["color"] = args["color"] + flow_manager.state["color"] = args["color"] # Cross-node state setting print(f"Your favorite color is: {args['color']}") return args["color"], create_end_node() ``` +### Functions + +Pipecat Flows supports defining functions that are available across all nodes in your flow. They're defined in the same way as node-specific functions, but are passed into the FlowManager at initialization: + +```python +flow_manager = FlowManager( + task=task, + llm=llm, + context_aggregator=context_aggregator, + transport=transport, + global_functions=[global_function_1, global_function_2], # Cross-node functions +) +``` + ## Usage Examples: ### Dynamic Flow (Recommended)