pydantic-ai-cosmosdb-persistence
Azure CosmosDB backend for pydantic-ai-persistence — a PydanticAI StepStore (durable events / snapshots / tool-effect ledger) and message-history store, on CosmosDB.
Install
pip install pydantic-ai-cosmosdb-persistence
# or: pip install "pydantic-ai-persistence[cosmosdb]"
Usage
from pydantic_ai import Agent
from pydantic_ai_harness.step_persistence import StepPersistence
from pydantic_ai_cosmosdb_persistence import CosmosDBStepStore
store = CosmosDBStepStore(
endpoint="https://<acct>.documents.azure.com:443/",
key="<key>",
database_name="pai",
container_name="steps",
max_snapshots_per_run=20,
)
agent = Agent("openai:gpt-4o", capabilities=[StepPersistence(store=store)])
CosmosDBHistoryStore(endpoint=…, key=…, database_name=…, container_name=…) provides save/load message history.
Data model
A container partitioned by /PK; each item is {id, PK, SK, data} (the id is a URL-encoded SK since Cosmos ids can't contain # / \ ?; the raw SK is a field for range queries). Database and container are auto-created (key-based auth).
Note: PydanticAI's
StepStoreis a beta/experimental harness feature.
License
MIT
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pydantic_ai_cosmosdb_persistence-0.1.0.tar.gz.
File metadata
- Download URL: pydantic_ai_cosmosdb_persistence-0.1.0.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.14.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5cdcc2866da9b88da42f8cd21e7d4e5e4438a24a9ed31b339699c76358e824d5
|
|
| MD5 |
17afed4c87ad850f0771c2826c679a35
|
|
| BLAKE2b-256 |
2f3f90b61fc316d980bb29afd7a652b20cb635e3cffa401845941053c79072d3
|
File details
Details for the file pydantic_ai_cosmosdb_persistence-0.1.0-py3-none-any.whl.
File metadata
- Download URL: pydantic_ai_cosmosdb_persistence-0.1.0-py3-none-any.whl
- Upload date:
- Size: 3.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.14.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9cecfbb74bfab335caa12d3eeb1f909f41e69044b81eb663a53728950568c505
|
|
| MD5 |
49f38521e2305043d00a987150e5eaeb
|
|
| BLAKE2b-256 |
ac98a11a941f2f698d14f510d1aaba6103df02e4600896e74f5a690275cbee44
|