AgentTool lets one agent delegate tasks to another. An orchestrator agent calls specialized sub-agents as tools—each with its own environment, model, and evaluation.
Why Sub-Agents?
Complex tasks often break into specialized subtasks:- Orchestrator decides what to do
- Researcher gathers information
- Coder writes code
- Reviewer checks work
AgentTool
Wraps a Task template so it can be called as a tool.research(issue_id="SEC-123") and a full sub-agent runs.
Parameters
model= for standard agents or agent= for custom agent classes.
Eval-Only Parameters
Parameters with| None = None are hidden from the tool schema but available for evaluation:
investigate(issue_id="SEC-123"). The eval harness can pass expected_cause for automated scoring.
Orchestrator Setup
Separate Environments
Each specialist has its own environment with isolated tools:Shared Environment (Same Tools)
When specialists need access to the same tools (e.g. APIs, data sources), define everything on one environment. The orchestrator scenario delegates to specialist scenarios viaAgentTool:
Tracing
Enabletrace=True to record sub-agent execution:
When to Use
Good for:- Complex workflows with distinct phases
- Mixing models (fast for orchestration, powerful for coding)
- Isolating tool access (researcher can’t edit files)
- Reusable specialist agents
- Simple linear tasks
- Latency-sensitive applications (sub-agent overhead)
- Single-model workflows