Memory types · Flagship guide
Long-Term Memory for AI Agents
Long-term memory for AI agents is external storage that persists facts, preferences and conversation history across sessions — implemented with vector databases, knowledge graphs or memory frameworks like Engram, Mem0, Zep and Letta.
LTM pipeline
Definition
What is long-term memory in AI agents?
Long-term memory (LTM) is information an agent retains beyond the current turn or session and can retrieve later.
LTM is distinct from short-term/working memory (the context window), parametric memory (model weights) and RAG (static document corpora). A user who said “I prefer dark mode” last Tuesday should still get dark-mode defaults today — that persistence is LTM.
Motivation
Why agents need long-term memory
Stateless LLMs start every session blank — without LTM, agents repeat questions, cannot personalize and eventually overflow context.
With LTM: personalization across sessions, conversational continuity, knowledge accumulation and lower per-turn token cost because history lives in external stores, not the prompt.
Comparison
Long-term vs short-term memory in agents
| Dimension | Short-term | Long-term |
|---|---|---|
| Scope | Current task / session | Cross-session |
| Location | Context window | Vector DB, graph, KV |
| Volatility | Cleared when session ends | Consolidated, durable |
| Promotion | Extraction → consolidation | — |
Taxonomy
Types of long-term memory in AI agents
LTM splits into episodic, semantic, procedural and user/profile memory — each suited to different agent tasks.
Mechanism
How long-term memory works
The LTM pipeline runs extract → embed → store → retrieve → consolidate → update/forget.
Storage
How long-term memory is stored
Vector databases index embeddings for semantic similarity; knowledge graphs model relationships and time; hybrid stacks combine both.
Engram runs as a vector-native memory layer on Weaviate — extraction, deduplication and retrieval on the same platform, no separate memory store. Mem0 and Supermemory use managed vector APIs. Zep uses temporal knowledge graphs. DIY paths use Redis, Postgres/pgvector or Pinecone.
Frameworks
Long-term memory frameworks and tools
| Need | Framework | Pattern |
|---|---|---|
| Weaviate stack | Engram | Vector-native layer |
| Managed API | Mem0 | Per-user vector memory |
| Temporal facts | Zep | Graph + invalidation |
| Virtual paging | Letta | MemGPT tiering |
| LangGraph | LangMem | Checkpointer + store |
| Knowledge graph | Cognee | Structured KG memory |
Research
Papers on LLM long-term memory
MemGPT (Packer et al., 2023) introduced OS-style paging between context and deep store. MemoryBank explored persistent LLM memory. 2024–2025 surveys catalog agent-memory architectures.
Build
How to build long-term memory
Fastest POC paths: Engram on Weaviate Cloud, Mem0 API, or LangMem on LangGraph. Full implementation covers store selection, extraction, retrieval ranking and eviction.
Evaluation
Long-term memory benchmarks
LOCOMO tests long-conversation recall; LongMemEval tests cross-session recall.
Run both on your domain queries before choosing Engram vs Mem0 vs Zep vs DIY. Good LTM hits high recall at acceptable latency and token cost.
Decision
Long-term memory vs fine-tuning vs RAG
| Approach | Updates | Best for |
|---|---|---|
| LTM | Per-session, dynamic | User facts, preferences |
| Fine-tuning | Batch, slow | Domain style, static knowledge |
| RAG | Document corpus | Org docs, manuals |
FAQ
Frequently asked questions
What is long-term memory in AI?
Long-term memory is information an AI agent persists in external storage across sessions — facts, preferences and conversation history retrievable later. See short-term vs long-term.
What is the difference between short-term and long-term memory in AI agents?
Short-term memory lives in the context window and clears when the session ends. Long-term memory persists in vector DBs, graphs or KV stores across sessions. See short-term vs long-term.
How do LLMs store long-term memory?
LLMs don't store LTM in weights — agents extract facts after each turn, embed them, and write to external stores like vector databases or knowledge graphs. See writing memories.
What is the best long-term memory framework?
Depends on stack: Engram for Weaviate, Mem0 for managed API, Zep for temporal graphs, Letta for paging, LangMem for LangGraph. See best AI memory tools.
Does Claude have long-term memory?
Claude's built-in memory is product-specific. For custom agents, implement external LTM via Engram, Mem0, Zep or your own vector store. See persist conversation memory.
How do I add long-term memory to LangGraph?
Use LangMem for native checkpointer integration, or Mem0/Zep as external APIs. See LangMem and build long-term memory.
Is a vector database the same as long-term memory?
No — a vector DB is the storage backend. LTM is the full pipeline: extract, embed, store, retrieve, consolidate and forget. See vector databases for memory.
What is Weaviate Engram?
Engram is a vector-native memory layer on Weaviate — dynamic writes and retrieval on the same platform without a separate memory store. See Engram explained.
How do I test long-term memory quality?
Run LOCOMO for long-conversation recall and LongMemEval for cross-session recall on your domain queries. See evaluation hub.