Skip to main content

pydantic-ai-firestore-persistence

Google Firestore backend for pydantic-ai-persistence — a PydanticAI StepStore (durable events / snapshots / tool-effect ledger) and message-history store, on Firestore.

Install

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

Usage

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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pydantic_ai_firestore_persistence-0.1.0.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file pydantic_ai_firestore_persistence-0.1.0.tar.gz.

File metadata

File hashes

Hashes for pydantic_ai_firestore_persistence-0.1.0.tar.gz
Algorithm Hash digest
SHA256 495ce0e29f233dea713e7975f951483cf89039135bab74bdd5e99b6b33c3f792
MD5 43579c8ed7374595f0aa831883e8c8b4
BLAKE2b-256 b7e1ad1bc4e1f54beb149cc28c4d0730165e865cf5b58035b5f8f69c3dc21c22

See more details on using hashes here.

File details

Details for the file pydantic_ai_firestore_persistence-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pydantic_ai_firestore_persistence-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c11be450ea341cb32cd711a6fcdc030e86bd54751efd192a2f092a8ad087b356
MD5 c210bb3167aacc22699f85e062b1a07c
BLAKE2b-256 9db334284a0a3815453b223450c219a38ca3a61fdf5948d999e33dfb743d8f85

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page