AI data · Memory

Agent memory on PostgreSQL and Redis: how to run it in production

Long-term memory in PostgreSQL and short-term memory in Redis or Valkey, run in OSStend's cloud, your cloud account or your data center.

45 minutes with an engineer: we review your workload and sketch the design.

Agent memory is the state an agent keeps between steps and between sessions. Short-term memory holds the current conversation and fits an in-memory store such as Redis or Valkey. Long-term memory holds facts, summaries and checkpoints and fits PostgreSQL, with pgvector for recall by meaning.

160+AceMQ customers
10+Years running these systems
24/7Engineers on call
3Places it runs: our cloud, yours, your data center
Engines we run, on the platforms you already use
  • PostgreSQL
  • MySQL
  • MongoDB
  • Redis
  • Valkey
  • OpenSearch
  • Kafka
  • RabbitMQ
  • AWS
  • Google Cloud
  • Azure
  • Kubernetes
  • OpenShift
  • Prometheus
  • Grafana
  • Datadog
  • Dynatrace
  • Splunk

What goes wrong when agent memory reaches production

In a demo, memory is a Python list. In production it must survive restarts, serve many users at once, forget on request and stay inside your data boundary, and each of those is a data-engineering problem.

Illustrative: plan names and shapes stand in for any provider's menu.
State is lost on restart.
In-process memory disappears when the process does, so long-running agents need a durable checkpoint store.
Memory grows without a limit.
Every conversation adds facts, summaries and embeddings, so retention and pruning need a policy.
One user's memory reaching another.
Memory must be scoped per user or tenant, in the data model and in the vector index.
Personal data.
Memory holds what users said and what the agent inferred. Erasure requests and retention limits apply to it.
Latency in the loop.
An agent reads memory many times per task, so slow lookups slow every step.

The memory pattern: short-term in memory, long-term in PostgreSQL

Split memory by lifetime. Redis or Valkey holds session state that expires, and PostgreSQL holds what must last: checkpoints, facts and vectors for recall by meaning. The split keeps hot reads fast and durable data in a database with backups.

LayerWhat it holdsEngineWhy this engine
Short-term memoryCurrent conversation, scratch state, session contextRedis or ValkeyIn-memory reads and keys that expire on their own
CheckpointsGraph or workflow state saved at each stepPostgreSQLDurable, transactional, restorable. LangGraph has a Postgres checkpoint saver
Long-term factsUser preferences, extracted facts, summariesRelational tables with constraints and per-user scoping
Semantic recallEmbeddings of memories, searched by meaningPostgreSQL with pgvectorVectors beside the memory rows, same backup and access model
Repeat-question cacheStored answers to similar questionsSee semantic caching

Sources: LangGraph Postgres checkpointer, Mem0 pgvector, Letta self-hosting, checked 30 Oct 2026.

Common frameworks already target this layout. LangGraph's documentation provides a Postgres implementation of its checkpoint saver for durable, long-running agents. Mem0 lists pgvector among its supported vector stores. Letta's self-hosting guide says a Postgres database you connect yourself must have the pgvector extension installed. For what the model sees on each turn, and how memory feeds it, see context engineering. To let an agent query the same PostgreSQL safely, see the Postgres MCP server guide.

Sizing and tuning agent memory

Memory grows with the number of users, sessions and stored memories. Size the vector part like any pgvector workload, and set expiry and retention for the rest.

Illustrative shape: real designs start from your metrics.
Memory typeWhat drives growthLever
CheckpointsSteps per run × runs × state sizeRetention window on old checkpoints; prune completed threads on a schedule
Long-term factsUsers × facts per userPer-user caps, summarisation, and deduplication of near-identical facts
Memory vectorsMemories × dimensions (4 × dimensions + 8 bytes each in `vector`)`halfvec`, index choice and recall settings; see pgvector
Short-term sessionsActive sessions × context sizeKey expiry (TTL) and a memory limit with an eviction policy
Multi-tenant isolationTenants sharing one indexList partitioning or separate tables, as the pgvector docs suggest

