pydantic-ai-firestore-memory
A Google Firestore MemoryStore for the PydanticAI harness Memory capability — the per-user Markdown notebook the harness injects before every model call and lets the model write through write_memory, on a shared, durable collection.
pip install pydantic-ai-firestore-memory
from pydantic_ai import Agent
from pydantic_ai_harness.memory import Memory
from pydantic_ai_firestore_memory import FirestoreMemoryStore
store = FirestoreMemoryStore(project_id="my-project", collection="agent_memory")
agent = Agent("anthropic:claude-sonnet-5", deps_type=Deps,
capabilities=[Memory(store=store, namespace=lambda ctx: ctx.deps.user_id)])
Authentication uses Application Default Credentials (gcloud auth application-default login).
How it works
- One collection: a document per memory file (
kind: "file",path,content,version,operation_id) and per operation receipt (kind: "op"). No index setup needed. - Compare-and-swap: create, replace and delete each run in a Firestore transaction that reads the document, checks the harness
version, then writes; Firestore aborts and retries on contention, so a stale version raisesMemoryConflictErrorand never overwrites. - Operation receipts are reserved transactionally, completed after the mutation, dropped if it fails — durable-execution replays return the original result; a reused id with different arguments raises
MemoryOperationConflictError. searchis the harness's bounded lexical search (SearchableMemoryStore);list_pathsis a range query onpath.
Docs: https://skamalj.github.io/agentstate-reducer/ · part of pydantic-ai-memory
License
MIT
Metadata
Release files for pydantic-ai-firestore-memory 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pydantic_ai_firestore_memory-0.1.0.tar.gz | 3.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pydantic_ai_firestore_memory-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 7.4 kB
Release files / pydantic_ai_firestore_memory-0.1.0.tar.gz
| Download URL | pydantic_ai_firestore_memory-0.1.0.tar.gz |
|---|---|
| Size | 3.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
376355127f12abe36521c3075e97dfe29f2e7e31cceb9d9eedcf6b64445696e9
|
|
BLAKE2b-256 checksum How to use checksums |
bd5c0224d97fd7c670b08707761f8d0a69d33464cf102d6b647da554b340ba23
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.23 {"installer":{"name":"uv","version":"0.11.23","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / pydantic_ai_firestore_memory-0.1.0-py3-none-any.whl
| Download URL | pydantic_ai_firestore_memory-0.1.0-py3-none-any.whl |
|---|---|
| Size | 3.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
54831326935d542c0de4578ab307e0f028238c5ea7b96a4904a4bc3633a7a147
|
|
BLAKE2b-256 checksum How to use checksums |
6b0805158c8775da3e1345d53d7d52c454e89971e0533dee7a96dd3bb19e16ee
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.23 {"installer":{"name":"uv","version":"0.11.23","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|