> ## Documentation Index
> Fetch the complete documentation index at: https://phidatainc-agui.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# AWS Bedrock

> Use AWS Bedrock foundation models with Agno agents.

Use AWS Bedrock to access various foundation models on AWS. Manage your access to models [on the portal](https://us-east-1.console.aws.amazon.com/bedrock/home?region=us-east-1#/model-catalog).

See all the [AWS Bedrock foundational models](https://docs.aws.amazon.com/bedrock/latest/userguide/models-supported.html). Not all Bedrock models support all features. See the [supported features for each model](https://docs.aws.amazon.com/bedrock/latest/userguide/conversation-inference-supported-models-features.html).

<Note>
  For async support with AWS Bedrock, you need to install `aioboto3`:

  ```bash theme={null}
  uv pip install aioboto3
  ```
</Note>

We recommend experimenting to find the best-suited model for your use-case. Here are some general recommendations:

* For a Mistral model with generally good performance, look at `mistral.mistral-large-2402-v1:0`.
* You can play with Amazon Nova models. Use `amazon.nova-pro-v1:0` for general purpose tasks.
* For Claude models, see our [Claude integration](/models/providers/cloud/aws-claude/overview).

## Authentication

AWS Bedrock supports three authentication methods:

### Method 1: Access Key and Secret Key (Recommended)

Set your `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`, and `AWS_REGION` environment variables.

Get your keys from [here](https://us-east-1.console.aws.amazon.com/iam/home?region=us-east-1#/home).

<CodeGroup>
  ```bash Mac theme={null}
  export AWS_ACCESS_KEY_ID=***
  export AWS_SECRET_ACCESS_KEY=***
  export AWS_REGION=***
  ```

  ```bash Windows theme={null}
  setx AWS_ACCESS_KEY_ID ***
  setx AWS_SECRET_ACCESS_KEY ***
  setx AWS_REGION ***
  ```
</CodeGroup>

Or pass them directly to the model:

```python theme={null}
from agno.agent import Agent
from agno.models.aws import AwsBedrock

agent = Agent(
    model=AwsBedrock(
        id="mistral.mistral-large-2402-v1:0",
        aws_access_key_id="your-access-key",
        aws_secret_access_key="your-secret-key",
        aws_region="us-east-1"
    )
)
```

### Method 2: SSO Authentication

Use SSO authentication by leveraging your current AWS profile's authentication:

```python theme={null}
from agno.agent import Agent
from agno.models.aws import AwsBedrock

agent = Agent(
    model=AwsBedrock(
        id="mistral.mistral-large-2402-v1:0",
        aws_sso_auth=True,
        aws_region="us-east-1"
    )
)
```

### Method 3: Boto3 Session

Use a pre-configured boto3 Session for advanced authentication scenarios (including SSO, role assumption, etc.):

```python theme={null}
from boto3.session import Session
from agno.agent import Agent
from agno.models.aws import AwsBedrock

# Create a boto3 session with your preferred authentication
session = Session(
    aws_access_key_id="your-access-key",
    aws_secret_access_key="your-secret-key",
    region_name="us-east-1"
)

agent = Agent(
    model=AwsBedrock(
        id="mistral.mistral-large-2402-v1:0",
        session=session
    )
)
```

<Note>
  The authentication methods are checked in this order: Session → API Key → Access Key/Secret Key. The first available method will be used.
</Note>

## Example

Use `AwsBedrock` with your `Agent`:

<CodeGroup>
  ```python agent.py theme={null}
  from agno.agent import Agent
  from agno.models.aws import AwsBedrock

  agent = Agent(
      model=AwsBedrock(id="mistral.mistral-large-2402-v1:0"),
      markdown=True
  )

  # Print the response on the terminal
  agent.print_response("Share a 2 sentence horror story.")
  ```
</CodeGroup>

<Note> View more examples [here](/models/providers/cloud/aws-bedrock/usage/basic-stream). </Note>

## Parameters

| Parameter               | Type                       | Default                             | Description                                                                                                                                                               |
| ----------------------- | -------------------------- | ----------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `id`                    | `str`                      | `"mistral.mistral-small-2402-v1:0"` | The specific model ID used for generating responses.                                                                                                                      |
| `name`                  | `str`                      | `"AwsBedrock"`                      | The name identifier for the AWS Bedrock agent.                                                                                                                            |
| `provider`              | `str`                      | `"AwsBedrock"`                      | The provider of the model.                                                                                                                                                |
| `aws_access_key_id`     | `Optional[str]`            | `None`                              | The AWS access key ID for authentication. Can also be set via `AWS_ACCESS_KEY_ID` environment variable.                                                                   |
| `aws_secret_access_key` | `Optional[str]`            | `None`                              | The AWS secret access key for authentication. Can also be set via `AWS_SECRET_ACCESS_KEY` environment variable.                                                           |
| `aws_region`            | `Optional[str]`            | `None`                              | The AWS region to use for API requests. Can also be set via `AWS_REGION` environment variable.                                                                            |
| `session`               | `Optional[Session]`        | `None`                              | A boto3 Session object for advanced authentication scenarios (SSO, role assumption, etc.).                                                                                |
| `aws_sso_auth`          | `Optional[bool]`           | `False`                             | Removes the need for an access and secret access key by leveraging the current profile's authentication.                                                                  |
| `max_tokens`            | `Optional[int]`            | `None`                              | The maximum number of tokens to generate in the response.                                                                                                                 |
| `temperature`           | `Optional[float]`          | `None`                              | The sampling temperature to use, between 0 and 2. Higher values like 0.8 make the output more random, while lower values like 0.2 make it more focused and deterministic. |
| `top_p`                 | `Optional[float]`          | `None`                              | The nucleus sampling parameter. The model considers the results of the tokens with top\_p probability mass.                                                               |
| `stop_sequences`        | `Optional[List[str]]`      | `None`                              | A list of sequences where the API will stop generating further tokens.                                                                                                    |
| `request_params`        | `Optional[Dict[str, Any]]` | `None`                              | Additional parameters for the request, provided as a dictionary.                                                                                                          |
| `client_params`         | `Optional[Dict[str, Any]]` | `None`                              | Additional client parameters for initializing the `AwsBedrock` client, provided as a dictionary.                                                                          |
| `client`                | `Optional[AwsClient]`      | `None`                              | A pre-configured AWS client instance.                                                                                                                                     |

`AwsBedrock` is a subclass of the [Model](/reference/models/model) class and has access to the same params.
