Tool choice for agents: when to force a tool call, when to forbid one, and when to leave it alone
Claude, OpenAI and Gemini all let you force, restrict or block tool calls, but the option names, the thinking trade-offs and the caching side effects differ. Here's how tool_choice actually behaves on each and where it fits in an agent loop.
Some links are affiliate links; we may earn a commission at no extra cost to you. As an Amazon Associate I earn from qualifying purchases. Disclosure
Most agent loops never touch tool_choice. You hand the model a list of tools, leave it on the default, and let it decide. That works fine right up until you need one specific step to happen every time: an extraction step that has to come back as a tool call, a final turn where the model should just talk, or a checkout flow where only two tools make sense. That's what tool_choice is for, and it's also an easy way to break things if you use it in the wrong spot.
All three big APIs have some version of the same four ideas. Let the model decide. Make it call something. Make it call one specific thing. Don't let it call anything. Where they differ is the names, how they handle a subset of tools, and what forcing does to thinking and to your cache. Those last two are the ones that bite.
The four modes, side by side
On Claude, Anthropic's tool use implementation guide lists four values. auto lets Claude decide whether to call any of the tools, and it's the default when you pass tools. any says Claude has to use one of the tools but doesn't pick which. tool with a name forces that exact tool. none blocks tools entirely and is the default when you don't pass any.
OpenAI's function calling guide has the same shape with different words. "auto" is the default and allows zero, one or several calls. "required" means one or more calls. A forced function looks like {"type": "function", "name": "get_weather"} and calls exactly that one. "none" imitates the behavior of passing no functions at all.
Gemini's function calling docs put the setting inside generation_config on the Interactions API, with auto, any and none meaning what you'd guess, plus a fourth mode, validated, which the docs describe as the model making sure it sticks to the function schema. There's no separate "force this one function" value on Gemini. You get there by pairing any with an allowed list that holds a single tool, which I'll come back to.
So a port from one provider to another is mostly renaming. OpenAI's required is Claude's and Gemini's any. OpenAI's forced function is Claude's tool. The trouble isn't the mapping. It's the side effects.
Forcing a tool skips the part where the model talks
When Claude's tool_choice is any or tool, Anthropic says the API makes the response start with a tool call. Claude won't write any explanation before the tool_use block, even if you ask it to. For a background extraction step that's what you want. For a chat agent where the user expects a line like "Let me check the weather for you," it's a quiet regression nobody notices until someone asks why the bot got so curt.
The bigger catch is thinking. The same page says forcing a tool skips thinking on every Claude model that accepts forced tool use, so the response opens with the tool_use block and has no thinking block. If you switched on manual extended thinking with thinking: {type: "enabled"}, any and tool aren't supported at all and return an error. And on some newer models, which the docs list as Claude Fable 5.2, Claude Mythos 5.2, Claude Opus 5.5, Claude Sonnet 5.5, Claude Fable 5.1 and Claude Mythos 5.1, any and tool return a 400 no matter what your thinking settings are. On those models auto and none still work.
Anthropic's suggested way out is the same in both cases. Leave tool_choice on auto and say what you want in the user message, for example "What's the weather like in London? Use the get_weather tool in your response." The model gets to think and to say something first, and in practice it does what you asked. If what you really need is schema-valid input, the docs point you at strict tool use with auto, or at structured outputs when you want a fixed JSON shape back rather than a tool call. (We covered that second route in structured outputs for agents.)
On models where forcing does work, Anthropic says you can pair tool_choice: {"type": "any"} with strict: true on your tool definitions to guarantee both that one of your tools gets called and that the input matches your schema. That's a solid combo for a pipeline step where a person never reads the output.
Here's my rule of thumb. Force a tool when the step is mechanical and the reasoning already happened earlier in the loop. Don't force one on the step where the model is supposed to figure out what to do.
Restricting to a subset without breaking your cache
This is where the providers really split, and it's the part most worth getting right in a long-running agent.
Say your agent has twenty tools, and during the "confirm order" step only get_cart and place_order should be callable. The obvious fix is to send only those two tools on that request. It works, but you've just changed the tool list, and the tool list sits near the front of the prompt. That's a cache miss on everything after it.
OpenAI built a mode for exactly this. You keep passing the full tool list and set tool_choice to {"type": "allowed_tools", "mode": "auto", "tools": [...]} with the subset you want. The function calling guide says the reason in plain terms: it lets you make only a subset of tools available across requests without modifying the list you pass, "so you can maximize savings from prompt caching." The same guide notes that when you use tool search, tool_choice still applies to whatever tools are callable on that turn, which is handy right after you load a batch of deferred tools and want to keep the model inside that batch. (More on deferred loading in tool search and deferred loading.)
Gemini does something similar. Its docs show tool_choice with an allowed_tools object that has a mode and a list of tool names, for example mode: "any" with tools: ["get_current_temperature"]. That's also how you force a single function on Gemini: any plus a list of one.
Claude doesn't have an allowed-subset option in tool_choice. You can force one tool by name, but you can't say "only these three" without changing the tools array. Anthropic's docs also warn that with prompt caching, changing tool_choice itself invalidates cached message blocks. Tool definitions and the system prompt stay cached, but the message content gets reprocessed. Flipping tool_choice from auto to tool and back every other turn in a long conversation means paying to reprocess the whole message history each time you flip. If you want the cache math behind that, see prompt caching for agent loops.
The practical version for Claude: decide your tool policy per phase, not per turn. Keep auto across the conversation and handle "this tool isn't allowed right now" in your own code. If the model calls place_order before the user confirmed, don't run it. Send back a tool result saying the order can't be placed until the user confirms, and let the model take it from there. That keeps the cache warm and gives the model a reason it can act on, which is the same idea as writing tool errors the model can recover from.
Where each mode earns its place in a loop
Here's how it plays out in a typical agent with a planning step, some work steps and a final answer.
The first turn, where the model reads the request and decides what to do, should almost always be auto. You want it to think, and you want it free to answer directly when the question doesn't need a tool. Forcing a call here is how you get an agent that runs a web search for "thanks!"
Extraction and routing steps are where forcing pays off. If a step exists only to turn a support email into a create_ticket call, force that tool (or use required or any with a one-tool allowed list on OpenAI and Gemini). Nobody reads the prose, and a guaranteed call means one less branch in your parser. On Claude models that reject forced tool use, switch that step to strict tools under auto or to structured outputs instead.
The wrap-up turn is where none is useful. Once the loop has hit its step limit or its budget cap, set tool_choice to none and ask for a summary of what got done. That gets you a clean final answer instead of one more tool call your loop has to refuse. OpenAI describes none as acting like you passed no functions, and Claude and Gemini both use none to block calls. On Claude, remember this is one more tool_choice change, so it'll reprocess the messages one last time. For a final turn that's usually worth it.
Phase changes in a workflow are what allowed lists are for. On OpenAI and Gemini, keep the full tool list stable and narrow the callable set per phase. On Claude, either accept a cache miss at each phase boundary or enforce the rule in your tool handlers.
A short example
Here's the OpenAI version of a confirm step, using the Responses API shape from the guide. Every request sends the same twenty tools, and only tool_choice changes:
"tool_choice": {
"type": "allowed_tools",
"mode": "auto",
"tools": [
{ "type": "function", "name": "get_cart" },
{ "type": "function", "name": "place_order" }
]
}
With mode: "auto" the model can still answer in text, which is what you want here, since "are you sure?" is a perfectly good reply at a confirm step. Nothing outside those two tools can get called, and the cached prefix stays the same as on every other turn.
The Gemini version keeps the same idea in generation_config:
"generation_config": {
"tool_choice": {
"allowed_tools": { "mode": "any", "tools": ["get_cart", "place_order"] }
}
}
And on Claude, the cache-friendly version is to change nothing in the request and put the check in your code: if place_order arrives before confirmed is true in your loop state, answer with a tool_result that says why and doesn't touch the order system.
The short version
Think of tool_choice as steering, and still validate what comes back. Use auto anywhere the model needs to think. Force a tool only on mechanical steps, and on Claude check first whether your model even allows it. Use none to close a run cleanly. And when you need to limit tools mid-conversation, use allowed lists on OpenAI and Gemini so the tool list stays put. On Claude, enforce the limit in your handlers so you're not paying to reprocess the whole conversation every time the rules shift.
If you want the longer view on designing these loops, AI Engineering by Chip Huyen covers agent design and tool use, though it predates most of the API details above.