> ## Documentation Index
> Fetch the complete documentation index at: https://agno-v2-codex-docs-audit-20260719-0149.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# DynamoDB for Agent

> Store agent sessions and history in DynamoDB with DynamoDb.

`DynamoDb` stores an Agent's sessions and run history in DynamoDB.

## Usage

Install dependencies:

```shell theme={null}
uv pip install agno boto3 openai
```

Pass a configured DynamoDB client as `db_client`. Otherwise, provide `region_name`, `aws_access_key_id`, and `aws_secret_access_key` directly or through the `AWS_REGION`, `AWS_ACCESS_KEY_ID`, and `AWS_SECRET_ACCESS_KEY` environment variables.

On first use, `DynamoDb` creates missing tables with provisioned capacity. The client or credentials must allow table creation and read/write operations.

```python dynamo_for_agent.py theme={null}
from os import getenv

from agno.agent import Agent
from agno.db.dynamo import DynamoDb

AWS_ACCESS_KEY_ID = getenv("AWS_ACCESS_KEY_ID")
AWS_SECRET_ACCESS_KEY = getenv("AWS_SECRET_ACCESS_KEY")

db = DynamoDb(
    region_name="us-east-1",
    aws_access_key_id=AWS_ACCESS_KEY_ID,
    aws_secret_access_key=AWS_SECRET_ACCESS_KEY,
)

agent = Agent(db=db, add_history_to_context=True)

agent.print_response("How many people live in Canada?")
agent.print_response("What is their national anthem called?")
```

## Parameters

<Snippet file="db-dynamodb-params.mdx" />
