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

1
Buffers
Legacy chains
LangGraph
2
LangMem
LTM store

Types

LangChain memory types

ModuleWhat it doesWhen to use
ConversationBufferStores full chat historyShort sessions only
ConversationBufferWindowLast K messagesBounded STM
ConversationSummaryMemorySummarizes older messagesLong threads, token savings
ConversationSummaryBufferSummary + recent messagesHybrid compression
ConversationKGMemoryKnowledge graph from chatStructured entity memory
VectorStoreRetrieverMemoryRetrieve from vector storeLTM with external DB

Short-term memory

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.

LangMem explained

Comparison

LangChain memory vs external frameworks

NeedLangChain buffersExternal (Engram, Mem0, Zep)
Single-session chatSufficientOverkill
Cross-session LTMLangMem or VectorStoreEngram, Mem0, Zep
Temporal graph memoryNot nativeZep
Managed extractionLangMem partialEngram, Mem0 full pipeline
LOCOMO benchmarkLangMem 58.1Mem0 66.9, Zep 66.0

Best AI memory tools

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.