Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 30 additions & 9 deletions api-reference/pipecat-flows/flow-manager.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,16 @@ description: "Core orchestration class for managing conversation flows"

All parameters are keyword-only.

<ParamField path="task" type="PipelineWorker" required>
Pipeline task instance used for queueing frames into the pipeline.
<ParamField path="worker" type="PipelineWorker" required>
Pipeline worker instance used for queueing frames into the pipeline.
</ParamField>

<ParamField path="task" type="PipelineWorker" deprecated>
**Deprecated:** Use `worker` instead. This parameter is deprecated and will be
removed in a future release.

Pipeline worker instance used for queueing frames into the pipeline.

</ParamField>

<ParamField path="llm" type="LLMService | LLMSwitcher" required>
Expand Down Expand Up @@ -103,22 +111,35 @@ async def my_handler(args, flow_manager):
await setup_secure_session(flow_manager)
```

### task
### worker

```python
flow_manager.task -> PipelineWorker
flow_manager.worker -> PipelineWorker
```

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

```python
async def my_handler(args, flow_manager):
from pipecat.frames.frames import TTSUpdateSettingsFrame
await flow_manager.task.queue_frame(
await flow_manager.worker.queue_frame(
TTSUpdateSettingsFrame(settings={"voice": "new-voice-id"})
)
```

### task

<Warning>
**Deprecated:** Use `worker` instead. This property is deprecated and will be
removed in a future release.
</Warning>

```python
flow_manager.task -> PipelineWorker
```

Alias for `worker`. Maintained for backward compatibility.

## Methods

### initialize
Expand All @@ -136,7 +157,7 @@ Initialize the flow manager. Must be called before any node transitions can occu
**Raises:** `FlowInitializationError` if initialization fails.

```python
flow_manager = FlowManager(task=task, llm=llm, context_aggregator=context_aggregator)
flow_manager = FlowManager(worker=worker, llm=llm, context_aggregator=context_aggregator)
await flow_manager.initialize(initial_node=create_initial_node())
```

Expand Down Expand Up @@ -228,7 +249,7 @@ async def create_initial_node() -> NodeConfig:
}

flow_manager = FlowManager(
task=task,
worker=worker,
llm=llm,
context_aggregator=context_aggregator,
transport=transport,
Expand All @@ -250,7 +271,7 @@ transfer_function = FlowsFunctionSchema(
)

flow_manager = FlowManager(
task=task,
worker=worker,
llm=llm,
context_aggregator=context_aggregator,
global_functions=[transfer_function],
Expand Down
7 changes: 4 additions & 3 deletions pipecat-flows/guides/quickstart.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,11 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
]
)

task = PipelineWorker(pipeline)
worker = PipelineWorker(pipeline)

# Initialize flow manager
flow_manager = FlowManager(
task=task,
worker=worker,
llm=llm,
context_aggregator=context_aggregator,
transport=transport,
Expand All @@ -147,7 +147,8 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
await flow_manager.initialize(create_initial_node())

runner = WorkerRunner(handle_sigint=runner_args.handle_sigint)
await runner.run(task)
await runner.add_workers(worker)
await runner.run()
```

That's it! When a user connects, the bot greets them, asks for their favorite color, records the answer, thanks them, and ends the conversation.
Expand Down
4 changes: 2 additions & 2 deletions pipecat-flows/guides/state-management.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ First, create the FlowManager:

```python
flow_manager = FlowManager(
task=task, # PipelineWorker
worker=worker, # PipelineWorker
llm=llm, # LLMService
context_aggregator=context_aggregator, # Context aggregator
transport=transport, # Transport
Expand Down Expand Up @@ -52,7 +52,7 @@ Pipecat Flows supports defining functions that are available across all nodes in

```python
flow_manager = FlowManager(
task=task,
worker=worker,
llm=llm,
context_aggregator=context_aggregator,
transport=transport,
Expand Down
Loading