Overview
Distributed agents are agents connected to the same bus but running in different processes or on different machines. By default, all agents run in a single process using a local bus. For distributed setups, swap to a network bus — all agents share the same channel and discover each other automatically. Your agent code stays the same.Distributed agents share a bus. If you need to connect agents on different
buses (separate networks, third-party services), see Proxy
Agents instead.
Setting up a distributed bus
Pipecat provides two distributed bus implementations: RedisBus and PgmqBus. Choose based on your infrastructure.RedisBus
Each process creates its ownWorkerRunner with a RedisBus connected to the same Redis channel:
channel can exchange messages. Agents discover each other automatically through registry snapshots.
Install the Redis extra:
uv add "pipecat-ai[redis]"PgmqBus
Alternatively, usePgmqBus backed by PostgreSQL Message Queue:
Install the PGMQ extra:
uv add "pipecat-ai[pgmq]"Example: distributed handoff
This example splits the two-agent handoff across separate processes. The main agent handles transport on one machine, and LLM agents run independently on other machines.Process 1: Main transport agent
The main agent owns the transport and bridges frames to the bus. It has no LLM — it waits for the remote greeter agent to register, then activates it.Process 2 & 3: LLM agents
Each LLM agent runs as a standalone process. It connects to the same Redis channel and waits for activation. SubclassLLMWorker to host @tool methods and pass the LLM service in the constructor:
@worker_ready decorator on a worker subclass to react automatically when a specific agent registers.
How discovery works
Runners exchange registry information automatically over the shared bus. To get notified when an agent is ready, watch it withrunner.registry.watch(...), call watch_workers() from inside a worker, or use the @worker_ready decorator — they all work the same way locally and distributed.
Considerations
- Latency: Network buses add overhead. For latency-sensitive voice applications, keep the main transport agent and its active LLM agent geographically close to each other and the bus server (Redis or PostgreSQL).
- Serialization: Both
RedisBusandPgmqBusserialize messages to JSON. Custom frame types need to be registered with the serializer. - Single channel: All agents on the same channel see all messages. Use different channels for different sessions or applications.
What’s next
Distributed agents share one bus. When you need to connect agents across separate buses or networks, bridge them with a proxy.Proxy Agents
Bridge agents on different buses point-to-point over WebSocket