multi_worker_handoff

command
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 27, 2026 License: BSD-2-Clause Imports: 26 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Command multi_worker_handoff composes conversation flows with multiple workers: a free-form LLM router and a structured flow worker.

Three workers share a single bus:

  • A main worker owns the transport (STT, TTS) and the shared conversation context. It does not run an LLM itself; instead it bridges user and assistant frames onto the bus so other workers can take turns speaking to the user.
  • A router worker (a plain LLM worker) handles open-ended chit-chat and general questions about the restaurant. When the user wants to book a table it hands off to the reservation worker.
  • A reservation worker (buildReservationWorker) drives a structured flow: party size, then time, then an availability check, then confirmation. When it is done, or if the user changes their mind, it hands control back to the router.

Only one worker is active at a time. Hand-offs are seamless: the user never hears that they've been transferred.

The reservation worker is built as a plain pipeline worker, the same way the sensor-controller example builds its worker. A FlowManager is wired onto the worker and the flow is (re)initialized from the worker's on_activated event handler each time control is handed to it. The shared aggregators are owned by the main worker, so every worker speaks into the same conversation history.

LLM_PROVIDER picks the LLM: openai_responses (the default), openai, anthropic, google or aws, each with its own key (see the utils package).

CARTESIA_API_KEY=… DEEPGRAM_API_KEY=… OPENAI_API_KEY=… \
  go run ./examples/flows/multi_worker_handoff

Then open http://localhost:7860 and connect.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL