R6 class for managing a collection of Agent objects. Provides storage, lookup, and automatic delegation tool generation for multi-agent systems.
new()Initialize a new AgentRegistry.
AgentRegistry$new(agents = NULL)agentsOptional list of Agent objects to register immediately.
register()Register an agent.
AgentRegistry$register(agent)agentAn Agent object to register.
Invisible self for chaining.
nameThe agent name.
The Agent object, or NULL if not found.
has()Check if an agent is registered.
AgentRegistry$has(name)nameThe agent name.
TRUE if registered, FALSE otherwise.
list_agents()List all registered agent names.
AgentRegistry$list_agents()Character vector of agent names.
get_all()Get all registered agents.
AgentRegistry$get_all()List of Agent objects.
unregister()Unregister an agent.
AgentRegistry$unregister(name)nameThe agent name to remove.
Invisible self for chaining.
generate_delegate_tools()Generate delegation tools for all registered agents.
AgentRegistry$generate_delegate_tools(
flow = NULL,
session = NULL,
model = NULL
)flowOptional Flow object for context-aware execution.
sessionOptional ChatSession for shared state.
modelOptional model ID for agent execution.
Creates a list of Tool objects that wrap each agent's run() method. These tools can be given to a Manager agent for semantic routing.
A list of Tool objects.
generate_prompt_section()Generate a prompt section describing available agents.
AgentRegistry$generate_prompt_section()Creates a formatted string listing all agents and their descriptions. Useful for injecting into a Manager's system prompt.
A character string.
clone()The objects of this class are cloneable with this method.
AgentRegistry$clone(deep = FALSE)deepWhether to make a deep clone.