Skip to content

Unable to call tools when extended thinking enabled in Claude #3289

Closed

Description

@lambda72453

** Please make sure you read the contribution guide and file the issues in the right place. **
Contribution guide.

Describe the bug
Im getting the following error when using claude sonnet on aws bedrock through litellm when thinking is enabled and a tool is called.

{"message":"The model returned the following errors: messages.3.content.0.type: Expected thinking or redacted_thinking, but found tool_use. When thinking is enabled, a final assistant message must start with a thinking block (preceeding the lastmost set of tool_use and tool_result blocks). We recommend you include thinking blocks from previous turns. To avoid this requirement, disable thinking. Please consult our documentation at https://docs.claude.com/en/docs/build-with-claude/extended-thinking"}

To Reproduce
Enable thinking with litellm. Add claude model (im using AWS bedrock). Add a tool and call it.

Example:
`def get_weather(city: str) -> dict:
"""Retrieves the current weather report for a specified city.

Args:
    city (str): The name of the city for which to retrieve the weather report.

Returns:
    dict: status and result or error msg.
"""
if city.lower() == "new york":
    return {
        "status": "success",
        "report": (
            "The weather in New York is sunny with a temperature of 25 degrees"
            " Celsius (77 degrees Fahrenheit)."
        ),
    }
else:
    return {
        "status": "error",
        "error_message": f"Weather information for '{city}' is not available.",
    }

root_agent = LlmAgent(
model=LiteLlm(model="bedrock/us.anthropic.claude-sonnet-4-5",
temperature=1,
thinking={"type": "enabled", "budget_tokens": 10000}),
#model="gemini-2.5-flash",
name='root_agent',
description='A helpful assistant for user questions.',
instruction='Answer user questions to the best of your knowledge',
tools=[get_weather]
)`

Expected behavior
A clear and concise description of what you expected to happen.

It should be abled to call tools without error when thinking is enabled.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: mac
  • Python version(python -V): python 3:13
  • ADK version(pip show google-adk): 1.17.0

Model Information:

  • Are you using LiteLLM: Yes
  • Which model is being used(e.g. gemini-2.5-pro)
    Claude Sonnet 4.5 in Bedrock

Additional context
Tool calling does work when thinking is not enabled.

Activity

  1. added
    models[Component] This issue is related to model support
    on Oct 26, 2025
  2. added theissue type on Oct 26, 2025
  3. added this to the 10/27 ADK Week milestone on Oct 26, 2025
  4. aneeshgarg commented on Oct 28, 2025

    @aneeshgarg

    Taking a look at this.

  5. self-assigned this
    on Oct 31, 2025
  6. Infinnerty commented on Dec 4, 2025

    @Infinnerty

    Any update on this?

  7. added
    needs review[Status] The PR/issue is awaiting review from the maintainer
    on Feb 2, 2026
  8. sebastienc commented on Apr 19, 2026

    @sebastienc
    Contributor

    For anyone using AnthropicLlm directly (the native Anthropic client in ADK, as opposed to via LiteLLM), PR #5392 addresses this. It adds full extended thinking support including multi-turn continuity — ThinkingBlock responses are preserved as Part(thought=True, thought_signature=...) in the session and sent back as ThinkingBlockParam on the next turn, satisfying the API's requirement.

    The LiteLLM path also appears to already handle this correctly in the current code (_is_anthropic_model recognises Bedrock model strings and _content_to_message_param rebuilds thinking_blocks with signatures on subsequent turns). It may be worth re-testing to see if the original issue is already resolved.

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

Metadata

Metadata

Labels

models[Component] This issue is related to model supportneeds review[Status] The PR/issue is awaiting review from the maintainer

Type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions