@monorch/ai/postgres
Durable Checkpointer, ThreadMemory, and MemoryStore adapters over any pg-compatible client. pg is an optional peer dependency.
Import
import.ts
typescript
import {
ensureMonorchSchema,
postgresCheckpointer,
postgresThreads,
postgresStore,
} from "@monorch/ai/postgres";
import pg from "pg";
const pool = new pg.Pool({ connectionString: process.env.DATABASE_URL });
await ensureMonorchSchema(pool);Constructors
- ensureMonorchSchema(db, opts?)
- Create tables if missing (checkpoints, thread messages, KV). Safe on boot.
- postgresCheckpointer(db, opts?)
- Durable graph checkpointer with
put,get, andlisthistory. - postgresThreads(db, opts?)
- Durable agent
ThreadMemory. - postgresStore(db, opts?)
- Durable namespaced
MemoryStore.
Keywords / options
- SqlQueryable
- Minimal
query(text, values?)surface. Satisfied bypg.Pool/Client, or a test stand-in. - PostgresAdapterOptions
- checkpointsTable?, threadsTable?, kvTable? (validated identifiers; defaults
monorch_*).
Guides: Checkpoints, Memory.