Skip to main content

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 single claims table with composite indices on common filter combinations (project, agent, run_id, category).
  • PostgresVectorStore — semantic search over a vectors table with a pgvector HNSW index (vector_cosine_ops). Cosine distance is converted to clamped [0, 1] similarity at the SQL boundary per the locked VectorStore contract.

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"} — every put / supersede runs inside an asyncpg transaction.
  • Vector: {"native_ann"} is declared only after init_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.

Metadata

Release files for agentforge-memory-postgres 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for agentforge-memory-postgres 0.4.0
File Size Uploaded Provenance Actions
agentforge_memory_postgres-0.4.0.tar.gz 22.5 kB With provenance Details for agentforge_memory_postgres-0.4.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for agentforge-memory-postgres 0.4.0
File Interpreter ABI Platform Actions
agentforge_memory_postgres-0.4.0-py3-none-any.whl Python 3 none any Details for agentforge_memory_postgres-0.4.0-py3-none-any.whl

Total release size: 43.0 kB

Release files / agentforge_memory_postgres-0.4.0.tar.gz

Download URL agentforge_memory_postgres-0.4.0.tar.gz
Size 22.5 kB
Tags Source
SHA-256 checksum
How to use checksums
2b004c4479f3eddabbec9d0c44d284973d124cf179d6252324b1b95e4798fc53
BLAKE2b-256 checksum
How to use checksums
26f59a6d5df239c283fb24ab569ffa9dbe74bf40af8473c35d30c5141705b755
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 24, 2026.

Transparency log

Release files / agentforge_memory_postgres-0.4.0-py3-none-any.whl

Download URL agentforge_memory_postgres-0.4.0-py3-none-any.whl
Size 20.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b17955e676cdab5157d3324ae63895946c0ed140f1c481f7740c51181f269f82
BLAKE2b-256 checksum
How to use checksums
fe01a1c2cb1a87f6ad81f74c8a68dc45751cfb35020442e79ec187ba54ce8e6b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 24, 2026.

Transparency log

Security for agentforge-memory-postgres 0.4.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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for agentforge_memory_postgres-0.4.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 24, 2026.

Transparency log

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page