Metadata-Version: 2.5
Name: pydantic-ai-firestore-persistence
Version: 0.1.0
Summary: Google Firestore 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,chat-history,checkpoint,durable-execution,firestore,gcp,google-cloud,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: google-cloud-firestore
Requires-Dist: pydantic-ai-persistence>=0.1.0
Description-Content-Type: text/markdown

# pydantic-ai-firestore-persistence

Google Firestore 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 Firestore.

## Install

```bash
pip install pydantic-ai-firestore-persistence
# or:  pip install "pydantic-ai-persistence[firestore]"
```

## Usage

```python
from pydantic_ai import Agent
from pydantic_ai_harness.step_persistence import StepPersistence
from pydantic_ai_firestore_persistence import FirestoreStepStore

store = FirestoreStepStore(
    project_id="my-gcp-project",
    root_collection="pai_persistence",
    max_snapshots_per_run=20,
)
agent = Agent("openai:gpt-4o", capabilities=[StepPersistence(store=store)])
```

`FirestoreHistoryStore(project_id=…)` provides `save`/`load` message history.
Authentication uses Application Default Credentials (`gcloud auth application-default login`).

## Data model

Each partition key maps to a document `<root>/<enc(PK)>` whose `items` subcollection
holds one doc per sort key: `<enc(SK)>` → `{SK, data}`. Doc ids are URL-encoded
(Firestore ids can't contain `/`); the raw `SK` is a field so prefix/range queries
work within a subcollection without extra indexes.

> **Note:** PydanticAI's `StepStore` is a beta/experimental harness feature.

## License

MIT
