Adaptive Thinking and Effort in Claude: Two Dials, Set per Workload, and the Thinking Block You Must Pass Back
Three support tickets, three needs. Set adaptive thinking and an effort level per kind of work instead of one thinking budget for everything, read the thinking tokens from usage, and pass the thinking block back on a tool turn.
What you will learn
- Turn on adaptive thinking and set output_config.effort per kind of work
- Explain why a manual budget_tokens setting fails on newer Claude models
- Pass a thinking block back unchanged on a tool turn
- Decide when thinking is worth its tokens, and keep max_tokens and the cache in mind
Before you start
- The Claude Messages API: your first call
- Claude tool use: tool_use and tool_result
A support desk gets three kinds of tickets: a quick order lookup, a hard question where two refund rules clash, and a live chat where the customer is still typing. Right now the desk sends one setting for all three: a manual thinking budget on every call.
That one setting can't suit all three. Easy tickets pay for thinking they don't need, the live chat feels slow, and on the newest Claude models the old setting is rejected outright. In this article we replace it with two dials, set per kind of work: adaptive thinking and effort.
A chef with two dials
Think of a chef at the pass with two dials.
- Stop and plan. A toast needs no plan. A wedding menu does. That's adaptive thinking: Claude decides whether to think, and how much.
- How much care. A quick plate or a full check, set per order. That's the effort level.
A kitchen doesn't cook every order the same way. Neither should your API call.
One call, two controls
Both dials are request fields on messages.create.
thinking: {"type": "adaptive"}lets Claude decide when to think. A simple question may get no thinking block at all.output_config: {"effort": ...}sets how much work Claude puts in, fromlowthroughmedium,high,xhightomax. It sits insideoutput_config, not at the top level.- The older extended thinking setting,
{"type": "enabled", "budget_tokens": N}, sets a manual budget. It's legacy: on Claude Opus 4.7 and later models, including the current 5.5 family, it comes back as an HTTP 400. - Fast mode is a separate speed option on some models. It isn't one of these dials.
Short version: thinking is whether to reason, effort is how much.
The old desk: one manual budget
Here is the version we are replacing. Every ticket gets the same thinking budget.
"""Before: one manual budget for every ticket."""
import anthropic
from stand_in import SONNET
OLD = {"model": SONNET, "max_tokens": 2048,
"thinking": {"type": "enabled",
"budget_tokens": 1024}}
def handle(ticket, client):
text = ticket["text"]
msgs = [{"role": "user", "content": text}]
try:
client.messages.create(
messages=msgs, **OLD)
except anthropic.BadRequestError as err:
code = err.status_code
msg = "manual budget rejected, no answer"
return {"line": f"HTTP {code} | {msg}"}
return {"line": "answered"}
The model here is claude-sonnet-5-5. On that model a budget_tokens request is a 400, so the SDK raises BadRequestError and no ticket gets an answer.
profiles.py: three ready sets of fields
Instead of one setting, the matched desk keeps three profiles. Each one is just a dict of request fields.
"""The dials, set once per workload."""
from stand_in import SONNET
LOOKUP = {"model": SONNET, "max_tokens": 512,
"output_config": {"effort": "low"}}
DEEP = {"model": SONNET, "max_tokens": 4096,
"thinking": {"type": "adaptive",
"display": "summarized"},
"output_config": {"effort": "high"}}
LIVE = {"model": SONNET, "max_tokens": 1024,
"output_config": {"effort": "medium"}}
PROFILES = {"lookup": LOOKUP, "deep": DEEP,
"live": LIVE}
BY_KIND = {"status": "lookup", "policy": "deep",
"chat": "live"}
def pick(ticket):
"""One profile per kind of work."""
return BY_KIND[ticket["kind"]]
- LOOKUP uses effort
low, the cheapest and fastest level. - DEEP turns on adaptive thinking and sets effort
highfor the hard question.display: "summarized"asks for a readable summary of the reasoning; without it, newer models return thinking blocks with empty text. - LIVE uses effort
medium, a balance for a chat reply. pick()maps each kind of ticket to one profile.
desk.py: send, then read what the thinking cost
"""Matched desk: pick the profile for the work, read the usage."""
from profiles import PROFILES, pick
def handle(ticket, client, profile=None):
name = profile or pick(ticket)
cfg = PROFILES[name]
text = ticket["text"]
msgs = [{"role": "user", "content": text}]
r = client.messages.create(
messages=msgs, **cfg,
)
blocks = [b.type for b in r.content]
shown = "thinking" in blocks
details = r.usage.output_tokens_details
think = details.thinking_tokens
out_cfg = cfg.get("output_config", {})
effort = out_cfg.get("effort", "default")
return {"profile": name,
"model": cfg["model"],
"dial": f"effort {effort}",
"block": shown,
"think": think,
"out": r.usage.output_tokens}
Two things to notice. The desk checks whether a thinking block came back, because with adaptive thinking it may or may not. And it reads usage.output_tokens_details.thinking_tokens, so you can see what the thinking cost on every call.
Pass the thinking block back on a tool turn
Now a fourth ticket: "Does order 4471 qualify for a refund?" Claude thinks, then asks for the lookup_order tool.
- Request one: Claude answers with a
thinkingblock and atool_useblock, andstop_reasonistool_use. Your code runs the tool. - Request two: you send the assistant turn back unchanged, thinking block included, then the
tool_resultas a user message.
Pass the block back and the reasoning carries into the next step. Drop it and the reasoning is lost, with no error to warn you.
"""One tool turn: pass the thinking block back."""
from profiles import DEEP
from tools import TOOLS, ORDER
def run_turn(question, client, keep=True):
msgs = [{"role": "user", "content": question}]
first = client.messages.create(
messages=msgs, tools=TOOLS, **DEEP)
call = first.content[-1]
echo = first.content
if not keep:
echo = [b for b in echo
if b.type != "thinking"]
msgs.append({"role": "assistant",
"content": echo})
msgs.append({"role": "user", "content": [
{"type": "tool_result",
"tool_use_id": call.id,
"content": ORDER}]})
final = client.messages.create(
messages=msgs, tools=TOOLS, **DEEP)
return {"sent": "+".join(b.type for b in echo),
"stop": first.stop_reason,
"reply": final.content[-1].text}
The keep flag exists only to show the mistake. In real code, append first.content as it is. The tool round trip itself is covered in Claude tool use: tool_use and tool_result.
What the run printed
The project runs without an API key: the Anthropic SDK talks to a scripted stand-in model on an httpx mock transport. So the token numbers below come from the project's stand-in, not from a live Claude run. They show the shape of the result, not a measurement.
python run_all.py
old desk, manual budget
T-201 HTTP 400 | manual budget rejected, no answer
T-202 HTTP 400 | manual budget rejected, no answer
T-203 HTTP 400 | manual budget rejected, no answer
one setting for all
T-201 deep -> effort high | block yes | think 96 | out 134
T-202 deep -> effort high | block yes | think 640 | out 912
T-203 deep -> effort high | block yes | think 210 | out 330
matched desk
T-201 lookup -> effort low | block no | think 0 | out 38
T-202 deep -> effort high | block yes | think 640 | out 912
T-203 live -> effort medium | block yes | think 150 | out 270
output tokens: one setting 1376 | matched 1220
tool turn, block passed back
T-204 stop tool_use | sent thinking+tool_use | thinking seen: yes
tool turn, block dropped
T-204 stop tool_use | sent tool_use | thinking seen: no
- The old desk gets three 400s.
- With one deep setting for everything, the lookup still spends 96 thinking tokens.
- The matched desk gives the lookup no thinking block at all, and keeps the full 640 thinking tokens for the policy question.
- Output tokens drop from 1376 to 1220 across the three tickets.
- On the tool turn, the second request only sees the reasoning when the block is passed back.
Is the thinking worth its tokens?
Ask two questions per ticket: does the answer need steps, and does a miss cost more than the tokens?
| Ticket | One setting | Matched | Verdict |
|---|---|---|---|
| T-201 lookup | 96 thinking tokens | 0 | Skip it |
| T-202 policy clash | 640 | 640 | Keep it: the reasoning is the work |
| T-203 live chat | 210 | 150 | Trim it: a little care, then answer |
Across the three tickets that saves 156 thinking tokens, and it spends them where they matter.
Soft guidance, hard cap
- Effort is soft guidance. It shapes how much Claude thinks and writes. It isn't a token count.
- max_tokens is the hard cap. Thinking and the answer share it. Set it too small and the reply is cut off with
stop_reasonmax_tokens. Raise it, or lower the effort. - The cache. Changing the top-level effort between requests in one conversation can make the prompt cache miss, so hold it steady for the whole chat. Per-message effort, which is in beta on some models, is the way to change it without that reset. See prompt caching for why a changed prefix misses.
- Defaults differ by model. On Claude Sonnet 5.5 the default effort is
high; on Claude Opus 5.5 and Claude Haiku 5.5 it'smedium. Set it explicitly so a model switch doesn't change it for you.
Common mistakes
- Adding
budget_tokensto every call. That's legacy extended thinking, and a 400 on Claude Opus 4.7 and later. - Setting effort to
maxeverywhere. Easy tickets pay for depth they never use. - Asking the prompt to "think less". Lower the effort instead; it's the dial built for this.
- Filtering thinking blocks out of the history. On a tool turn, send the assistant content back unchanged.
- Reading
content[0]as the answer. With thinking on, the first block can be a thinking block. Find the text block by its type.
Quick recap
| Control | Field | What it does |
|---|---|---|
| Adaptive thinking | thinking: {"type": "adaptive"} | Claude decides when and how much to think |
| Effort | output_config.effort | low to max, soft guidance on depth and spend |
| Thinking cost | usage.output_tokens_details.thinking_tokens | What the thinking spent on this call |
| Hard cap | max_tokens | Bounds thinking plus answer |
| Legacy | budget_tokens | 400 on Claude Opus 4.7 and later |
Try it yourself
Add a fourth kind of ticket, say "translate this reply into Spanish". Decide its profile with the two questions above, add it to BY_KIND, and check whether it gets a thinking block and how many thinking tokens it reports.
Related course on Udemy
Claude Certified Developer - Foundations (CCDV-F) Exam Prep
Build and ship Claude apps: the API, agents, tools and MCP, prompts, evals, security and model choice.View on Udemy ↗: Claude Certified Developer - Foundations (CCDV-F) Exam Prep (paid course, opens in a new tab)Related posts
The Claude Messages API: Your First Call, Field by Field
One request in, one Message out. The four fields of a Messages API call (model, max_tokens, system, messages), how to read content blocks, stop_reason and usage, and why every turn resends the history.
Claude Tool Use: How tool_use and tool_result Work in the Messages API
Follow one order question through Claude's tool round trip: define a tool, read the tool_use block, run your own function and send a matching tool_result back, including parallel calls and is_error.
Claude Client SDKs Wrap One REST API: Raw HTTP, Python, TypeScript and Async Calls Compared
Every Claude client SDK wraps the same REST request: a POST to /v1/messages with a JSON body. See it built by hand, through the Python and TypeScript SDKs, as typed errors, and as async calls that wait together.
Anthropic SDK Timeouts, Retries and Error Classes: Configure the Client Once, Then Give 429, 529, 400 and Timeouts Their Own Move
Configure the Anthropic SDK client (timeout, max_retries, with_options, async, pagination), see which errors it retries by itself, then repair a retry wrapper so a 429, a 529, a 400 and a timeout each get the move the docs support.