Skip to content

Add additional exception information for common bedrock errors #290

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

Merged
merged 1 commit into from
Jun 25, 2025

Conversation

zastrowm
Copy link
Member

@zastrowm zastrowm commented Jun 25, 2025

Description

We've received customer confusion regarding some of the errors when attempting to run on bedrock. To help customers understand what's going wrong, add region and model information to exceptions coming out of the bedrock provider & point them to our docs when possible.

Semi-related to #238

Note: Python's add_note method was added in 3.11 even though we support 3.10 so this is conditional on being on python 3.11+. I figured that's okay since this is an extra feature of strands.

Related Issues

#238

Documentation PR

strands-agents/docs/pull/102

Type of Change

New feature

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

Manual Testing:

When you don't have access to the model:

AccessDeniedException: An error occurred (AccessDeniedException) when calling the ConverseStream operation: You don't have access to the model with the specified model ID.
└ Bedrock region: us-west-2
└ Model id: us.anthropic.claude-3-7-sonnet-20250219-v1:0
└ For more information see https://strandsagents.com/user-guide/concepts/model-providers/amazon-bedrock/#model-access-issue

When on-demand throughput isn’t supported:

ValidationException: An error occurred (ValidationException) when calling the ConverseStream operation: Invocation of model ID anthropic.claude-3-7-sonnet-20250219-v1:0 with on-demand throughput isn’t supported. Retry your request with the ID or ARN of an inference profile that contains this model.
└ Bedrock region: us-west-2
└ Model id: anthropic.claude-3-7-sonnet-20250219-v1:0
└ For more information see https://strandsagents.com/latest/user-guide/concepts/model-providers/amazon-bedrock/#on-demand-throughput-isnt-supported

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.

We've received customer confusion regarding some of the errors when attempting to run on bedrock. To help customers understand what's going wrong, add region and model information to exceptions coming out of the bedrock provider & point them to our docs when possible.

Semi-related to strands-agents#238
Copy link
Member

@Unshure Unshure left a comment

Choose a reason for hiding this comment

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

What is the alternative to add_note? Could we extend the error message with this same information?

@zastrowm
Copy link
Member Author

What is the alternative to add_note? Could we extend the error message with this same information?

Followed up offline - I considered this but given that this is an "extra" thing + we have docs for this, I figured it'd be better not to reinevent the wheel of what python is doing and just to conditionally do this.

If we see enough usage of this and still get questions related, we can re-evaluate

@zastrowm zastrowm merged commit 7cfbad3 into strands-agents:main Jun 25, 2025
12 checks passed
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.

2 participants