Skip to content

AnthropicLlm: honor ThinkingConfig.include_thoughts so callers can turn off Claude's reasoning summaries #8377

In review

Description

@lebeg

🔴 Required Information

Is your feature request related to a specific problem?

AnthropicLlm always asks Claude for its reasoning summaries when adaptive
thinking is on, and there is no way to turn that off.

A negative thinking_budget maps to a fixed value in
_build_anthropic_thinking_param:

return anthropic_types.ThinkingConfigAdaptiveParam(
    type="adaptive",
    display="summarized",
)

thinking_config.include_thoughts is never read. So this config:

types.GenerateContentConfig(
    thinking_config=types.ThinkingConfig(
        thinking_budget=-1, include_thoughts=False
    ),
)

still sends "thinking": {"type": "adaptive", "display": "summarized"}, and
every model turn comes back with a reasoning summary as a thought part.

Why this matters:

  • The API's own default is "omitted". Per Anthropic's
    thinking docs,
    display accepts "summarized" and "omitted", and "omitted" is the
    default on Claude Opus 4.7 and every later model (Opus 4.8, Opus 5,
    Opus 5.5, Sonnet 5, Sonnet 5.5, Haiku 5.5, Fable 5.x). Opus 4.6 and
    Sonnet 4.6 defaulted to "summarized". On Opus 4.7 and 4.8, thinking stays
    off until the request sends thinking: {"type": "adaptive"}, so in ADK the
    only way to turn thinking on there also turns summaries on.
  • display changes visibility only. Claude thinks, and is billed, the
    same under either value. With "omitted" the thinking blocks still
    arrive (streamed too), with an empty thinking string and a signature,
    and must be passed back unchanged on later turns.
  • Summaries delay the answer when streaming. The same docs say the main
    benefit of "omitted" is "faster time-to-first-text-token when streaming":
    the server sends only the signature instead of streaming summary text, so
    the answer starts sooner. Billing does not change.
  • The summaries travel. Thought parts are stored with the model's turn in
    session events, and from there they reach logs, telemetry, memory and
    anything that renders text parts. Several issues deal with that after the
    fact, for example FirestoreMemoryService indexes, stores and returns the model's thought parts #7830 (Firestore memory), VertexAiMemoryBankService sends the model's thought parts to Memory Bank #7850 (Memory Bank), to_mcp_server returns the model's thought parts to MCP clients #7834
    (to_mcp_server) and GenAI telemetry exports thought parts as text instead of reasoning #8095 (telemetry). An app that never shows the
    reasoning should be able to not ask for it.
  • genai already has the switch. ThinkingConfig.include_thoughts is the
    provider-neutral way to say this; on Gemini, thoughts are returned only when
    it is True. In ADK, LiteLlm already treats include_thoughts=False as
    "drop thought parts"
    (streaming,
    non-streaming).
    AnthropicLlm ignores it.

Describe the Solution You'd Like

Read thinking_config.include_thoughts when building the thinking
parameter, and send display: "omitted" only when it is False:

include_thoughts thinking_budget < 0 (adaptive) thinking_budget > 0 (manual)
None (default) display: "summarized" (as today) no display (as today)
True display: "summarized" (as today) no display (as today)
False display: "omitted" display: "omitted"

thinking_budget=0 stays {"type": "disabled"} with no display, which
Claude rejects there. The docs allow display with both "adaptive" and
"enabled", and the anthropic SDK's ThinkingConfigEnabledParam has the
field.

Omitted thinking blocks become thought parts with text="" and the
signature, and ADK already sends them back as thinking blocks, not
redacted_thinking, since #7500
(_part_to_message_block).
So tool loops keep working, in both the streaming and non-streaming paths.

The docstrings that say the reasoning always comes back as summarized
thoughts would be updated to describe the switch.

Backward compatibility: include_thoughts=None and True send exactly
the same request as today. Only callers who already set
include_thoughts=False see a change, and they get what the field says. One
in-repo case: EnvironmentSimulationConfig sets include_thoughts=False by
default, so a Claude simulation model would now get omitted thinking, which
matches what it asks for.

Impact on your work

I run ADK agents on Claude where nobody reads the reasoning. With adaptive
thinking on, every model turn stores a reasoning summary in the session, and
I have to keep it out of logs, memory and the UI, and when streaming I wait
for text I then throw away. I'd rather not receive it.
There is no deadline.

Willingness to contribute

Yes. I have a small patch with unit tests and can send a PR once the approach
looks right.


🟡 Recommended Information

Describe Alternatives You've Considered

  1. A Claude-specific field on AnthropicGenerateContentConfig, next to
    effort, for example
    thinking_display: Literal["summarized", "omitted"] | None. It is explicit
    and leaves room for the beta "updates" value (header
    thinking-display-updates-2026-08-18, on Fable 5.x, Opus 5.5 and
    Sonnet 5.5), which returns short progress notes between tool calls. But it
    is a second switch for something genai already models, and a plain
    GenerateContentConfig could not use it. It could still be added later on
    top of this change, with the explicit field winning when both are set.
  2. Filter thought parts after the response, as LiteLlm does. The text
    still arrives and must be dropped in every place that sees it, and the
    signed blocks must be kept on tool-use turns anyway. Asking Claude not to
    return the text is simpler.
  3. Send no display when include_thoughts is None, so the API default
    applies. That follows the API more closely, but it changes what everyone
    who uses adaptive thinking today gets back. I'm not proposing it.

Proposed API / Implementation

No new API. Usage:

from google.adk.agents import LlmAgent
from google.genai import types

root_agent = LlmAgent(
    name="assistant",
    model="claude-opus-4-7",
    instruction="You are a helpful assistant.",
    generate_content_config=types.GenerateContentConfig(
        thinking_config=types.ThinkingConfig(
            thinking_budget=-1, include_thoughts=False
        ),
    ),
)
# Request: "thinking": {"type": "adaptive", "display": "omitted"}

Implementation sketch in _build_anthropic_thinking_param:

omit_thoughts = config.thinking_config.include_thoughts is False

if thinking_budget < 0:
  return anthropic_types.ThinkingConfigAdaptiveParam(
      type="adaptive",
      display="omitted" if omit_thoughts else "summarized",
  )

enabled = anthropic_types.ThinkingConfigEnabledParam(
    type="enabled", budget_tokens=thinking_budget
)
if omit_thoughts:
  enabled["display"] = "omitted"
return enabled

Additional Context

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions