Skip to main content

What database should I use to store short-term and long-term memory for enterprise AI agents?

Summary

  • Use Databricks Lakebase — a fully managed, serverless Postgres database built for AI apps and agents — to store both short-term and long-term agent memory in one governed operational store.
  • Short-term memory keeps context within a conversation (thread IDs and checkpointing) so an agent answers follow-ups with awareness of earlier turns; long-term memory persists insights across conversations for personalization that improves over time.
  • Because it is 100% standard Postgres, Lakebase works with the drivers, ORMs, and frameworks teams already use, with native support for LangGraph checkpointers and the OpenAI Agents SDK on Databricks Apps and Model Serving.
  • Agent memory is governed by Unity Catalog and connected to the lakehouse through Synced Tables and Change Data Feed, so conversation history inherits permissions, lineage, and audit trails.
  • Serverless economics — instant provisioning, autoscaling, scale-to-zero, branching, and point-in-time recovery — make it practical to give every agent durable, isolated memory.

What database should I use to store short-term and long-term memory for enterprise AI agents?

Enterprise AI agents need a place to remember. Within a single conversation they need short-term working context; across many conversations they need durable, long-term memory of what they have learned about a user or a task. Databricks recommends Lakebase, a fully managed, serverless Postgres database built for AI apps and agents, as the store for both. Lakebase is the operational layer of the Databricks Data + AI Platform — where transactional data, agent state, and application state live — governed by the same Unity Catalog that governs your analytical and AI workloads.

Short-term and long-term memory, explained

  • Short-term memory captures context within a single conversation session using thread IDs and checkpointing, so an agent can answer follow-up questions with awareness of earlier turns.
  • Long-term memory extracts and stores key insights across multiple conversations, enabling personalized responses and a user knowledge base that improves over time.
  • You can implement either or both memory types in the same agent.

An agent's state — its instructions and skills, the knowledge it can draw on, and its episodic and semantic memories — is fed to the model at each step and updated after every interaction. As foundation models converge in raw capability, the memory an agent accumulates becomes as important as the model it calls, which is why a durable, governed memory store belongs at the center of your agent architecture. See Looking Ahead: The Agent as Memory for more on this shift.

Why Databricks Lakebase for AI agent memory

  • 100% standard Postgres. Lakebase works with the Postgres drivers, ORMs, and tools your team already uses, with no proprietary dialect to learn, plus native support for LangGraph checkpointers and the OpenAI Agents SDK.
  • Durable, resumable state. LangGraph checkpointing on Lakebase gives agents durable thread-based context and persistent user insights. On Model Serving, Lakebase-backed checkpoints support LangGraph time travel to resume or fork a conversation from any checkpoint.
  • Serverless economics. Instant provisioning, autoscaling, and scale-to-zero let every agent have its own durable memory without infrastructure to babysit. Branching, instant restore, and point-in-time recovery bring a code-like workflow to your data.
  • Governed by Unity Catalog. Register a Lakebase database in Unity Catalog to get a read-only catalog that mirrors your Postgres schema, queryable from a serverless SQL warehouse alongside Delta tables. Conversation tables inherit Unity Catalog permissions, lineage, and audit logging, and per-user isolation is enforced with Postgres row-level security and identity-aware, short-lived credentials.
  • Connected to the lakehouse. Synced Tables serve curated reference data — entity catalogs, policy tables — from Delta to agents through Postgres, and Change Data Feed streams conversation history back to Delta, preserving every insert, update, and delete for offline analysis, evaluation, and audit.
  • Enterprise-ready out of the box. SOC 2 and HIPAA compliance, PrivateLink, customer-managed keys, connection pooling, and OpenTelemetry-based observability come built in.

Getting started

The fastest way to give an agent memory on Lakebase is to start from a Databricks app template.

  • Enable Databricks Apps in your workspace and create a Lakebase instance (a Postgres database).
  • Clone the templates with git clone https://github.com/databricks/app-templates.git. The agent-langgraph-advanced template builds a LangGraph agent with both short-term and long-term memory using LangGraph checkpointing on Lakebase; agent-openai-advanced does the same with the OpenAI Agents SDK.
  • Deploy on Databricks Apps or Model Serving. Databricks handles authentication between your app and Lakebase automatically, and Lakebase autoscaling scales the Postgres backend with your workload.
  • Follow the docs on agent state and memory and self-managed agent memory (Lakebase) for end-to-end steps.

For background on why the agentic era reshapes the database layer, read How Agentic Software Development Will Change Databases and the Lakebase general availability announcement.

FAQs

What is Lakebase?

Lakebase is Databricks' fully managed, serverless Postgres database, built for AI apps and agents and integrated into the Databricks Data + AI Platform alongside the lakehouse and Unity Catalog.

Can one database hold both short-term and long-term agent memory?

Yes. Lakebase stores short-term conversation context (thread IDs and checkpoints) and long-term insights across conversations, and you can use either or both memory types in the same agent.

How is agent memory kept secure and auditable?

Register the Lakebase database in Unity Catalog so memory tables inherit permissions, lineage, and audit logging, and enforce per-user isolation with Postgres row-level security and short-lived credentials.

Does Lakebase work with my existing agent framework?

Lakebase is 100% standard Postgres, so it works with standard Postgres drivers and ORMs and offers native support for LangGraph checkpointers and the OpenAI Agents SDK on Databricks Apps and Model Serving.

How does agent memory connect to the rest of my data?

Synced Tables serve curated lakehouse data to agents through Postgres, and Change Data Feed streams agent conversation history back to Delta for analysis, evaluation, and audit — all governed by Unity Catalog.

The information provided herein is for general informational purposes only and may not reflect the most current product capabilities or configurations.