Source: pgvector README, checked 30 Oct 2026. Retention figures are a policy decision for each organisation.

Retention and privacy for agent memory

Treat agent memory as personal data. Scope every row to a user or tenant, give it a retention period, and make deletion a tested path that reaches the vector index, the checkpoints and the backups.

  • Store a user or tenant identifier on every memory row and filter on it in every query.
  • Delete from the table and from derived data together: the memory row, its embedding and any summary built from it.
  • Set a retention window per memory type and enforce it with a scheduled job.
  • Keep the store inside your own environment so identity, keys and audit logs are yours. See deployment options.
  • Decide how long deleted data may remain in backups, and document it.

Pitfalls documented by the engines and frameworks

Most memory incidents come from scoping and growth rather than from the database itself. These items come from the engine and framework documentation.

A shared approximate index across tenants
lets one tenant's vectors affect another's recall and speed. Partition or use separate tables.
Filtered recall.
A user filter on an approximate index applies after the scan and can return fewer rows. Use iterative scans or partitioning.
Unbounded checkpoints.
A checkpoint saved at every step accumulates quickly for long runs. Retention has to be designed in.
Cache and memory confusion.
A cache may be evicted at any time. Anything the agent must remember belongs in the durable store.
Enterprise only

What OSStend runs, where it runs and who it is not for

OSStend designs, moves and runs PostgreSQL and Redis or Valkey in its own cloud, in your cloud account or co-managed in your data center, so agent memory stays in your environment.

Contact us if

  • Agent memory holds customer data that must stay in your cloud account or data center.
  • You already run PostgreSQL or Redis and want memory in the same estate.
  • You use LangGraph, Mem0, Letta or a custom framework that can use Postgres.
Talk to an engineer

Not a fit if

  • You want a hosted memory API and have no data-residency requirement.
  • The agent is a prototype with no retention or privacy requirements yet.
  • You need a managed agent framework. OSStend runs the data layer, not the agent.

What is agent memory?

Agent memory is the state an AI agent keeps beyond a single model call. Short-term memory covers the current conversation, and long-term memory covers facts, summaries and past runs, often searched by meaning with embeddings.

Can PostgreSQL be used for agent memory?

Yes. LangGraph provides a Postgres checkpoint saver, Mem0 supports pgvector as a vector store, and Letta's self-hosted server uses Postgres with the pgvector extension. PostgreSQL gives durable storage, transactions and point-in-time recovery for memory.

Is agentic memory the same as agent memory?

The two terms are used interchangeably. Both mean the state an AI agent keeps beyond a single model call: short-term memory for the current conversation, and long-term memory for facts, summaries and past runs.

What is a LangGraph checkpointer?

A checkpointer saves a LangGraph agent's state at each step so a run can resume, be inspected or continue a conversation later. The Postgres implementation stores those checkpoints in PostgreSQL tables.

Where does Redis fit in agent memory?

Redis or Valkey suits short-term memory such as session context, because keys can expire automatically and reads come from memory. It also hosts a semantic cache. Durable memory belongs in a database with backups.

How is user data removed from agent memory?

Deletion has to reach every copy: the memory rows, their embeddings, any summaries and the backups, according to a stated retention period. Scoping every row to a user or tenant makes that deletion a query rather than a search.

Talk to an engineer

Talk to an engineer about agent memory

Bring the agent framework, expected users and retention rules. An engineer will help you design the memory layer and decide where it should run.

  • A design sketch for your workload, not a plan menu
  • A zero-downtime cutover path for what you run today
  • A price for that design, after the review
See pricing →

Your request goes to the OSStend team. No newsletter sign-up.

Get a quoteTalk to an engineer
2Engines
3Where should it run?
4What do you need?

Your request goes to the OSStend team. No newsletter sign-up.