Curriculum › Tool Design & MCP Integration · 18% of the exam

Tool distribution and tool_choice

What you’ll be able to do

  • Restrict each subagent’s tools to those its role needs, so it can’t misuse tools from another specialization
  • Replace generic tools with constrained alternatives, and add scoped cross-role tools for high-frequency needs while complex cases go through the coordinator
  • Choose between tool_choice “auto”, “any”, and forced selection for a given step
  • Force a specific first tool with tool_choice, then handle later steps in follow-up turns

What you need to know

More tools make selection worse

Every tool you add is another option the model has to rule out on every step. An agent with 18 tools chooses less reliably than one with the 4 or 5 its job actually needs, even if every description is well written, because the decision is harder and there are more near-misses to confuse. Tool count is a design choice, not a free resource.

Extra tools also invite misuse. An agent tends to use the tools it has. A synthesis agent that can run web searches will sometimes go searching instead of working with the findings it was given, which duplicates the search agent's work, adds latency, and blurs which agent is responsible for what. The fix is not a prompt line saying "don't search". It is not giving the synthesis agent a search tool in the first place.

Scope tools to the role

In a coordinator-subagent system, decide each subagent's tools from its role. In the Agent SDK you set this through each agent's allowed tools (allowedTools configuration, covered with subagent setup in 1.3):

  • Search agent: web search, document fetch.
  • Document analysis agent: load and extract from documents.
  • Synthesis agent: no retrieval tools by default. It works from what the coordinator passes in.
  • Coordinator: the tools for delegating to subagents, plus anything only it should do.

Scoping also means narrowing what a tool can do. A generic fetch_url on a document analysis agent can fetch anything, so the agent will sometimes pull in pages that aren't documents at all. Replace it with a constrained tool such as load_document, which checks that the URL points to an allowed document before loading it. The role stays the same, and the opportunity for misuse is gone.

Narrow cross-role tools for frequent needs

Strict scoping has a cost when one role regularly needs a small piece of another role's capability. If the synthesis agent often needs to check a single date or figure, sending every check through the coordinator to the search agent and back adds round trips to every task.

The answer is a scoped cross-role tool, not the whole other toolset. Give the synthesis agent a narrow verify_fact tool for simple lookups, and keep routing anything complex (open-ended research, conflicting sources) through the coordinator. The frequent, simple case gets faster, and the complex case keeps the oversight and specialization it needs. Giving synthesis every search tool would bring back the misuse problem above.

tool_choice: auto, any, or a specific tool

The tool_choice parameter controls whether, and which, tool the model must call in a request:

the three options
tool_choice = {"type": "auto"} # default: the model may call a tool or answer in text

tool_choice = {“type”: “any”}

the model must call a tool, but chooses which one

tool_choice = {“type”: “tool”, “name”: “extract_metadata”}

the model must call exactly this tool

  • "auto" fits normal agentic steps where answering in text can be the right move.
  • "any" fits steps where text is never acceptable, for example a pipeline stage that must produce a structured tool call but could use one of several tools. It guarantees a tool call instead of a conversational reply.
  • Forced selection fits a step that must happen first. If enrichment tools depend on metadata, force extract_metadata on the first request. Then append its result and continue in follow-up turns (typically back on "auto") so the model can choose the enrichment tools from there. Forcing affects one request. It doesn't run the later steps for you.

Prompt instructions such as "ALWAYS call extract_metadata first" usually work, but not always. When the order or the presence of a tool call actually matters, tool_choice enforces it.

Key concept

Give each agent the few tools its role needs, constrain generic tools, and add only narrow cross-role tools for frequent simple needs. Use tool_choice “any” to guarantee a tool call, and forced selection to guarantee which tool runs first.

When a scenario shows an agent using a tool outside its job, or picking poorly from a long tool list, the fix the exam is looking for is usually removing tools, not adding instructions.

Practice scenario

ScenarioIn a research system, every subagent was given the same 18 tools to "keep things flexible." The synthesis agent now runs its own web searches in about a third of tasks, and the document analysis agent occasionally uses fetch_url to load search result pages instead of the source papers. A separate metadata stage sometimes returns a chatty summary instead of calling any tool.
Work it through, then open this

Scope the tools to the roles. The synthesis agent loses web search, and if it often needs simple fact checks, it gets a narrow verify_fact tool while complex verification still goes through the coordinator. The document analysis agent’s fetch_url becomes a load_document tool that only accepts document URLs. Each agent ends up with a handful of tools, which also improves selection reliability. For the metadata stage, set tool_choice to "any" (or force the specific extraction tool) so it can’t return conversational text.

Build exercise — Redistribute an over-provisioned tool set

Intermediate · 30 min

What you’ll learn

  • Mapping tools to agent roles
  • Replacing a generic tool with a constrained one
  • Choosing tool_choice per step
  1. List every tool each agent in a multi-agent design currently has, then mark which ones the agent’s role actually needs.

    • Why: Unneeded tools reduce selection reliability and invite cross-role misuse.
    • You should see: Most agents dropping to four or five tools, and one or two tools that clearly belong to a different role.
  2. Find one generic tool (URL fetch, raw query, shell command) and design a constrained replacement that validates its inputs for the role. Then pick one frequent cross-role need and design a narrow tool for it.

    • Why: Constrained tools remove misuse. Narrow cross-role tools remove round trips without handing over a whole toolset.
    • You should see: A tool whose description and validation only allow the intended inputs, and a cross-role tool that handles the simple case while complex cases still go to the coordinator.
  3. For each pipeline step, choose "auto", "any", or a forced tool, and write one sentence explaining why. For a forced first step, sketch the follow-up turn that continues the work.

    • Why: tool_choice is the way to guarantee a tool call or a specific first tool. Prompt wording only encourages it.
    • You should see: Forced selection only where order matters, "any" where text output would break the pipeline, and "auto" everywhere else.

Exam traps

Giving every agent the full tool set “just in case”

Selection gets less reliable as the tool list grows. Agents should have only what their role needs.

Leaving a specialist with tools outside its role, such as web search on a synthesis agent

Agents use the tools they have. Remove the tool instead of writing a prompt rule against using it.

Exposing a generic tool like fetch_url where a constrained, validating tool would do

A constrained tool such as load_document lets the agent do its job and rules out misuse.

Giving one role all of another role’s tools to remove a frequent round trip

Add a narrow cross-role tool for the frequent simple case, and keep complex cases going through the coordinator.

Relying on prompt wording to make the model call a required first tool instead of forcing it with tool_choice

Forced selection guarantees which tool runs first. Instructions only make it likely.

Leaving tool_choice on “auto” when the step must produce a tool call, not conversational text

"auto" allows a text reply. "any" guarantees that some tool is called.

Sources

Quick check

Select TWO.

A classification step offers the model three tools and must always produce one of them as a structured tool call. Sometimes it replies with conversational text instead. Which two statements about tool_choice are accurate for this step? Select two.