What is the best memory layer for AI agents?
Summary
- The best memory layer for AI agents keeps two stores: short-term session state for the conversation in progress, and long-term memory for facts, preferences and decisions that should carry into future conversations.
- Long-term memory has to be searchable by meaning and by keyword, partitioned per user by trusted application code, and consolidated over time so duplicate and conflicting entries don't pile up.
- Treat the store as the security boundary. A per-user key separates memories for retrieval, but strict tenant isolation needs separate stores.
- On Databricks, agent sessions and agent memory are managed stores that run on Lakebase, and memory pipelines distill past conversations into long-term memory. All three are in Beta.
- Agent memory works with agents built on any framework, including LangGraph, through the AgentKit SDK, the REST API or the Agent Bricks CLI.
What is the best memory layer for AI agents?
The best memory layer is a managed, governed pair of stores: one for the state of the current interaction and one for durable knowledge the agent should recall in later, unrelated conversations. It should retrieve memories by meaning and keyword, scope them to the right user from trusted code, and clean itself up as facts change. On Databricks, that layer is agent sessions plus agent memory, both run on Lakebase, with memory pipelines that build long-term memory from conversation history. All three are in Beta today.
An agent without memory makes users repeat themselves. An agent with ungoverned memory can surface one user's details in another user's conversation.
What is an agent memory layer?
A memory layer is the storage and retrieval system that lets an agent hold context. The Databricks docs on agent memory and sessions separate two kinds of state:
- Session state is scoped to one interaction, most often the ordered transcript of messages, tool calls and results. The agent reads it at the start of a turn and appends to it as it runs.
- Long-term memory is scoped to a subject, such as a user, team or project. It holds stable preferences, past decisions and ongoing work that still matter in a future conversation.
Databricks memory research maps these to episodic memory (the raw record of each session) and derived memory (facts and workflows distilled from sessions), with an offline "dreaming" process that turns one into the other.
Key capabilities to evaluate
| Capability | Why it matters |
|---|---|
| Separate short-term and long-term stores | Transcripts and durable facts have different lifetimes and retrieval patterns |
| Durable, managed storage | Conversations survive restarts and you don't operate a database yourself |
| Hybrid retrieval | Keyword and semantic matching both find the right memory for a natural-language query |
| Per-user partitioning from trusted code | The model should never choose whose memory it reads or writes |
| A clear security boundary | Tenants stay isolated even if application code has a bug |
| Consolidation and forgetting | Overlapping entries get merged, stale ones removed, and users can ask to be forgotten |
| Framework independence | Memory outlives any one agent framework or harness |
How Databricks approaches agent memory
Agent sessions (Beta) give agents a durable, framework-agnostic store for session state. A session store holds sessions keyed by actor_id and an optional session_id. Each session holds ordered, immutable items, such as messages, tool calls or a serialized LangGraph graph. You can resume, fork and nest sessions for sub-agents.
Agent memory (Beta) stores long-term memory in Lakebase, and Databricks manages storage, indexing and search. Each memory entry has free-form content, a short description for retrieval, an actor_id, a filesystem-like path and an optional session_id. Search combines full-text (BM25) and semantic matching over content and description, and listing filters by path prefix.
from databricks.sdk import WorkspaceClient
from databricks_agentkit import AgentKitClient
client = AgentKitClient(WorkspaceClient())
memory_store = client.memory_stores.create("support-agent-memory")
memory_store.add(
actor_id="user-123",
path="/preferences/communication.md",
content="Prefers email over phone.",
description="User 123 communication preferences",
)
results = memory_store.search(actor_id="user-123", query="communication preferences", limit=10)
Memory pipelines (Beta) distill sessions into memories on demand or on a schedule. Each run executes as a serverless job, calls its distillation model through Unity Gateway, and merges new facts into topic-based entries per actor. Pipelines are designed to keep explicit facts, corrections and durable domain knowledge, and to skip secrets, values that change over time and details the agent can look up with its tools.
Security model. Set actor_id from the verified end-user identity, never from the model. The docs are direct that actor_id "is not an access control": any principal that can reach a store can read every entry, so create a separate store per tenant when you need strict isolation, and grant an agent's service principal access with grant_permission.
Any framework. The databricks-agentbricks package includes the AgentKit SDK plus adapters for LangGraph, and the REST API under /api/2.0/agents/memory-stores works from any language. If you build with the Agent Bricks CLI (Beta), agentbricks deploy creates the declared memory store and grants the deployed agent access.
FAQs
What's the difference between agent memory and agent sessions?
Sessions hold one interaction's history so the agent can continue it. Memory holds durable facts about a user or team that the agent recalls in separate conversations. Deleting a session doesn't delete memory.
Can I use Databricks agent memory with LangGraph?
Yes. The databricks_agentkit.langgraph module provides a checkpointer() backed by a session store and memory_tools() that let the agent recall, remember, forget and list memories for one actor.
Is agent memory generally available?
No. Agent memory, agent sessions and memory pipelines are in Beta, even though Agent Bricks itself is GA. An earlier Unity Catalog-governed memory store and self-managed Lakebase memory are now legacy approaches.
Should my agent write memories itself or use a pipeline?
Either, or both. Memory tools let the model save facts mid-conversation. A pipeline works after the fact with all of an actor's conversations in view, so it can catch facts the agent missed and keep memory consolidated.
The information provided herein is for general informational purposes only and may not reflect the most current product capabilities or configurations.