> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cognee.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# AWS Bedrock Integration

> Use AWS Bedrock models with Cognee's native Bedrock provider.

AWS Bedrock is a **first-class LLM provider** in Cognee. You configure it directly with `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

```bash theme={null}
pip install cognee[aws]
```

### 2. Configure your `.env`

Set `LLM_PROVIDER="bedrock"` and provide your AWS details:

```dotenv theme={null}
LLM_PROVIDER="bedrock"
LLM_MODEL="eu.amazon.nova-lite-v1:0"
LLM_API_KEY="<your_bedrock_api_key>"
LLM_MAX_COMPLETION_TOKENS="16384"
AWS_REGION="<your_aws_region>"
AWS_ACCESS_KEY_ID="<your_aws_access_key_id>"
AWS_SECRET_ACCESS_KEY="<your_aws_secret_access_key>"
AWS_SESSION_TOKEN="<your_aws_session_token>"

# Optional parameters
# AWS_BEDROCK_RUNTIME_ENDPOINT="bedrock-runtime.eu-west-1.amazonaws.com"
# AWS_PROFILE_NAME="<your_aws_profile_name>"
```

### 3. Choose an authentication method

The Bedrock adapter supports three ways to authenticate (it uses the first one it finds, in this order):

1. **API key** — generate a Bedrock API key on AWS and set it in `LLM_API_KEY`.
2. **AWS credentials** — set `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` (you can leave `LLM_API_KEY` unset). If you use temporary credentials (an access key ID starting with `ASIA...`), you must also set `AWS_SESSION_TOKEN`.
3. **AWS profile** — set `AWS_PROFILE_NAME` to use a profile from your AWS credentials file (the standard boto3 credential chain).

`AWS_REGION` is applied with any of these methods, and `AWS_BEDROCK_RUNTIME_ENDPOINT` optionally overrides the Bedrock runtime endpoint.

### Model naming

Use the Bedrock model ID directly in `LLM_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`

<Info>
  The exact model ID (and whether it needs a region prefix) varies by AWS region. Check the [AWS Bedrock model catalog](https://docs.aws.amazon.com/bedrock/latest/userguide/models-supported.html) for the ID that applies to your region.
</Info>

## Usage Example

```python theme={null}
import cognee
import asyncio


async def main():
    # Remember text with Cognee
    await cognee.remember(
        "Natural language processing (NLP) is an interdisciplinary subfield of computer science and information retrieval."
    )

    # Query the knowledge graph
    results = await cognee.recall("Tell me about NLP")

    # Display the results
    for result in results:
        print(result)


if __name__ == '__main__':
    asyncio.run(main())
```

## 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.

<Warning>
  Use **LiteLLM Proxy** (not the SDK) for this approach. The proxy runs as a server that Cognee connects to over HTTP.
</Warning>

Install and configure the proxy:

```bash theme={null}
pip install litellm[proxy]
```

Create a `config.yaml`:

```yaml theme={null}
model_list:
  - model_name: bedrock-claude-3-5-sonnet
    litellm_params:
      model: bedrock/anthropic.claude-3-5-sonnet-20240620-v1:0
      aws_access_key_id: your_aws_id
      aws_secret_access_key: your_aws_key
      aws_region_name: your_aws_region_name
      drop_params: true
```

Start the proxy (it runs on `http://localhost:4000` by default):

```bash theme={null}
litellm --config config.yaml
```

Then point Cognee at the proxy by treating it as an OpenAI-compatible endpoint:

```dotenv theme={null}
LLM_PROVIDER="openai"
LLM_MODEL="litellm_proxy/bedrock-claude-3-5-sonnet"
LLM_ENDPOINT="http://localhost:4000"
LLM_API_KEY="doesn't matter"
```

<Note>
  For detailed proxy setup, see the [official LiteLLM Bedrock tutorial](https://docs.litellm.ai/docs/providers/bedrock).
</Note>

## Troubleshooting

1. **Authentication Errors**: Verify your AWS credentials, region, and that Bedrock model access is enabled in the AWS console. For temporary (`ASIA...`) credentials, ensure `AWS_SESSION_TOKEN` is set **alongside** `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` — a session token is not used on its own.
2. **Model Not Found**: Confirm the model ID matches your region exactly (including any `eu.`/`us.` prefix).
3. **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 setting `LLM_RATE_LIMIT_ENABLED="true"` and tuning `LLM_RATE_LIMIT_REQUESTS` to stay within your account's requests-per-minute limit. See [Rate Limiting](/setup-configuration/llm-providers) for details.
4. **Connection Issues (proxy only)**: Check that the LiteLLM proxy is running on the expected port.

To enable verbose LLM logging, set `LITELLM_LOG="DEBUG"` in your `.env`.

## Resources

<CardGroup cols={2}>
  <Card title="LLM Providers" href="/setup-configuration/llm-providers" icon="brain">
    **Cognee LLM Configuration**

    Full reference for configuring AWS Bedrock and other LLM providers.
  </Card>

  <Card title="AWS Bedrock Models" href="https://docs.aws.amazon.com/bedrock/latest/userguide/models-supported.html" icon="cloud">
    **Available Models**

    Browse all Bedrock models and find the model ID for your region.
  </Card>
</CardGroup>
