Adaptive Extended Thinking: Trading Latency for Compute

8 min readYaseen Khatib · MERN + AI Architect

Two failure modes, opposite causes. Your classifier got slow and expensive because every trivial call now burns thousands of reasoning tokens before answering "billing." Meanwhile your planning agent gives shallow, wrong answers on genuinely hard multi-constraint problems because it never stops to think. Reasoning isn't free, and it isn't always worth it. Adaptive extended thinking is the dial — and most teams either leave it off or peg it to max, both of which are wrong.

Core Architectural Concepts & Trade-offs

Extended thinking lets Claude spend tokens on visible internal reasoning — thinking blocks — before it commits to an answer. Those tokens come out of the same context window as everything else (Lesson 1) and out of your wallet. The 2026 models make this adaptive: given a budget_tokens ceiling, the model spends reasoning effort proportional to the difficulty it perceives, stopping early on easy requests and going deep only when the problem warrants. The budget is a cap, not a quota — setting 16K doesn't mean every call spends 16K.

The core trade-off is latency for accuracy, and it is not linear. On genuinely hard tasks — multi-step math, constraint satisfaction, debugging across files, planning with dependencies — a thinking budget can be the difference between right and confidently wrong, and it pays for itself many times over. On easy, high-volume tasks — classification, extraction, formatting — that same budget buys nothing but time-to-first- token and cost. The engineering decision is per-task-tier, not global: match the budget to the hardest thing that tier actually does.

Thinking composes with tool use in a way that matters for agents. Interleaved thinking lets the model reason between tool calls — inspect a tool_result, reflect on what it implies, then decide the next call — rather than blindly chaining tools. For a multi-step agent loop (Lesson 4) that reflection is often where the correctness lives: it's the difference between an agent that adapts to what it finds and one that executes a fixed plan into a wall.

Two operational notes. First, thinking blocks are part of the assistant turn — preserve them in the transcript on multi-turn tool loops or you degrade the model's continuity. Second, thinking interacts with caching (Lesson 9): the reasoning is dynamic, so it lives past your cached static prefix, not inside it. Budget thinking where it earns its latency, cache the stable context around it, and you get deep reasoning only on the turns that need it.

Budgeting Thinking by Task Tier

Don't set one global thinking budget. Tier it: zero for plumbing, a modest budget for analysis, a deep budget for planning.

thinking-tiers.ts
// budget_tokens is a CEILING, not a quota — the model spends to difficulty.
import Anthropic from "@anthropic-ai/sdk"

const anthropic = new Anthropic()

const THINKING = {
  plumbing: 0,        // classify / extract / format — reasoning buys nothing
  analysis: 4_000,    // summarize, compare, light reasoning
  planning: 16_000,   // multi-constraint planning, cross-file debugging
} as const

type Tier = keyof typeof THINKING

export async function ask(tier: Tier, system: string, prompt: string) {
  const budget = THINKING[tier]
  return anthropic.messages.create({
    model: "claude-opus-4-8",
    max_tokens: 4_000,
    // Reserve output headroom ABOVE the thinking budget (Lesson 1).
    thinking: budget > 0
      ? { type: "enabled", budget_tokens: budget }
      : { type: "disabled" },
    system,
    messages: [{ role: "user", content: prompt }],
  })
}

// Hot path stays fast; only the planner pays the latency tax.
await ask("plumbing", SYS, "Classify: 'my card was double charged'")
await ask("planning", SYS, "Sequence this 9-step migration under these 4 constraints…")

The same model, the same code path — the only variable is how much reasoning each tier is allowed to buy. Your classifier stays instant; your planner gets the depth it needs.

Effort Should Track Difficulty

easyhard → task difficultythinking tokensbudget_tokens ceiling (max)flat max = wasted on easy →adaptive: spend ∝ difficultyzero budget → hard tasks fail
Adaptive thinking spends to difficulty. A flat max wastes tokens on easy tasks; zero fails the hard ones.

With reasoning effort tuned, the workflow shifts from the API to the local agent. Next: CLAUDE.md, system files & a secure CLI. Or browse the full roadmap.

Looking to architect a similar system?

Let's ship it at AI-speed.

Start a conversation →