AI agent memory
Memory lets AI agents remember information from earlier in the conversation or from previous conversations. This lets agents provide context-aware responses and build personalized experiences over time. Use Databricks Lakebase, a fully-managed Postgres OLTP database, to manage conversation state and history.
Requirements
- Enable Databricks Apps in your workspace. See Set up your Databricks Apps workspace and development environment.
- A Lakebase instance, see Create and manage a database instance.
Short-term vs. long-term memory
Short-term memory captures context in a single conversation session while long-term memory extracts and stores key information across multiple conversations. You can build your agent with either or both types of memory.

Short-term memory | Long-term memory |
|---|---|
Capture context in a single conversation session using thread IDs and checkpointing Maintain context for follow-up questions within a session | Automatically extract and store key insights across multiple sessions Personalize interactions based on past preferences Build a knowledge base about users that improves responses over time |
Get started
To create an agent with memory on Databricks Apps, clone a pre-built app template and follow the development workflow described in Author an AI agent and deploy it on Apps. The following templates demonstrate how to add short-term and long-term memory to agents using popular frameworks.
LangGraph
Use the following LangGraph-based templates to add memory to your agent. These templates use LangGraph's built-in checkpointing with Lakebase for durable state management.
-
Short-term memory: Clone the agent-langgraph-short-term-memory template to build a LangGraph agent that maintains conversation context within a session. The template uses thread IDs and LangGraph checkpointing backed by Lakebase to persist conversation state.
Bashgit clone https://github.com/databricks/app-templates.git
cd app-templates/agent-langgraph-short-term-memory -
Long-term memory: Clone the agent-langgraph-long-term-memory template to build a LangGraph agent that remembers key information across multiple conversations. The template automatically extracts and stores user insights in Lakebase, enabling personalized interactions over time.
Bashgit clone https://github.com/databricks/app-templates.git
cd app-templates/agent-langgraph-long-term-memory
OpenAI Agents SDK
Use the following OpenAI Agents SDK-based template to add memory to your agent. This template uses the OpenAI Agents SDK sessions with Lakebase for durable state management.
-
Short-term memory: Clone the agent-openai-agents-sdk-short-term-memory template to build an agent using the OpenAI Agents SDK with automatic conversation history management. The template persists session data to Lakebase, enabling stateful multi-turn conversations without manual memory handling.
Bashgit clone https://github.com/databricks/app-templates.git
cd app-templates/agent-openai-agents-sdk-short-term-memory
Deploy and query your agent
After you configure your agent with memory, follow the steps in Author an AI agent and deploy it on Apps to run your agent locally, evaluate it, and deploy it to Databricks Apps.