agents.supervisor.utils.registry¶
Agent Registry for Haive Supervisor System.
Manages agent lifecycle and routing model synchronization using DynamicChoiceModel. Provides runtime agent registration/deregistration with automatic routing updates.
Classes¶
Manages agent lifecycle and routing model synchronization. |
Module Contents¶
- class agents.supervisor.utils.registry.AgentRegistry(routing_model)¶
Manages agent lifecycle and routing model synchronization.
This class provides a centralized registry for managing agents in a supervisor system, with automatic synchronization to a DynamicChoiceModel for routing.
- Features:
Runtime agent registration/deregistration
Automatic routing model updates
Agent capability tracking
Conflict detection and resolution
Rich visualization of registry state
Initialize agent registry.
- Parameters:
routing_model (haive.core.common.models.dynamic_choice_model.DynamicChoiceModel[str]) – DynamicChoiceModel to synchronize with agent changes
- clear_all()¶
Remove all registered agents.
Warning: This will clear the entire registry!
- Return type:
None
- get_agent(name)¶
Get agent by name.
- Parameters:
name (str) – Agent name
- Returns:
Agent instance or None if not found
- Return type:
haive.agents.base.agent.Agent | None
- get_agent_capabilities()¶
Get mapping of agent names to their capabilities.
- get_agent_capability(agent_name)¶
Get capability description for specific agent.
- get_agent_count()¶
Get number of registered agents.
- Returns:
Number of currently registered agents
- Return type:
- get_available_agents()¶
Get list of currently available agent names.
- get_registry_stats()¶
Get registry statistics.
- get_routing_options()¶
Get all routing options including END.
- is_agent_registered(agent_name)¶
Check if agent is registered.
- mark_rebuilt()¶
Mark that supervisor graph has been rebuilt.
- Return type:
None
- needs_rebuild()¶
Check if supervisor graph needs rebuilding.
- Returns:
True if agents have been added/removed since last check
- Return type:
- print_registry_state()¶
Print comprehensive registry state information.
- Return type:
None
- register(agent, capability_description=None)¶
Register an agent and update routing model.
- Parameters:
agent (haive.agents.base.agent.Agent) – Agent instance to register
capability_description (str | None) – Optional description of agent capabilities
- Returns:
True if registration successful, False if agent name conflict
- Return type:
- Raises:
ValueError – If agent has no name or invalid configuration
- unregister(agent_name)¶
Remove an agent and update routing model.