Skip to main content
Agent as Tool turns any agent into a callable tool so a parent agent can invoke specialists and keep control of the result.
The user asks for a polished article; the writer agent invokes the researcher as a tool and composes the answer.

Quick Start

1

Simple Usage

2

With Configuration

Pass custom tool_name and description to as_tool() when the default labels are not clear enough for the parent LLM.

How It Works

as_tool() vs Handoffs

Key Difference: With as_tool(), the parent agent retains control and receives results. With handoffs, control transfers entirely to the target agent.

API Reference

Agent.as_tool()

str
Tool description for the LLM. Describes what this agent does. Default: "Invoke {agent_name} to complete a subtask and return the result"
str
Custom tool name. Default: invoke_{agent_name} (snake_case)
Handoff
A Handoff configured with ContextPolicy.NONE (no history passed to child).

Examples

Best Practices

Provide clear tool descriptions so the LLM knows when to invoke each specialist.
Each specialist agent should have one clear purpose.
Keep hierarchies shallow (2-3 levels max) for clarity.
Test each specialist agent independently before composing.

Handoffs

Transfer control between agents

Multi-Agent Workflows

Coordinate multiple agents

Toolsets

Create custom tools