Introduction
State, memory, and continuity for long-running AI agents.
pgmem is Postgres-native memory for AI agents. It keeps what the agent is doing now separate from what should outlive the conversation — so a restart, a scale-out, or a crashed worker never loses the thread. It's all Postgres: no new datastore to run, no vector service to sync.
Start here
Getting Started
Install pgmem and run your first memory-backed agent.
Concepts
The five-tier model, the events-vs-state boundary, and how a turn flows. Read this before building.
Guides
Task-focused recipes: integrating pgmem, deciding what to remember, using live state.
Reference
The exact API and configuration surface.
Examples
Runnable example apps that show pgmem end to end.
How it works
Every turn reads memory to build the prompt, then writes memory after the reply. Only the read rides the response path, so the agent stays fast. What you store is a deliberate choice: events the agent owns become memory; current state another system owns is fetched live, never copied.
New to pgmem? Read Events vs state and How a turn flows first — they're the two ideas the rest of the docs build on. Then skim Pitfalls & footguns.