Skip to content

[BUG] Using DeepSeek R1 reasoning model from Bedrock and FileSessionManager in Strands agent causes 'ValidationException error that says user messages cannot contain reasoning content' #651

@aryan835-datainflexion

Description

@aryan835-datainflexion

Checks

  • I have updated to the lastest minor and patch version of Strands
  • I have checked the documentation and this is not expected behavior
  • I have searched ./issues and there are no duplicates of my issue

Strands Version

1.4.0

Python Version

3.13.3

Operating System

macOS 15.5

Installation Method

pip

Steps to Reproduce

  1. Create agent using Bedrock DeepSeek R1 model and FileSessionManager or S3SessionManager

With FileSessionManager:

from strands import Agent
from strands.models import BedrockModel
from strands.session.file_session_manager import FileSessionManager

bedrock_model = BedrockModel(model_id="us.deepseek.r1-v1:0")
session_manager = FileSessionManager(session_id="test-session")

agent = Agent(model=bedrock_model, session_manager=session_manager)

With S3SessionManager:

from strands import Agent
from strands.models import BedrockModel
from strands.session.s3_session_manager import S3SessionManager

bedrock_model = BedrockModel(model_id="us.deepseek.r1-v1:0")
session_manager = S3SessionManager(session_id="test-session", bucket="test-bucket")

agent = Agent(model=bedrock_model, session_manager=session_manager)
  1. Send multiple messages and get ValidationException error

Expected Behavior

Should not give error and remember previous messages and continue conversation.

Actual Behavior

Gives error "An error occurred (ValidationException) when calling the ConverseStream operation: User messages cannot contain reasoning content. Please remove the reasoning content and try again."

Additional Context

No response

Possible Solution

I think the FileSessionManager is appending the reasoning generated content as well to the user messages which is leading to this error.

Related Issues

No response

Metadata

Metadata

Assignees

Labels

area-providerRelated to model providersbugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions