2.3 Distribute tools appropriately across agents and configure tool choice
Give each agent only the tools its role needs, add narrowly scoped cross-role tools for frequent needs, and use tool_choice to guarantee that a tool (or a specific tool) is called.
Key points
- 1
Too many tools degrade selection: an agent with 18 tools makes more mistakes than one with 4-5. Decision complexity, not model capacity, is the problem, so "use a bigger model" is a non-answer.
- 2
Agents holding tools outside their specialisation tend to misuse them (a synthesis agent running web searches). Remove the tool rather than instructing the agent not to use it; a prompt rule is probabilistic, a missing tool is deterministic.
- 3
Scoped tool access: restrict each subagent's tool set to its role. Replace generic tools with constrained alternatives, e.g.
fetch_urlbecomesload_documentthat validates the URL is an assigned document source. - 4
Scoped cross-role tools: when one agent needs another role's capability frequently (85% simple fact checks, 85% symbol lookups), give it a narrow read-only tool for that case (
verify_fact,find_symbol_definition) and keep routing complex cases through the coordinator. Do not hand over the other agent's full tool set, batch lookups to the end, or speculatively pre-load data. - 5
tool_choiceoptions:auto(default with tools; model may answer with text or call a tool),any(must call one of the provided tools, model chooses which),toolwith aname(must call that specific tool), andnone(no tool calls). - 6
Use
anywhen several tools are valid outcomes but a text-only reply is not (e.g.record_invoiceorflag_unreadable). Usetoolto force a prerequisite such asextract_metadataon the first request, then send follow-up turns withautoso enrichment tools can run; leaving the forced choice on every turn loops on the same tool. - 7
When
tool_choiceisanyortool, the API prefills the assistant message, so the model emits no natural-language text before thetool_useblock even if asked. To capture a rationale while keeping the guarantee, add arationalefield to the tool's input schema; switching toautoloses the guarantee. - 8
Combine forced tool use with
strict: trueon the tool definition when inputs must match the schema exactly. Note: current docs say some newer models rejectany/toolwith a 400 and recommendautoplus strict tools or structured outputs; the exam tests the guide's framing, so answer in terms of the option semantics above. - 9
Changing
tool_choicebetween requests invalidates cached message blocks under prompt caching; tool definitions and the system prompt stay cached. - 10
In the Agent SDK, restrict tools per agent with
allowedTools/disallowedToolsand per-subagenttoolslists; MCP tools are namedmcp__<server>__<tool>andmcp__<server>__*allows a whole server.
Read the source
Test yourself on 2.3 Distribute tools appropriately across agents and configure tool choice
Ten questions, with the answer and explanation after each one.