Single logo
  • Courses
  • Blog
  • About
Join on SkoolJoin on Skool

In this topic

Claude
  • CLAUDE.md, settings.json and Plugins: Which Claude Code File Advises, Which Enforces, Which Packages
  • Authoring a Claude Skill: SKILL.md, Frontmatter, Progressive Disclosure and the Description That Triggers It
  • One Change, Four Environments: Where a Claude Config Edit Lands in Dev, Staging, Prod and CI
  • Claude in the SDLC: Prompts in Git, a Change Gate by Path, a Claude Review That Advises and a Person Who Merges
  • Hooks That Block Destructive Actions: a PreToolUse Gate That Allows, Asks or Denies
  • Choosing a Claude Code Extension: Skill, Hook, Rules File, Subagent, Slash Command or Plugin
  • Rolling Out Claude Code to a Team: Settings Precedence, dontAsk in CI, a Hook for Every-Time Rules and a Plugin for Five Repos
  • A Claude Code Review Bot in CI: Headless -p, JSON Findings, Team Rules in Git and a Person on the Merge
  • Lab: Three Planted Bugs in a Claude Code CI Repo, a Permission Mode, a Plugin Path and an MCP Token Variable
  • Configuring MCP Servers in Claude Code: A Command or a URL, Three Scopes, and Three Moves When One Breaks
  • The Claude Messages API: Your First Call, Field by Field
  • Claude Tool Use: How tool_use and tool_result Work in the Messages API
  • Claude Client SDKs Wrap One REST API: Raw HTTP, Python, TypeScript and Async Calls Compared
  • Anthropic SDK Timeouts, Retries and Error Classes: Configure the Client Once, Then Give 429, 529, 400 and Timeouts Their Own Move
  • Claude Streaming Events: The Event Order, message_stop, Tool Arguments, Stop Reasons and a WebSocket Relay
  • Images, PDFs and Thinking Blocks in the Claude Messages API: Typed Blocks In, Typed Blocks Out
  • Getting Data Into Claude: PDF Documents, the Files API, Search Results and Citations
  • Opus, Sonnet or Haiku: Pick the Claude Model per Job, and Test the Request When a New Release Arrives
  • Adaptive Thinking and Effort in Claude: Two Dials, Set per Workload, and the Thinking Block You Must Pass Back
  • Claude Cost Tracking From usage: Count Before, Cap During, Read After, Then Find the Line That Drives the Bill
  • Claude Cache Breakpoints: Where to Put cache_control, How to Move It With the Chat, and Why the Reads Stay at Zero
  • Claude Message Batches or Real Time: Choose by Who Is Waiting, Match by custom_id, Resend Only the Failures
  • Calling Claude Through Amazon Bedrock, Google Cloud and Microsoft Foundry: Same Call, Different Door
  • The Life Cycle of a Claude App: Six Phases, a Model That Retires, and a Release Gate for Every Change
  • Pinning Claude Model IDs and Upgrading Safely: One Change at a Time, a Golden-Set Replay and a Staged Rollout
  • Content Boundaries and Schema Design for Claude: Fence the Input in a Tag, Let the Output Say I Don't Know
  • The Agentic Loop and stop_reason: Keep Turning on tool_use, Stop on end_turn, Cap the Turns
  • The Claude Agent SDK: query(), ClaudeAgentOptions and @tool, in Python and TypeScript
  • Fix the Agent: Four Broken Claude Agent SDK Configs, From the Symptom to the One Wrong Line
  • Claude Managed Agents: Cloud Sandbox, Self-Hosted Sandbox or Self-Hosted Service
  • Agent SDK Hooks for Deterministic Actions: PreToolUse, PostToolUse, and Four Hooks That Fail Silently
  • Memory and Context-Window Patterns for Claude Agents: Context Editing, Compaction and the Memory Tool
  • Reading an Agent Trace: Five Signatures, Five Missing Patterns, and How Long a Fact Must Live
  • Tool Descriptions for Claude: How Claude Picks a Tool, and How to Stop It Picking the Wrong One
  • Tool Input Schemas and Error Responses for Claude: Required Fields, Enums, is_error and a Retry Flag
  • Tool Response Shaping and a Lean Tool Set: Give Claude a Sticky Note, Not the Filing Cabinet
  • Fix the Tool Schema: Read the Trace, Fix the Card, Re-Run (Four Real Schema Bugs)
  • Client Tools, Server Tools and Approval Gates: Who Runs the Tool, and Who Says Yes First
  • Built-in Tool, Custom Tool, Skill or MCP Server? Pick the Lightest One That Fits
  • System Prompt or User Turn: Where Each Instruction Goes, and Output Limits Your Code Enforces
  • Refine the Prompt One Line at a Time, Then Clean and Fence the Customer's Text
  • Prompt Revision Driven by Evals: Name the Cause, Change One Thing, Rerun the Whole Suite
  • Long-Running Sessions: Compact, Prune, Isolate or Start Fresh, Decided by Naming the Failure
  • Context Isolation Through Subagents: Read the Logs Elsewhere, Keep One Line
  • Defensive Parsing of Claude Replies: Check the Stop Reason, Read the Block or the Text, Then Validate the Values
  • Full Context or Retrieval: Choose by Corpus Size, Cost and Freshness
  • Skepticism Toward Confident Output: Check the Quote, the Record and the Sum Before You Send
  • Debugging a Claude App: Three Error Types, the Recovery Each One Earns, and the First Failing Row
  • Six Ways a 200 Can Still Be Wrong: Hallucination, Refusal, Under-Acting, Context Loss, Format Drift and Inconsistency
  • Fix the Cause, Not the Symptom: Four Recovery Drills for an LLM App, Each Checked on a New Input
  • Integration Layer or Model Output? Three Taps and Three Questions to Find Where a Wrong Answer Lives
  • Which Test Layer Owns the Failure? Unit, Functional, Integration and End-to-End Tests for a Claude App
  • Designing an Overnight Document Pipeline on Claude: Batch Lane, Live Lane, a Cached Prefix and a custom_id Reconcile
  • Proving a Model Upgrade Is Ready: A Frozen Golden Set, a Calibrated Judge, the Right Layer and a Release Gate
  • From Requirement to Design for a Claude App: Eight Requirements, Five Elements and a Trace With No Gaps
  • Build a Claude Refund App: the Messages API, Two Tools, an MCP Server and a Hook in One Loop
  • Ship a Claude App: an Eval Gate, Two Guardrail Layers, a Cost Check From usage and a Pinned Model
  • Lab: a 30-Case Golden Set, a Calibrated Judge and a Per-Slice CI Gate on a Claude Refund App
  • Lab: Cut a Claude App's Bill by 62 Percent With Usage Data, Layered Cache Breakpoints and a Batch Job
  • Lab: Three Planted Bugs in a Claude App, a Vague Prompt, a Mistyped Tool Schema and a Broken Stream Handler
  • Lab: Three Planted Bugs in a Claude Code CI Repo, a Permission Mode, a Plugin Path and an MCP Token Variable
  • Lab: Harden a Claude App, an Uncalibrated Judge, a Retry Loop That Retries Everything and a Hook Matcher With a Gap
  • Lab: Turn a Claude App Into a Reusable Template, One Pinned Model Id, No Key in Code and Evals Built From Data
  • Building an MCP Server: Tools, Resources and Prompts in Python and TypeScript
  • MCP Transports: stdio or Streamable HTTP, and Who Starts the Server
  • Deploying and Authenticating an MCP Server: Environment Keys for stdio, Bearer Tokens and Scopes for HTTP
  1. Blog
  2. /
  3. Claude
  4. /
  5. Building with the Claude API

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.

