registry

Worker registry for tracking known workers across runners.

class pipecat.registry.WorkerRegistry(runner_name: str)[source]

Bases: object

Tracks all known workers across local and remote runners.

Owned by a runner and shared with its workers. Organizes workers into local (this runner) and remote (other runners) so they are easy to distinguish. Deduplication is built in: each worker name is registered at most once.

Notifications use a targeted watch mechanism: call watch(worker_name, handler) to be notified when a specific worker registers.

__init__(runner_name: str)[source]

Initialize the WorkerRegistry.

Parameters:

runner_name – Name of the runner that owns this registry.

property runner_name: str

The name of the runner that owns this registry.

property local_workers: list[str]

Names of workers registered under this runner.

property remote_workers: list[str]

Names of workers registered under remote runners.

get(worker_name: str) WorkerReadyData | None[source]

Look up a registered worker by name.

Parameters:

worker_name – The worker name to look up.

Returns:

The worker’s WorkerReadyData, or None if not found.

async watch(worker_name: str, handler: Callable[[WorkerReadyData], Coroutine]) None[source]

Watch for a specific worker’s registration.

Idempotent: registering the same (worker_name, handler) pair more than once is a no-op (otherwise the handler would fire multiple times when the worker registers — e.g. when a parent both calls add_workers(child) (which auto-watches) and declares a @worker_ready(name=child.name) handler that the framework also installs).

If the worker is already registered, the handler fires immediately.

Parameters:
  • worker_name – The worker name to watch for.

  • handler – Async callable invoked with the worker’s data.

async register(worker_data: WorkerReadyData) bool[source]

Register a worker. Returns True if the worker was new.

If the worker is already registered, this is a no-op and returns False. Otherwise the worker is added and watchers are notified.

Parameters:

worker_data – Information about the worker to register.

Returns:

True if the worker was newly registered, False if already known.

Submodules