Skip to content
Blog

Thinking Models in ADK: Reasoning Budgets, Thought Traces, and Cost Control

How to use Gemini thinking models in ADK — BuiltInPlanner, ThinkingConfig include_thoughts and thinking_budget, when to spend more reasoning, and how to keep the meter under control.

Published on • November 25, 2026

AI Assistant

Modern reasoning models can spend tokens thinking before they answer — turning a problem over, checking itself, backtracking. That deliberation is genuinely useful on hard tasks and genuinely expensive on easy ones. The craft is allocating reasoning on purpose: enough budget where depth pays, near-zero where it’s wasted, and visibility into what the thinking actually bought.

In ADK, this is controlled through planning configuration — BuiltInPlanner with a ThinkingConfig carrying include_thoughts and thinking_budget. This post covers what those knobs do, how to size a budget, and how to keep thinking costs from quietly dominating your bill.

The mental model

A thinking model splits its output into two streams:

  • Thoughts (reasoning) — the internal deliberation, available for inspection when include_thoughts is enabled.
  • The answer — the final response your user sees.

The thinking budget caps how many tokens may be spent on the first stream. Think of it as a per-request R&D allocation: the model may spend up to this much on figuring out how to answer before producing the answer itself.

Two important cost facts:

  1. Thinking tokens are output tokens. They’re billed and generated as output — so the budget interacts directly with max_output_tokens and with latency.
  2. A high budget on a simple task is pure waste. The model will use what you allow; permission isn’t need.

Configuring it in ADK

from google.adk.agents import Agent
from google.adk.planners import BuiltInPlanner
from google.genai.types import ThinkingConfig

analyst = Agent(
    model="gemini-pro-latest",
    name="analyst",
    instruction=ANALYST_INSTRUCTION,
    planner=BuiltInPlanner(
        thinking_config=ThinkingConfig(
            include_thoughts=True,     # expose thought summaries for debugging
            thinking_budget=1024,       # cap on reasoning tokens
        )
    ),
    tools=[query_data, run_analysis],
)

Reading the two fields:

  • include_thoughts — surfaces the model’s thought summaries (they arrive as thought parts in the response). Turn it on during development and debugging; consider it in production when you want auditable reasoning, and turn it off when you don’t need the extra output tokens.
  • thinking_budget — the reasoning token cap. Higher = deeper deliberation, more cost, more latency. Zero (or omitting the planner, for models where thinking is optional) = direct answering.

ADK handles the plumbing: the planner’s configuration travels with the agent’s generation flow, and thought parts are represented in the event stream alongside the final answer — inspectable in your session events like anything else.

Sizing the budget

Like max_output_tokens, size from measurement rather than folklore:

Task classBudget postureWhy
Classification, extraction0 / offNo deliberation pays for itself here
Standard assistant turnsLow (hundreds)Light self-checking only
Multi-step analysis, planningMedium (1–2k)Room to consider alternatives
Hard reasoning, adversarial casesHigh (4k+)Depth genuinely improves output

Practical method:

  1. Run your eval set at two budgets (e.g. 512 and 4096).
  2. Compare success rate against cost — thinking tokens count as output tokens, so price them explicitly.
  3. Adopt the knee point — the lowest budget where success rate flattens. For many agent workloads the curve flattens early, because the task was never reasoning-bound.
  4. Re-check when the model or task changes.

The decision rule that survives: budget follows task complexity, the same axis as tier selection and routing. In fact the two compose naturally — route hard tasks to Pro and give them a bigger thinking budget; give Flash-tier tasks zero thinking.

def planner_for(complexity: str) -> BuiltInPlanner | None:
    return {
        "simple": None,                                     # no thinking
        "moderate": BuiltInPlanner(thinking_config=ThinkingConfig(thinking_budget=512)),
        "hard": BuiltInPlanner(thinking_config=ThinkingConfig(
            thinking_budget=4096, include_thoughts=True)),
    }[complexity]

The interactions you must manage

Thinking budget vs. max_output_tokens. Both draw from the same output allowance. A thinking_budget=4096 with max_output_tokens=1024 can spend the entire cap on reasoning and leave nothing (or a truncated stub) for the answer — the exact failure truncation detection exists to catch. Set the answer cap generously relative to the thinking budget, or let the provider’s output limit cover both explicitly.

Thinking vs. stop sequences. A stop sequence applies to decoded text; verify it doesn’t fire inside thought traces in a way that starves the answer — another argument for keeping the two controls on separate layers.

Thinking vs. latency. More thinking is more tokens before the user sees anything. Interactive surfaces want low budgets or streaming that shows progress; background analysis (headless runs) can afford more.

Thought traces and privacy. include_thoughts=True puts reasoning content into events and logs. If your logging captures event payloads, thought summaries become part of your data-retention surface — treat them with the same redaction discipline as answers.

Evaluating whether thinking helps

The honest way to justify the spend:

  • A/B the budget on the same eval suite; report success delta and cost delta together. “2% better for 8× the output cost” is a decision, not an answer.
  • Inspect thought traces on failures. With include_thoughts=True, failed cases show where reasoning went wrong — often it’s a missing fact (fix the tools/retrieval), not insufficient budget.
  • Watch for budget-inflation creep. Teams raise budgets to fix eval failures that were really prompt or context problems; the prompt-first discipline applies here too.

A default policy

# default posture for a mixed-workload assistant
DEFAULT_THINKING = ThinkingConfig(include_thoughts=False, thinking_budget=0)   # most turns
DEEP_THINKING    = ThinkingConfig(include_thoughts=True,  thinking_budget=2048) # gated by classifier

Off by default, on with evidence, logged always. Every invocation should record thinking_budget used and reasoning-token count alongside the other five production metrics — otherwise reasoning cost is invisible until the invoice.

Where to go next

Thinking is one half of the generation-control stack: sampling behavior in GenerateContentConfig, size limits in max_output_tokens, early termination in stop sequences. Deciding which model deserves the budget is dynamic routing, and the cost frame is enterprise reliability, latency, and cost.

References