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

# AWS Bedrock

> Learn how to use AWS Bedrock with Agno.

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

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/aws-claude).

## Authentication

**For enhanced flexibility**, Agno supports multiple authentication configuration mechanisms, including:

* **Pre-configured boto3 client**
* **Custom boto3 sessions**
* **Hardcoded environment variables** (credentials stored in environment variables)

## AwsBedrock class

The `AwsBedrock` class offers a [set of parameters](#parameters) that enable you to interact with the Bedrock Converse API.

### Examples

#### Using Hardcoded environment variables

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>

And then 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>

#### Using a pre-configured boto3 client or session

To enhance flexibility with boto3 clients, you can instantiate a custom boto3 client configured for the `bedrock-runtime` API or a boto3 session and pass it to the `AwsBedrock` class.

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

  # Create the config with 4 retries (5 max_attempts = 1 initial + 4 retries)
  my_config = Config(
      retries={
          'max_attempts': 5,
          'mode': 'standard'
      }
  )

  boto3_client = boto3.client('bedrock-runtime', config=my_config)

  agent = Agent(
      model=AwsBedrock(
          id="anthropic.claude-3-5-sonnet-20240620-v1:0", 
          client=boto3_client
      ),
      markdown=True
  )

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

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

  boto3_session = boto3.session.Session(
      region_name='us-west-2',  # Explicit AWS region
      profile_name='my-profile',  # Named AWS credential profile
  )

  agent = Agent(
      model=AwsBedrock(
          id="anthropic.claude-3-5-sonnet-20240620-v1:0", 
          session=boto3_session
      ),
      markdown=True
  )

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

#### Passing additional parameters to the Bedrock API

By default, Agno allows you to configure the `inferenceConfig` parameter when using the `bedrock-runtime` API.

To further customize your requests, you can include [additional parameters](https://boto3.amazonaws.com/v1/documentation/api/1.37.0/reference/services/bedrock-runtime/client/converse.html) - such as `guardrailConfig`, `performanceConfig`, and more - by passing them through the `request_params` field in the `AwsBedrock` class.

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

  request_params = {
      "performanceConfig": {
          "latency": "optimized"
      }
  }

  agent = Agent(
      model=AwsBedrock(
          id="us.anthropic.claude-3-7-sonnet-20250219-v1:0", 
          request_params=request_params
      ),
      markdown=True
  )

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

<Note> View more examples [here](/examples/models/aws/bedrock). </Note>

## Parameters

<Snippet file="model-aws-params.mdx" />

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