Skip to content

Strands Agents SDK Power - Bedrock API key incorrect environment variable #37

@heichow

Description

@heichow

The environment variable of Bedrock API key is AWS_BEARER_TOKEN_BEDROCK, ref: https://docs.aws.amazon.com/bedrock/latest/userguide/api-keys-use.html

Successful case:

python -c "
import os
os.environ['AWS_BEARER_TOKEN_BEDROCK'] = 'XXXXXXXXXXXX'
os.environ['AWS_REGION'] = 'us-east-1'
from strands import Agent
agent = Agent()
agent('Hello')
"

Hello! How are you doing today? Is there anything I can help you with?

Failed case:

python -c "
import os
os.environ['AWS_BEDROCK_API_KEY'] = 'XXXXXXXXXXXX'
os.environ['AWS_REGION'] = 'us-east-1'
from strands import Agent
agent = Agent()
agent('Hello')
"

ERROR: File "/Library/Frameworks/Python.framework/Versions/3.14/lib/python3.14/site-packages/botocore/auth.py", line 422, in add_auth raise NoCredentialsError()
botocore.exceptions.NoCredentialsError: Unable to locate credentials

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions