WOLBΛRG

PostgreSQL Backend

Shared PostgreSQL storage with connection pooling, JSONB metadata, and optional pgvector.

What is it?

A StorageProvider implementation backed by PostgreSQL via the optional pg peer. Same public API as SQLite.

Why does it exist?

Teams that already run Postgres, or need multi-process / multi-host readers and writers against one database.

How does it work?

npm install pg
import { postgres } from "wolbarg";

storage: postgres(process.env.DATABASE_URL!)
// or
storage: postgres({
  connectionString: process.env.DATABASE_URL!,
  maxPoolSize: 10,
})

Features:

  • Connection pooling
  • JSONB metadata + GIN index
  • pgvector when the extension is available (BYTEA + cosine fallback otherwise)

Install the optional pg peer before using postgres().

API parity

Both backends implement the same StorageProvider contract: insert, batch insert, update, delete, vector search, metadata listing, history, transactions, and migrations. Switch storage by changing one constructor option.

When should it be used?

Use PostgreSQL when multiple application instances share memory, or when you need central backups and ops. Use SQLite when the agent is single-node and file-based storage is enough.