When a request may need different specialists, a coordinator can consume each specialist as a tool. The LLM chooses which to call, receives the result, and remains responsible for the response. Use this pattern when the coordinator must combine expert results rather than follow a fixed pipeline or hand over the conversation. section 9.4 section 9.2
An agent tool has the same outward shape as an ordinary tool: a name, description, parameters, and returned result. AgentTool adapts a specialist agent to the BaseTool interface, so the coordinator can list it alongside tools such as web search or a calculator. section 9.4.1 section 9.4.2
The adapter handles the boundary between coordinator and specialist:
- Expose a default string parameter named request, or derive structured parameters from a Pydantic input_schema. section 9.4.2
- Validate structured input when supplied, convert it to a string, and run the child agent with that string; otherwise, pass request directly. section 9.4.2
- Return the child’s result without passing the parent’s execution context into the child. section 9.4.2
Research and code on demand
For a request to research AI agent frameworks and write a Python script comparing their GitHub stars, give one specialist web search and another code execution. Register both with the coordinator as tools: orchestrator = Agent( model=llm, name="coordinator", instructions="Delegate research and coding; combine their results.", tools=[AgentTool(researcher), AgentTool(coder)], ) The coordinator can call the researcher, the coder, or both as the request requires, then synthesize their results. section 9.4.4 section 9.4
Figure 9.8 Agent as Tool: the child agent runs in an isolated environment and returns only the final result.
The context diagram shows the boundary: the specialist works in isolation, and only its final result returns to the coordinator. section 9.4.3
Isolation keeps intermediate tool calls and reasoning out of the coordinator’s context, but child activity needs separate inspection when debugging. If later agents need intermediate state, use a workflow instead. Unlike transfer, a tool call does not give the specialist control of follow-up conversation. section 9.4.3 section 9.5.1
