-
Notifications
You must be signed in to change notification settings - Fork 344
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
1.5.0
Python Version
3.12.3
Operating System
Linux - Ubuntu
Installation Method
pip
Steps to Reproduce
To reproduce the issue:
- Pick a region that is not US-based (e.g. eu-central-1)
- Follow the steps to deploy the agent using AgentCore startkit - Get started with the Amazon Bedrock AgentCore Runtime starter toolkit
- As the AI agent is deployed regionally, it will override eu-central-1 for the AWS region in
models\bedrock.py
and use US model ID:us.anthropic.claude-sonnet-4-20250514-v1:0
- the
us.anthropic.claude-sonnet-4-20250514-v1:0
is an invalid model ID in EU regions.
Expected Behavior
The hello world example in Get started with the Amazon Bedrock AgentCore Runtime starter toolkit should work out of the box - allowing developers to get started quickly to use Strands SDK with AgentCore.
Actual Behavior
The hello world example in Get started with the Amazon Bedrock AgentCore Runtime starter toolkit fails in non-US regions due to invalid model identifier and the developer has to go through the logs to realize the issue.
Additional Context
Possible Solution
I suggest that we replace those lines
DEFAULT_BEDROCK_MODEL_ID = "us.anthropic.claude-sonnet-4-20250514-v1:0" DEFAULT_BEDROCK_REGION = "us-west-2"
with an internal function that will resolve CRIS model ID for the appropriate AWS partition:
def _get_default_model_for_region(region: str) -> str:
region_models = {
"us-east-1": "us.anthropic.claude-sonnet-4-20250514-v1:0",
"us-west-2": "us.anthropic.claude-sonnet-4-20250514-v1:0",
"eu-central-1": "eu.anthropic.claude-sonnet-4-20250514-v1:0",
"eu-west-1": "eu.anthropic.claude-sonnet-4-20250514-v1:0",
}
return region_models.get(region, "us.anthropic.claude-sonnet-4-20250514-v1:0")
DEFAULT_BEDROCK_REGION = "us-west-2"
and the config update:
self.config = BedrockModel.BedrockConfig(model_id=DEFAULT_BEDROCK_MODEL_ID)
with:
resolved_region = region_name or (boto_session or boto3.Session()).region_name or os.environ.get("AWS_REGION") or DEFAULT_BEDROCK_REGION
self.config = BedrockModel.BedrockConfig(model_id=_get_default_model_for_region(resolved_region))
Related Issues
No response