Metadata-Version: 2.5
Name: pydantic-ai-dynamodb-persistence
Version: 0.1.0
Summary: Amazon DynamoDB backend for pydantic-ai-persistence — StepStore + message history for PydanticAI
Project-URL: Homepage, https://github.com/skamalj/pydantic-ai-persistence
Project-URL: Repository, https://github.com/skamalj/pydantic-ai-persistence.git
Author-email: Kamal <skamalj@github.com>
Keywords: agent-memory,agent-state,aws,boto3,chat-history,checkpoint,durable-execution,dynamodb,message-history,persistence,pydantic,pydantic-ai,pydanticai,step-store,storage
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.10
Requires-Dist: boto3
Requires-Dist: pydantic-ai-persistence>=0.1.0
Description-Content-Type: text/markdown

# pydantic-ai-dynamodb-persistence

Amazon DynamoDB backend for [`pydantic-ai-persistence`](https://pypi.org/project/pydantic-ai-persistence/) — a PydanticAI `StepStore` (durable events / snapshots / tool-effect ledger) and message-history store, on DynamoDB.

## Install

```bash
pip install pydantic-ai-dynamodb-persistence
# or via the core extra:
pip install "pydantic-ai-persistence[dynamodb]"
```

**Requires Python 3.10+.**

## Usage

### Durable step persistence

```python
from pydantic_ai import Agent
from pydantic_ai_harness.step_persistence import StepPersistence
from pydantic_ai_dynamodb_persistence import DynamoDBStepStore

store = DynamoDBStepStore(table_name="pai-steps", region_name="us-east-1",
                         max_snapshots_per_run=20)
agent = Agent("openai:gpt-4o", capabilities=[StepPersistence(store=store)])
```

### Message history

```python
from pydantic_ai_dynamodb_persistence import DynamoDBHistoryStore

store = DynamoDBHistoryStore(table_name="pai-history", region_name="us-east-1")
await store.save("conv-1", result.all_messages())
prior = await store.load("conv-1")
```

## API

- `DynamoDBStepStore(table_name, *, region_name=None, boto_session=None, endpoint_url=None, max_snapshots_per_run=None)`
- `DynamoDBHistoryStore(table_name, *, region_name=None, boto_session=None, endpoint_url=None)`
- `DynamoDBAsyncKV(...)` — the underlying `AsyncKV` (offloads sync boto3 to a thread).

Standard boto3 auth (env / profile / SSO / IAM role). Single table, `PK` + `SK` string keys, auto-created (on-demand billing).

> **Note:** PydanticAI's `StepStore` is a beta/experimental harness feature; its API may still change.

## License

MIT
