Skip to content

Conversation

@joelrobin18
Copy link

@joelrobin18 joelrobin18 commented Dec 26, 2025

Description

When using Gemini with thinking mode enabled (thinking_config), reasoning content was being lost from the message history. The model returns both reasoning (thinking process) and text content in the same response, but only the text was captured.

This affected observability, tracing, and any downstream processing that relies on the conversation history containing the full model output.

Before:

[{"text": "2 + 2 = 4"}]

After:

[
  {"reasoningContent": {"reasoningText": {"text": "Let me calculate..."}}},
  {"text": "2 + 2 = 4"}
]

Related Issues

Fix #1394

Documentation PR

N/A

Type of Change

Bug fix

Testing

How have you tested the change? Verify that the changes do not break functionality or introduce warnings in consuming repositories: agents-docs, agents-tools, agents-cli

  • I ran hatch run prepare

Checklist

  • I have read the CONTRIBUTING document
  • I have added any necessary tests that prove my fix is effective or my feature works
  • I have updated the documentation accordingly
  • I have added an appropriate example to the documentation to outline the feature, or no new docs are needed
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@joelrobin18
Copy link
Author

@zastrowm @dbschmigelski @pgrayy Could you please review this PR? Thanks!

@dbschmigelski
Copy link
Member

Hi, thanks for this, everything looks good to me. I just added some integ tests to make sure we don't break anything in the multi turn case

@codecov
Copy link

codecov bot commented Jan 5, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Copy link
Member

@dbschmigelski dbschmigelski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding this to block merging. This PR and https://github.com/strands-agents/sdk-python/pull/1382/changes seem highly related. We should understand how they relate and if we are tackling the core of the problem with 1395 or if we need to first go deeper

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Reasoning content is lost when model returns both reasoning and text in the same response

3 participants