Chaand Sheikh

·27 November 2026Building with the Claude API

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, from low through medium, high, xhigh to max. It sits inside output_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.

One profile per kind of work T-201 status "Where is my order?" T-202 policy two rules clash T-203 chat customer typing live pick() LOOKUP effort low DEEP thinking adaptive + effort high LIVE effort medium
The profile is chosen before the call; the usage is read after it.

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 high for 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.

  1. Request one: Claude answers with a thinking block and a tool_use block, and stop_reason is tool_use. Your code runs the tool.
  2. Request two: you send the assistant turn back unchanged, thinking block included, then the tool_result as 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?

TicketOne settingMatchedVerdict
T-201 lookup96 thinking tokens0Skip it
T-202 policy clash640640Keep it: the reasoning is the work
T-203 live chat210150Trim 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_reason max_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's medium. Set it explicitly so a model switch doesn't change it for you.

Common mistakes

  • Adding budget_tokens to every call. That's legacy extended thinking, and a 400 on Claude Opus 4.7 and later.
  • Setting effort to max everywhere. 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

ControlFieldWhat it does
Adaptive thinkingthinking: {"type": "adaptive"}Claude decides when and how much to think
Effortoutput_config.effortlow to max, soft guidance on depth and spend
Thinking costusage.output_tokens_details.thinking_tokensWhat the thinking spent on this call
Hard capmax_tokensBounds thinking plus answer
Legacybudget_tokens400 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.

Tried the exercise? Share your answer or ask a question.

The StudyEasy AI Community is free to join, with the lesson files, notebooks and code.

Join free on Skool

Keep going in Claude · 19 of 66

Previous
Opus, Sonnet or Haiku: Pick the Claude Model per Job, and Test the Request When a New Release Arrives
Next post
Claude Cost Tracking From usage: Count Before, Cap During, Read After, Then Find the Line That Drives the Bill

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.

On this page

  • A chef with two dials
  • One call, two controls
  • The old desk: one manual budget
  • profiles.py: three ready sets of fields
  • desk.py: send, then read what the thinking cost
  • Pass the thinking block back on a tool turn
  • What the run printed
  • Is the thinking worth its tokens?
  • Soft guidance, hard cap
  • Common mistakes
  • Quick recap
  • Try it yourself
Community · Free to join
Single logo

StudyEasy AI Community

Hosted onSkool

Learn AI engineering, share what you build, and connect with other learners.

  • Free resources: lesson files, notebooks and code

  • Ask questions and join engineering discussions

  • Meet real people learning and building with AI

Join free on Skool

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)

Single logo

Empowering Education, One Course at a Time

About
About usContact usFAQs
Legal
Terms of ServicePrivacy Policy

© 2026 StudyEasy Organization. All rights reserved.