Examples
Runnable example apps that show pgmem end to end.
Working code you can run and read. Each example lives in the
repo and points at
your own Postgres (with the schema applied) —
set DB_URL and go.
Session walk-through — every tier, no keys
examples/voice_session_demo.py
Walks one "voice call" through all five tiers, runs the promotion worker, and prints claim-derived projections being refreshed — using deterministic, self-contained providers (a hashing embedder + a rule-based LLM), so it runs with no API keys and no model downloads.
DB_URL=postgresql://user:pass@host:5432/db uv run python examples/voice_session_demo.pySwap the stand-in providers for real ones (OpenAILLM / an embedder)
and the pgmem code is identical. Best starting point for seeing the whole model move.
Deciding what to remember — the ClaimPolicy seam
examples/memory_policy_litmus.py
The canonical reference for the events-vs-state
rule as your code: a ClaimPolicy that routes current state to live context and
uses the default authority/evidence policy for durable event claims.
DB_URL=postgresql://user:pass@host:5432/db uv run python examples/memory_policy_litmus.pyPairs with the guide Decide what to remember.
Full voice agent — LiveKit + Ollama
A complete realtime voice assistant (an aged-care agent) built on LiveKit with a local Ollama model and pgmem for memory — a monorepo with app, infra, and observability wiring. The reference for the stateless-worker pattern in a real deployment.
See its README.md and ARCHITECTURE.md in the repo to run it, and the guide
LiveKit / voice agents for how pgmem slots in.
Related
- Your first memory-backed agent — build one from zero
- Connect a model provider — swap in real models
- LiveKit / voice agents — the voice integration pattern