LLM_PROVIDER="bedrock" and a few AWS environment variables โ Cognee talks to Bedrock natively through its built-in Bedrock adapter.
Prerequisites
- AWS account with Bedrock model access enabled for the models you want to use
- Python 3.10+
- Cognee installed with the AWS extra (see below)
Setup (Native Provider)
1. Install Cognee with the AWS extra
2. Configure your .env
Set LLM_PROVIDER="bedrock" and provide your AWS details:
3. Choose an authentication method
The Bedrock adapter supports four ways to authenticate (it uses the first one it finds, in this order):- API key โ generate a Bedrock API key on AWS and set it in
LLM_API_KEY. - AWS credentials โ set
AWS_ACCESS_KEY_IDandAWS_SECRET_ACCESS_KEY(you can leaveLLM_API_KEYunset). If you use temporary credentials (an access key ID starting withASIA...), you must also setAWS_SESSION_TOKEN. - AWS profile โ set
AWS_PROFILE_NAMEto use a profile from your AWS credentials file (the standard boto3 credential chain). - Ambient IAM role โ set none of the above. Cognee then sends no credentials at all and boto3 resolves them from the default AWS credential chain, so an EC2 instance profile, ECS task role, or EKS IRSA service-account role with Bedrock permissions is enough.
AWS_REGION is applied with any of these methods, and AWS_BEDROCK_RUNTIME_ENDPOINT optionally overrides the Bedrock runtime endpoint.
Running without explicit credentials
Explicit credentials are optional:bedrock is one of the providers for which Cognee does not require LLM_API_KEY, so leaving it unset does not raise a missing-key error. On AWS-hosted infrastructure, LLM_PROVIDER, LLM_MODEL, and AWS_REGION are enough to authenticate to Bedrock:
LLM_API_KEY, AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY, or AWS_PROFILE_NAME values are left in your .env or shell โ any of them will be used instead of the instance role.
Embeddings are configured separately: the default embedding provider is OpenAI and falls back to LLM_API_KEY for its key, so with no keys set you still need to configure an embedding provider before remember() works.
Model naming
Use the Bedrock model ID directly inLLM_MODEL โ no bedrock/ prefix is needed because the provider is already set to bedrock. Model IDs are region-scoped, so the prefix depends on your region (eu. for Europe, us. for the US, etc.):
- Amazon Nova:
eu.amazon.nova-lite-v1:0,us.amazon.nova-pro-v1:0 - Anthropic Claude:
anthropic.claude-3-5-sonnet-20240620-v1:0 - OpenAI GPT-OSS:
openai.gpt-oss-120b-1:0
The exact model ID (and whether it needs a region prefix) varies by AWS region. Check the AWS Bedrock model catalog for the ID that applies to your region.
Usage Example
Optional: Using a LiteLLM Proxy
A LiteLLM proxy is not required for Bedrock. Use this approach only if you already run a LiteLLM proxy to centralize model routing, credentials, or logging across multiple services. Install and configure the proxy:config.yaml:
http://localhost:4000 by default):
For detailed proxy setup, see the official LiteLLM Bedrock tutorial.
Troubleshooting
- Authentication Errors: Verify your AWS credentials, region, and that Bedrock model access is enabled in the AWS console. For temporary (
ASIA...) credentials, ensureAWS_SESSION_TOKENis set alongsideAWS_ACCESS_KEY_IDandAWS_SECRET_ACCESS_KEYโ a session token is not used on its own. - Model Not Found: Confirm the model ID matches your region exactly (including any
eu./us.prefix). - Rate Limit / Throttling Errors (
BedrockException): When Bedrock returns throttling errors (e.g.Too many requests,ThrottlingException), Cognee automatically retries them with exponential backoff (up to 5 retries). If errors persist, request a quota increase in the AWS console, or enable client-side rate limiting by settingLLM_RATE_LIMIT_ENABLED="true"and tuningLLM_RATE_LIMIT_REQUESTSto stay within your accountโs requests-per-minute limit. See Rate Limiting for details. - Connection Issues (proxy only): Check that the LiteLLM proxy is running on the expected port.
LITELLM_LOG="DEBUG" in your .env.
Resources
LLM Providers
Cognee LLM ConfigurationFull reference for configuring AWS Bedrock and other LLM providers.
AWS Bedrock Models
Available ModelsBrowse all Bedrock models and find the model ID for your region.