Postgres + pgvector-backed MemoryStore and VectorStore for AgentForge
Project description
agentforge-memory-postgres
Postgres + pgvector-backed
MemoryStore and VectorStore for the AgentForge framework.
What this is
Sister package to agentforge-memory-sqlite. Same locked contracts,
same conformance suites — but backed by Postgres with asyncpg for
real-world scale, multi-writer concurrency, and managed-database
guarantees (RDS, Neon, Supabase, etc.).
PostgresMemoryStore— claim audit log over a singleclaimstable with composite indices on common filter combinations (project, agent,run_id,category).PostgresVectorStore— semantic search over avectorstable with a pgvector HNSW index (vector_cosine_ops). Cosine distance is converted to clamped[0, 1]similarity at the SQL boundary per the lockedVectorStorecontract.
Both pass agentforge_core.testing.run_memory_conformance and
run_vector_conformance against a real Postgres (gated on
RUN_LIVE_POSTGRES=1 in CI; always on locally via docker compose).
Usage
from agentforge_memory_postgres import PostgresMemoryStore, PostgresVectorStore
dsn = "postgresql://postgres:postgres@localhost:5432/agentforge"
async with PostgresMemoryStore.from_dsn(dsn) as memory:
await memory.init_schema() # idempotent
...
async with PostgresVectorStore.from_dsn(dsn, dimensions=1024) as vectors:
await vectors.init_schema() # provisions HNSW index
...
init_schema() is opt-in (idempotent CREATE TABLE / EXTENSION / INDEX IF NOT EXISTS). Skip it for read-only workloads or when the
schema is managed externally; required before first write for full
correctness.
Local development
docker compose -f docker-compose.dev.yml up -d
RUN_LIVE_POSTGRES=1 \
POSTGRES_URL=postgresql://postgres:postgres@localhost:5432/agentforge \
uv run pytest packages/agentforge-memory-postgres/tests/integration -v
The compose file ships pgvector/pgvector:pg16, which bundles
Postgres 16 with the pgvector extension preinstalled.
Capabilities
- Memory:
{"transactions"}— everyput/supersederuns inside an asyncpg transaction. - Vector:
{"native_ann"}is declared only afterinit_schema()provisions the HNSW index. Without bootstrap the driver still works (sequential cosine scan), but it doesn't claim ANN — the capability vocabulary is honest per ADR-0009.
Project details
Release history Release notifications | RSS feed
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 agentforge_memory_postgres-0.2.3.tar.gz.
File metadata
- Download URL: agentforge_memory_postgres-0.2.3.tar.gz
- Upload date:
- Size: 22.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.12 {"installer":{"name":"uv","version":"0.11.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dc097829ae01ae76db370769f1b7accdccee95abf817a2e982f84204985a3908
|
|
| MD5 |
6c496d35aeff237baef7a36766d98f52
|
|
| BLAKE2b-256 |
3d2f91c5dff4232ab7cfd5e0c8d9c0bbf32ea7f936c30d993159a840a058c5e5
|
File details
Details for the file agentforge_memory_postgres-0.2.3-py3-none-any.whl.
File metadata
- Download URL: agentforge_memory_postgres-0.2.3-py3-none-any.whl
- Upload date:
- Size: 20.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.12 {"installer":{"name":"uv","version":"0.11.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
efb8e056336a49bbc98a700c461ddaeb629bf5e5ac5ff52f2d390eef25915f0e
|
|
| MD5 |
69fc24e696e80f3348914eb6d7cc1870
|
|
| BLAKE2b-256 |
4b34361574e6c66febe4a642d05557efee17378c3400c82fb672af66061abaf0
|