Skip to content

Python: [Bug]: BedrockChatClient drops reasoningContent, so extended thinking with tool calls fails #8935

Closed

Description

Description

BedrockChatClient currently ignores reasoningContent in Converse responses, streaming responses, and conversation history. Because of this, the model's reasoning is not returned as text_reasoning. This causes an issue with extended thinking and tool calls: when sending the next request after a tool call, the signed reasoning block is missing. Bedrock requires this block to be sent back along with the tool_use block, otherwise the request can fail.

Code Sample

client = BedrockChatClient(model="anthropic.claude-sonnet-4-...")
response = client._process_converse_response({
    "output": {"message": {"role": "assistant", "content": [
        {"reasoningContent": {"reasoningText": {"text": "Need the tool.", "signature": "sig"}}},
        {"toolUse": {"toolUseId": "call-1", "name": "get_weather", "input": {}}},
    ]}},
})
print([c.type for c in response.messages[0].contents])
# ['function_call']  <- the reasoning block is lost

Error Messages / Stack Traces

No error at parse time. The reasoning is silently dropped, and the follow-up Converse call after a tool call is rejected by Bedrock when extended thinking is enabled.

Package Versions

agent-framework-core: 1.19.0, agent-framework-bedrock: (current main)

Python Version

Python 3.11.15

Additional Context

No response

Activity

  1. added
    pythonUsage: [Issues, PRs], Target: Python
    triageUsage: [Issues], Target: All issues that still need to be triaged
    on Oct 1, 2026
  2. added
    reproducedUsage: [Issues], Target: all issues that can be reproduced by the triage workflow
    on Oct 1, 2026
  3. github-actions commented on Oct 1, 2026

    @github-actions
    Contributor

    🤖 Automated triage reproduction notes (agent-authored — trust but verify)

    Agent analysis

    Repro: python/packages/bedrock/agent_framework_bedrock/_chat_client.py::_parse_message_contents drops reasoningContent.reasoningText when it accompanies toolUse, leaving only function_call. Minimal repro: pass the issue payload to _process_converse_response and assert content types are text_reasoning and function_call; the added test fails with actual ['function_call']. _process_converse_stream_event and _convert_content_to_bedrock_block likewise contain no reasoning handling.

    • Failing test: python/packages/bedrock/tests/test_bedrock_client.py
    • Files examined: python/packages/bedrock/agent_framework_bedrock/_chat_client.py, python/packages/bedrock/tests/test_bedrock_client.py, python/packages/core/agent_framework/_types.py, python/packages/bedrock/pyproject.toml
    • Tests run: test_process_converse_response_preserves_non_ascii_in_json_block, test_stream_yields_updates_as_converse_stream_events_arrive, test_prepare_bedrock_messages_skips_unsupported_content_and_unmatched_tool_results, test_process_converse_response_preserves_reasoning_content_with_tool_call
    • Reported version: agent-framework-core 1.19.0
    • Current version: agent-framework-bedrock 1.0.0b260918
  4. added
    agentsUsage: [Issues, PRs], Target: Single agent
    and removed
    triageUsage: [Issues], Target: All issues that still need to be triaged
    on Oct 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

agentsUsage: [Issues, PRs], Target: Single agentpythonUsage: [Issues, PRs], Target: PythonreproducedUsage: [Issues], Target: all issues that can be reproduced by the triage workflow

Type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions