pydantic-ai-postgres-memory
A PostgreSQL MemoryStore for the PydanticAI harness Memory capability, built from a connection URL. The harness already ships a transactional PostgresMemoryStore that takes a caller-owned asyncpg pool; this package wraps it so it drops into Memory(store=...) like the other pydantic-ai-*-memory backends, creating and owning the pool for you.
pip install pydantic-ai-postgres-memory
from pydantic_ai import Agent
from pydantic_ai_harness.memory import Memory
from pydantic_ai_postgres_memory import PostgresMemoryStoreFromUrl
store = PostgresMemoryStoreFromUrl("postgresql://user:pass@host:5432/db", table="agent_memory")
agent = Agent("anthropic:claude-sonnet-5", deps_type=Deps,
capabilities=[Memory(store=store, namespace=lambda ctx: ctx.deps.user_id)])
How it works
- Delegates every call to the upstream
pydantic_ai_harness.memory.PostgresMemoryStore, so the compare-and-swap and operation-receipt semantics are exactly the reference ones: each write or delete runs in one transaction with a version sequence and an{table}_operationsreceipt table. Schema is created on first use. - The asyncpg pool is created lazily on the running event loop and kept per loop, because asyncpg pools are loop-bound and agents are frequently driven from several loops (
run_syncper call, workers, tests). Passpool=to reuse a pool you own instead;aclose()closes the owned pool for the current loop. searchis the harness's bounded lexical search over the scope's files.
Docs: https://skamalj.github.io/agentstate-reducer/ · part of pydantic-ai-memory
License
MIT
Metadata
Release files for pydantic-ai-postgres-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 | Provenance | Actions |
|---|---|---|---|---|
| pydantic_ai_postgres_memory-0.1.0.tar.gz | 3.6 kB | Without provenance | Details for pydantic_ai_postgres_memory-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pydantic_ai_postgres_memory-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for pydantic_ai_postgres_memory-0.1.0-py3-none-any.whl |
Total release size: 7.5 kB
Release files / pydantic_ai_postgres_memory-0.1.0.tar.gz
| Download URL | pydantic_ai_postgres_memory-0.1.0.tar.gz |
|---|---|
| Size | 3.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6602320e27e91a92a26b3f6e585d3b09687d358c221889927ed1c30e17b527bb
|
|
BLAKE2b-256 checksum How to use checksums |
718b925d0c7ada5c8449d37c1962ea4539416cef05091b7e73a6e6d8831089e4
|
| 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_postgres_memory-0.1.0-py3-none-any.whl
| Download URL | pydantic_ai_postgres_memory-0.1.0-py3-none-any.whl |
|---|---|
| Size | 3.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
58d72c00b9a0c208cde196cb3bfa7d4165e0e2648fb7662a51a40337ec024c00
|
|
BLAKE2b-256 checksum How to use checksums |
ef5a9117040ac9285f761e6302eb874959fce2d0203edbfa4f991322fb6bbe6e
|
| 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}
|
Security for pydantic-ai-postgres-memory 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.