Give each subagent only its tools
Pick the tool set for each subagent by role, with only scoped cross-role tools, and set tool_choice to auto, any or a forced tool for the behaviour a step needs.
Scenario
Your Multi-Agent Research System has a coordinator and four subagents: web search, document analysis, synthesis and report generation. To keep setup simple, every subagent got the same 21 tools.
A week of traces shows three patterns:
- The synthesis subagent calls
search_news"to check the latest" in the middle of merging findings, and new, unvetted sources appear in the draft. - The report subagent calls
fetch_urlon links inside the draft, sometimes internal admin URLs. - The document analysis subagent sometimes answers in prose instead of calling
extract_citation_metadata, and the pipeline stalls waiting for structured data.
Nothing is broken in any one tool. Before reading on, work out why.
Explanation
Tools by role. Each tool in an agent's list is one more option it weighs on every turn. The exam guide's example is 18 tools instead of 4 to 5: more choices, less reliable selection. The tool search docs place clear degradation higher, past 30 to 50 tools, but overlapping and off-role tools cause misrouting long before that, so scope by role whatever the count. Worse, a tool outside an agent's specialty invites misuse: the synthesis agent searching, the report agent fetching. The fix is scoping:
- Give each subagent only the tools its role needs. In the Agent SDK, an
AgentDefinition'stoolsarray is exactly that list; omit it and the subagent inherits every available tool. - Replace generic tools with constrained ones. Instead of
fetch_url, which can reach any address, giveload_document, which accepts only document URLs from approved sources and validates them. - Add a scoped cross-role tool only for a frequent, simple need. The synthesis agent checks facts constantly, so a narrow
verify_factsaves a round trip. Anything bigger (a new line of research) goes back through the coordinator.
agents = {
"synthesizer": AgentDefinition(
description="Merges findings into a cited draft.",
prompt=SYNTH_PROMPT,
tools=["mcp__research__verify_fact"],
),
}
tool_choice controls whether a request must call a tool:
| Setting | Effect |
|---|---|
{"type": "auto"} |
Claude decides: a tool or a text answer (default with tools) |
{"type": "any"} |
Claude must call one of the tools, its choice which |
{"type": "tool", "name": "..."} |
Claude must call that tool |
{"type": "none"} |
no tool calls |
Force a tool to make a step happen first (extract metadata before enrichment), then switch back to auto for the follow-up turns. Use any when the step must end in a tool call but more than one tool is valid. With any or a forced tool, Claude writes no text before the tool call.
One caveat: not every model and setting supports forced tool use. Manual extended thinking doesn't, and Claude Opus 5.5, Sonnet 5.5, Fable 5.1 and Mythos 5.1 return a 400 error for any and tool, so on today's default models code like the two requests below fails (Opus 5 and Haiku 5.5, for example, still accept it). Check the docs for your model; where it is unsupported, use auto with strict tool use or structured outputs. The exam guide treats any and forced selection as available, so answer exam items that way.