pgmem

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

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.

On this page