What is the agent registry?
TheAgentRegistry tracks all known agents across local and remote runners. It is owned by the runner and shared with all its agents. When an agent becomes ready, it registers itself, and other agents that are watching for it get notified.
You don’t interact with the registry directly in most cases. Instead, you use the @agent_ready decorator or watch_agent() to express interest in a specific agent, and the registry handles the rest.
Watching for agents
The @agent_ready decorator
The most common way to watch for an agent. Decorate a method with the agent name, and it fires when that agent registers:watch_agent() for each @agent_ready handler when the agent starts. If the watched agent is already registered, the handler fires immediately.
watch_agent()
For dynamic cases where you don’t know the agent name at class definition time, callwatch_agent() directly:
How discovery works
Local agents
When all agents run in the same process, discovery is straightforward. An agent registers in the shared registry when its pipeline is ready, and watchers are notified immediately.Distributed agents
In distributed setups (agents across different processes connected to the same bus), runners exchange registry snapshots automatically. When a remote agent becomes ready, its runner broadcasts a registry message over the bus. Other runners update their local registry, and any matching watchers fire.Only root agents (added via
runner.add_agent()) are discoverable across runners. Child agents (added via parent.add_agent()) are not broadcast and remain invisible to other runners.Proxy agents
With proxy agents (agents on different buses), the proxy relays registry messages between the two buses. When the remote agent registers, the proxy notifies the local side. From the local agent’s perspective,@agent_ready and watch_agent() work exactly the same as in local or distributed setups.
Agent readiness data
When a watcher fires, it receives anAgentReadyData object: