-
Notifications
You must be signed in to change notification settings - Fork 367
Description
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
source
Python Version
3.13
Operating System
macOS
Installation Method
git clone
Steps to Reproduce
With a local image, attempt to use the following code/tool:
@tool
def tool_with_image_return():
with open(test_image_path, "rb") as image_file:
encoded_image = image_file.read()
return {
"status": "success",
"content": [
{
"image": {
"format": "png",
"filename": test_image_path, # this is the problem!
"source": {"bytes": encoded_image},
}
},
],
}
agent = Agent(tools=[tool_with_image_return])
agent("Run the the tool and analyze the image")
Expected Behavior
The agent runs and succeeds when using Bedrock, or Anthropic, or OpenAI
Actual Behavior
The agent runs and succeeds when using Anthropic or OpenAI, but throws the following error in Bedrock:
E strands.types.exceptions.EventLoopException: Parameter validation failed:
E Unknown parameter in messages[2].content[0].toolResult.content[0].image: "filename", must be one of: format, source../src/strands/event_loop/event_loop.py:248: EventLoopException
Additional Context
This is most likely due to the fact that messages are passed through to the Bedrock provider directly, while for the other providers they're transformed, ignoring extra content.
Possible Solution
Update Bedrock to transform contents in the same way as other providers
-- or --
Make other providers fail in the same way
Related Issues
No response