Skip to main content

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 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.

Project details


Download files

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

Source Distribution

agentforge_memory_postgres-0.3.0.tar.gz (22.3 kB view details)

Uploaded Source

Built Distribution

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

agentforge_memory_postgres-0.3.0-py3-none-any.whl (20.3 kB view details)

Uploaded Python 3

File details

Details for the file agentforge_memory_postgres-0.3.0.tar.gz.

File metadata

File hashes

Hashes for agentforge_memory_postgres-0.3.0.tar.gz
Algorithm Hash digest
SHA256 cfc76c8a99cbb237c3b1e5f9e7ec8c2d55fec355e89fc8c77be6b77c5ba598fb
MD5 92c542385815f32df63b49494a732aa8
BLAKE2b-256 11ffd7632d63c7d382616d662b8431c43bca898af8d4df5b6da71e5391d2f2e2

See more details on using hashes here.

Provenance

The following attestation bundles were made for agentforge_memory_postgres-0.3.0.tar.gz:

Publisher: release.yml on Scaffoldic/agentforge-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file agentforge_memory_postgres-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for agentforge_memory_postgres-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 35338280b9221192dc796098a32b00bfc6fc6c69f15b872b5f41964e0ad8fe55
MD5 890817268038032e78290320ac814b56
BLAKE2b-256 0d739a1c308baf862cf3ab507d2e476e83e172190b589a61d0725902f3e05c98

See more details on using hashes here.

Provenance

The following attestation bundles were made for agentforge_memory_postgres-0.3.0-py3-none-any.whl:

Publisher: release.yml on Scaffoldic/agentforge-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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