Expand description
§Agent-as-Tool
Compose agents as tools, allowing agents to invoke other agents.
Inspired by AutoGen’s agent composition pattern.
§Features
- Agent Wrapping: Wrap any agent as a callable tool
- Typed I/O: Strong typing for agent input/output
- Delegation: Hierarchical agent organization
- Context Passing: Share context between agents
§Example
ⓘ
use cortex::agent_tool::{AgentTool, AgentToolBuilder};
// Create a specialized agent
let math_agent = AgentTool::builder("math_expert")
.description("Expert at solving mathematical problems")
.handler(|input| async {
// Process math query
Ok(format!("Result: {}", solve_math(&input)))
})
.build();
// Use it as a tool in another agent
let main_agent = Agent::new()
.add_tool(math_agent.as_tool());Structs§
- Agent
Tool - An agent wrapped as a tool
- Agent
Tool Builder - Builder for AgentTool
- Agent
Tool Config - Configuration for an agent tool
- Agent
Tool Input - Input to an agent tool
- Agent
Tool Output - Output from an agent tool
- Agent
Tool Registry - A registry for agent tools
- Agent
Tool Stats - Statistics for an agent tool
- Delegation
Chain - Helper to create a delegation chain
Enums§
- Agent
Tool Error - Error from agent tool execution
- Delegation
Strategy
Traits§
- Agent
Tool Handler - Trait for agent tool handlers
Type Aliases§
- Boxed
Handler - Type alias for boxed handler