You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, different models on Bedrock and other providers have specific requirements and limitations that can cause runtime failures. For example, DeepSeek R1 has issues with reasoningContent in messages that other models like Claude don't have (as seen in PR #652 ). We need a systematic way to handle these model-specific configurations and requirements.
Proposed Solution
No response
Use Case
The system should implement a configuration registry pattern where model-specific behaviors are defined in external configuration files rather than scattered throughout the codebase with if-statements. This approach would be similar to how the SDK currently handles other features (as seen in various issues like #652, #1053, and #713).
The system would use a declarative configuration approach where model capabilities and limitations are defined in configuration files, and a single handler processes these configurations. This keeps the core code clean and maintainable while moving model-specific logic to configuration rather than implementation.
This design would align with the SDK's existing architecture while preventing the proliferation of model-specific conditional statements throughout the codebase, as evidenced by the challenges seen in the DeepSeek reasoning content issue (#652) and other model-specific issues in the repository.
Qwen model has same issue with Deepseek. It rejects messages that include reasoning content. Currently only when using Deepseek model, it filtered out them
Hi, we hit a production bug that's related to this issue and wanted to flag it before opening a PR.
When using Claude Sonnet 5.5 (anthropic.claude-sonnet-5-5), the model occasionally produces an assistant turn containing only a reasoningContent block — no trailing text or toolUse. Strands stores this in agent.messages and the next ConverseStream call fails with:
ValidationException: messages.N: The final block in an assistant message cannot be thinking.
The AWS docs confirm this is valid to handle by omitting thinking blocks from prior turns: "It is only strictly necessary to send back thinking blocks when using tools with extended thinking. Otherwise, you can omit thinking blocks from previous turns." Dropping the incomplete turn is safe — there is no answer content to lose.
The natural fix is the same pattern already used for DeepSeek (PR #652) — in _format_bedrock_messages, after building cleaned_content for an assistant message, skip the message if its last block is reasoningContent:
is_anthropic = "anthropic" in self.config["model_id"].lower() or "claude" in self.config["model_id"].lower()
if (
is_anthropic
and message.get("role") == "assistant"
and cleaned_content
and "reasoningContent" in cleaned_content[-1]
):
continue # drop thinking-only turn, no answer content to lose
We know this is another if model_id special-case that #780 wants to replace with a proper registry. Happy to submit the targeted patch now and update it once the registry lands, or wait if you'd prefer to fold it into #780 directly. Just wanted to flag the production impact before proceeding.
Activity
[-][FEATURE] Bedrock Model Specific Feature Mechanism[/-][+][FEATURE] Model Specific Feature Mechanism[/+]dbschmigelski commentedon Sep 3, 2025
Additional example of model/provider specific logic #630
Strands should know gpt oss must use Converse and automatically use it.
dbschmigelski commentedon Sep 3, 2025
Additional example #686 relating to non-claude models and the inclusion of the status field.
refactor: simplify outputSchema implementation based on PR feedback
refactor: simplify outputSchema implementation based on PR feedback
feat: add optional outputSchema support for tool specifications
matheus-1618 commentedon Sep 22, 2025
Hey, any news on it? Thanks!
YAMABASS80 commentedon Nov 14, 2025
Qwen model has same issue with Deepseek. It rejects messages that include reasoning content. Currently only when using Deepseek model, it filtered out them
https://github.com/strands-agents/sdk-python/blob/8cae18cdc9a70cd892188485c2df47698a17af55/src/strands/models/bedrock.py#L335
For the just workaround, I replace if statement as bellow then it worked.
I don't think it's a good idea at all, but it seems like this is the only option at the moment.
azaylamba commentedon Dec 10, 2025
@dbschmigelski We should also consider #1241 while implementing this.
dbschmigelski commentedon Jan 27, 2026
Marking another use case https://github.com/strands-agents/sdk-python/pull/1438/changes
dbschmigelski commentedon Feb 5, 2026
Adding another note, that now that we have the TS repository, this should probably be created in a new repository as a single source of truth.
ishayHudl commentedon Oct 22, 2026
Hi, we hit a production bug that's related to this issue and wanted to flag it before opening a PR.
When using Claude Sonnet 5.5 (anthropic.claude-sonnet-5-5), the model occasionally produces an assistant turn containing only a reasoningContent block — no trailing text or toolUse. Strands stores this in agent.messages and the next ConverseStream call fails with:
ValidationException: messages.N: The final block in an assistant message cannot be
thinking.The AWS docs confirm this is valid to handle by omitting thinking blocks from prior turns: "It is only strictly necessary to send back thinking blocks when using tools with extended thinking. Otherwise, you can omit thinking blocks from previous turns." Dropping the incomplete turn is safe — there is no answer content to lose.
The natural fix is the same pattern already used for DeepSeek (PR #652) — in _format_bedrock_messages, after building cleaned_content for an assistant message, skip the message if its last block is reasoningContent:
We know this is another if model_id special-case that #780 wants to replace with a proper registry. Happy to submit the targeted patch now and update it once the registry lands, or wait if you'd prefer to fold it into #780 directly. Just wanted to flag the production impact before proceeding.