Skip to content

fix: Remove status field from toolResult for non-claude 3 models in Bedrock model provider #686

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

mehtarac
Copy link
Member

@mehtarac mehtarac commented Aug 17, 2025

Description

Removed the status field from the toolResult block for non claude-3 models in the Bedrock Model provider. This change is motivated by the linked issue. Furthermore, this change is supported by the bedrock documentation where it explicitly states that the status field is only supported in claude 3 models.

Related Issues

#554

Documentation PR

Type of Change

Bug fix

Testing

Script used to test:

from strands import Agent
from strands.models import BedrockModel
from strands_tools import calculator

## change the model-id to any foundation model enabled in your AWS Account
model = BedrockModel(
    model_id="us.anthropic.claude-opus-4-20250514-v1:0", #Or us.writer.palmyra-x4-v1:0
    temperature=0.3,
    streaming=False,
    region_name="us-west-2"
)

agent = Agent(
    model=model,
    tools=[calculator],
    system_prompt="You are an enterprise assistant that helps automate business workflows.",
)

response = agent("tell me what is square root of 64 times 2")
  • 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

Sources:

@mehtarac
Copy link
Member Author

Note:

During my testing, I was able to test with multiple models and I had varying results in comparison with the issue reporter in #554. For example, I was able to get successful tool execution with the status field for models:

  • anthropic.claude-3-7-sonnet-20250219-v1:0
  • anthropic.claude-opus-4-20250514-v1:0

More interestingly, after this change I am seeing the model us.writer.palmyra-x4-v1:0 successfully execute tool calls. However, the model us.writer.palmyra-x5-v1:0 is running into an error below:

An error occurred (ValidationException) when calling the Converse operation: The model returned the following errors: {"body":{},"content_type":"application/json","metering":{"inputTokenCount":0,"outputTokenCount":0},"error":{"error_code":400,"error_msg":"Message at index 2 has empty or missing content"}}

I suspect the issue is that Writer Palmyra X4 and X5 have different tool calling implementations in Amazon Bedrock. Palmyra X4 properly supports tool results and can process toolResult blocks with just toolUseId and content fields, while Palmyra X5 appears to have a different tool calling implementation that fails to process tool results entirely, regardless of the field
structure. This suggests that Palmyra X5 either doesn't fully support the Bedrock Converse API's tool calling workflow or has a bug in its tool result processing that causes it to reject valid tool result messages.

@azaylamba
Copy link

I am able to use the status field with amazon.nova-pro-v1:0 as well.

@mehtarac mehtarac requested a review from a team August 18, 2025 11:06
@samjulien
Copy link
Contributor

samjulien commented Aug 19, 2025

Hey @mehtarac thanks a lot for working on this. Out of curiosity, when did you run these tests with Palmyra X5? We swapped the version of X5 on Bedrock on Friday the 15th at some point. Could you retest if it was on or before that day and see if it changes anything?

EDIT: We were able to reproduce the issue on our side and have RCA'd it. There has been a fix provided upstream to AWS. Once AWS updates the container we should be good with this.

@samjulien
Copy link
Contributor

Hey all, just to update: we've successfully updated Palmyra X5 on Bedrock and are seeing tool calling working as expected. Thank you for the catch on this! We are really hoping to be able to use Palmyra via Bedrock in Strands, so thanks for this.

@mehtarac
Copy link
Member Author

Hey all, just to update: we've successfully updated Palmyra X5 on Bedrock and are seeing tool calling working as expected. Thank you for the catch on this! We are really hoping to be able to use Palmyra via Bedrock in Strands, so thanks for this.

Thank you for the fix @samjulien!!! I'll test the model again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants