Interface AgentsRegistry

All Known Implementing Classes:
AgentsRegistry.CompositeAgentsRegistry, AgentsRegistry.EmptyAgentsRegistry

public interface AgentsRegistry
SPI for discovering and providing AgentInstances by name.

Implementations are loaded via ServiceLoader. Multiple providers are supported and automatically merged; duplicate agent names across providers cause an exception at discovery time. If no provider is found, an empty registry that throws on every lookup is returned.

Registry-provided agents can be mixed with locally defined agents in any agentic pattern (sequence, supervisor, planner, etc.).

  • Method Details

    • allAgents

      Map<String, AgentInstance> allAgents()
      Returns all agents registered in this registry, keyed by agent name.
      Returns:
      an unmodifiable map of agent names to AgentInstances
    • getAgent

      AgentInstance getAgent(String name)
      Returns the agent registered with the given name.
      Parameters:
      name - the agent name
      Returns:
      the matching AgentInstance
      Throws:
      RuntimeException - if no agent with the given name is found
    • get

      static AgentsRegistry get()
      Returns the AgentsRegistry discovered via ServiceLoader. The result is lazily initialized on first access and cached for subsequent calls. Call refresh() to force re-discovery.
      Returns:
      the loaded registry, or an empty registry if no provider is available
    • refresh

      static void refresh()
      Forces re-discovery of the AgentsRegistry via ServiceLoader. Subsequent calls to get() will return the newly discovered registry.