Skip to main content

Module delegation

Module delegation 

Source
Expand description

Agent-to-agent delegation tools

Allows agents to delegate tasks to other specialized agents, enabling hierarchical agent architectures and supervisor/worker patterns.

§Example

use cortexai_tools::delegation::*;

// Create agent registry
let registry = AgentRegistry::new(engine.clone());

// Register agents with descriptions
registry.register_agent(
    researcher_id,
    "Research Agent",
    "Specialized in web research and gathering information",
);

registry.register_agent(
    writer_id,
    "Writer Agent",
    "Specialized in writing clear, concise content",
);

// Create delegation tool for supervisor
let delegate_tool = DelegateAgentTool::new(registry);
supervisor_tools.register(Arc::new(delegate_tool));

Structs§

AgentInfo
Information about a registered agent available for delegation
AgentRegistry
Registry of agents available for delegation
DelegateAgentTool
Tool for delegating tasks to other agents
ListAgentsTool
Tool for listing available agents

Type Aliases§

MessageSender
Callback type for sending messages to agents
ResponseWaiter
Callback type for waiting for agent response