Tools · LangChain
LangChain Memory Explained
LangChain memory modules manage conversation history in chains and agents — from simple buffers to summary memory — though many patterns are migrating to LangGraph stores and LangMem for production long-term memory.
Evolution
Types
LangChain memory types
| Module | What it does | When to use |
|---|---|---|
| ConversationBuffer | Stores full chat history | Short sessions only |
| ConversationBufferWindow | Last K messages | Bounded STM |
| ConversationSummaryMemory | Summarizes older messages | Long threads, token savings |
| ConversationSummaryBuffer | Summary + recent messages | Hybrid compression |
| ConversationKGMemory | Knowledge graph from chat | Structured entity memory |
| VectorStoreRetrieverMemory | Retrieve from vector store | LTM with external DB |
Migration
Deprecation and migration to LangGraph
Older chain memory modules are giving way to LangGraph checkpointers + LangMem for production.
LangGraph checkpointers persist graph state (conversation + agent state) across turns. LangMem adds durable long-term memory store with semantic search — LOCOMO J 58.1 in Mem0 paper eval (Chhikara et al., 2025). For cross-session LTM beyond buffers, migrate to LangMem or external frameworks like Engram or Mem0.
Comparison
LangChain memory vs external frameworks
| Need | LangChain buffers | External (Engram, Mem0, Zep) |
|---|---|---|
| Single-session chat | Sufficient | Overkill |
| Cross-session LTM | LangMem or VectorStore | Engram, Mem0, Zep |
| Temporal graph memory | Not native | Zep |
| Managed extraction | LangMem partial | Engram, Mem0 full pipeline |
| LOCOMO benchmark | LangMem 58.1 | Mem0 66.9, Zep 66.0 |
FAQ
Frequently asked questions
Which LangChain memory module should I use?
Short sessions: ConversationBufferWindow. Long threads: ConversationSummaryBuffer. Cross-session LTM: LangMem or VectorStoreRetrieverMemory. Production agents: Engram/Mem0 alongside LangGraph.
Are LangChain memory modules deprecated?
Chain-level memory is being superseded by LangGraph checkpointers + LangMem. Buffers still work for simple chains but migrate for production LTM.
Does LangMem replace LangChain buffers?
LangMem handles durable LTM; buffers still manage in-session history. Use both: buffer for STM, LangMem for cross-session facts. See LangMem explained.
LangChain memory vs Mem0?
LangChain buffers are in-process. Engram and Mem0 are external managed memory APIs that integrate with LangChain agents via HTTP. Engram is Weaviate-native; Mem0 is framework-agnostic.
Can LangChain memory persist across sessions?
Buffers alone: no. LangMem store, VectorStoreRetrieverMemory or external Engram/Mem0 APIs persist across sessions.
Vector memory in LangChain?
VectorStoreRetrieverMemory retrieves from any LangChain vector store integration. For production, compare Engram (Weaviate) or Mem0 managed pipelines.
Production LangChain memory pattern in 2026?
LangGraph agent + checkpointer (STM state) + LangMem or Engram/Mem0 (LTM) + context engineering for token budget. See context engineering.
LlamaIndex equivalent to LangChain memory?
LlamaIndex ChatMemoryBuffer and vector memory modules serve similar roles. See LlamaIndex memory for comparison.