Skip to content

Add multi-worker handoff example combining Flows with the worker framework#280

Merged
markbackman merged 2 commits into
mainfrom
aleix/multi-worker-flows-example
Jun 5, 2026
Merged

Add multi-worker handoff example combining Flows with the worker framework#280
markbackman merged 2 commits into
mainfrom
aleix/multi-worker-flows-example

Conversation

@aconchillo

@aconchillo aconchillo commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a new example, examples/multi_worker_handoff.py, demonstrating how Pipecat Flows composes with Pipecat's multi-worker framework (the worker model introduced with Pipecat 1.3.0). It ports the idea from the now-archived pipecat-subagents FlowsAgent example onto the native worker API.

Three workers share a single bus:

  • Main worker — owns the transport (STT/TTS) and the single shared LLMContext; bridges user/assistant frames onto the bus via BusBridgeProcessor. It runs no LLM itself.
  • Router worker — a plain LLMWorker for open-ended chit-chat, with @tool transfer_to_reservation / end_conversation.
  • Reservation worker — a structured Flows conversation (party size → time → availability → confirm), with a transfer_to_router escape hatch at every node.

Only one worker is active at a time; hand-offs (via activate_worker(..., deactivate_self=True)) are seamless. All workers speak into the main worker's shared context_aggregator.

The reservation worker is built by build_reservation_worker(...) returning a plain PipelineWorker (same style as the sensor-controller example) — no subclass. A FlowManager is wired onto the worker and the flow is initialized/resumed from the worker's on_activated event handler.

…ework

Adds examples/multi_worker_handoff.py demonstrating how Pipecat Flows
composes with Pipecat's multi-worker framework. A free-form LLMWorker
router hands off to and from a structured Flows reservation worker over
the bus, sharing a single conversation context. The reservation worker is
built as a plain PipelineWorker with a FlowManager wired onto it and the
flow (re)initialized from its on_activated event handler.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
@aconchillo aconchillo requested a review from markbackman June 4, 2026 19:05

@markbackman markbackman left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks for making this update 🙌

@markbackman markbackman merged commit e9e9aff into main Jun 5, 2026
2 checks passed
@markbackman markbackman deleted the aleix/multi-worker-flows-example branch June 5, 2026 14:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants