registry
registry
¶
Agent card registry — tracks running agents for A2A discovery.
When a score starts, the conductor registers its agent card here. Other agents can query the registry to discover who's running and what skills they offer. The registry is the A2A discovery mechanism.
Lifecycle:
- register(job_id, card) — called on job start
- deregister(job_id) — called on job completion/cancellation
- query() / query_by_skill() — called by agents during execution
- get_job_id_for_agent(name) — resolve agent name to job_id for routing
The registry is in-memory only — it reflects the current state of running jobs. On conductor restart, cards are re-registered as jobs resume.
Classes¶
AgentCardRegistry
¶
In-memory registry of agent cards for running jobs.
Thread-safe for single-threaded asyncio use (no locking needed). The baton's event loop is the sole writer; query methods are read-only.
Usage::
registry = AgentCardRegistry()
# On job start
card = AgentCard(name="canyon", description="...", skills=[...])
registry.register("job-123", card)
# Discovery
agents = registry.query() # all running agents
architects = registry.query_by_skill("architecture-review")
# On job end
registry.deregister("job-123")
Source code in src/marianne/daemon/a2a/registry.py
Attributes¶
Functions¶
register
¶
Register an agent card for a running job.
If the job_id is already registered, the card is replaced. If an agent with the same name is registered under a different job, the old registration is removed (agent name must be unique).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
job_id
|
str
|
The job this agent card belongs to. |
required |
card
|
AgentCard
|
The agent's identity card. |
required |
Source code in src/marianne/daemon/a2a/registry.py
deregister
¶
Remove an agent card when a job completes or is cancelled.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
job_id
|
str
|
The job to deregister. |
required |
Returns:
| Type | Description |
|---|---|
AgentCard | None
|
The removed card, or None if the job wasn't registered. |
Source code in src/marianne/daemon/a2a/registry.py
get
¶
Get the agent card for a specific job.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
job_id
|
str
|
The job to look up. |
required |
Returns:
| Type | Description |
|---|---|
AgentCard | None
|
The agent card, or None if not registered. |
Source code in src/marianne/daemon/a2a/registry.py
get_job_id_for_agent
¶
Resolve an agent name to its job_id.
Used by the conductor to route A2A tasks — when an agent sends a task to "canyon", this resolves to canyon's job_id so the task can be persisted in the correct inbox.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
agent_name
|
str
|
The target agent's name. |
required |
Returns:
| Type | Description |
|---|---|
str | None
|
The job_id, or None if the agent isn't running. |
Source code in src/marianne/daemon/a2a/registry.py
query
¶
List all registered agent cards.
Returns:
| Type | Description |
|---|---|
list[AgentCard]
|
List of all currently registered cards (snapshot). |
query_by_skill
¶
Find agents that offer a specific skill.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
skill_id
|
str
|
The skill identifier to search for. |
required |
Returns:
| Type | Description |
|---|---|
list[AgentCard]
|
List of agent cards that declare the given skill. |
Source code in src/marianne/daemon/a2a/registry.py
clear
¶
Remove all registrations. Used on conductor shutdown.