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.).
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classstatic classstatic class -
Method Summary
Modifier and TypeMethodDescriptionReturns all agents registered in this registry, keyed by agent name.static AgentsRegistryget()Returns theAgentsRegistrydiscovered viaServiceLoader.Returns the agent registered with the given name.static voidrefresh()Forces re-discovery of theAgentsRegistryviaServiceLoader.
-
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
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
Returns theAgentsRegistrydiscovered viaServiceLoader. The result is lazily initialized on first access and cached for subsequent calls. Callrefresh()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 theAgentsRegistryviaServiceLoader. Subsequent calls toget()will return the newly discovered registry.
-