Advanced 5 min read Updated Sep 8, 2026

Memory in LangChain

Search for "LangChain memory" and a lot of what comes back - ConversationBufferMemory, ConversationSummaryMemory, and their relatives - is now deprecated. This is the last guide in the series for a reason: it's short precisely because the current answer is "don't reach for LangChain's own memory classes, reach for LangGraph's," and the previous guide in this series already covers that in depth.

What changed

LangChain's original in-process memory classes worked by keeping conversation history in a Python object tied to your chain. They're deprecated as of LangChain 1.0. The replacement isn't a new memory class to swap in - it's a different layer entirely: LangGraph's persistence system, which most new LangChain agents (including anything built with create_agent) now sit on top of by default.

deprecated ConversationBufferMemory deprecated in 1.0 Checkpointer + thread_id current, recommended Conversation state persists

Same goal, different mechanism - persistence moved from an in-process object to LangGraph's checkpoint system.

What to actually use

The full mechanics - checkpointers, thread IDs, resuming a run exactly where it left off - are covered in detail in the LangGraph guide on Memory & Persistence, and the same concepts apply whether you're working in raw LangGraph or in a LangChain agent built with create_agent. In short: compile or configure your agent with a checkpointer, and pass a consistent thread_id for a given conversation so it can pick up where it left off.

from langchain.agents import create_agent
from langgraph.checkpoint.memory import MemorySaver

agent = create_agent(model, tools=[get_weather], checkpointer=MemorySaver())

config = {"configurable": {"thread_id": "user-482"}}
agent.invoke({"messages": [("user", "Remember I'm based in Mumbai.")]}, config)
agent.invoke({"messages": [("user", "What's the weather like today?")]}, config)

That threads together as one ongoing conversation with the same thread_id - the second call has access to what was said in the first, without you managing a message list by hand.

Two different kinds of memory, one distinction worth keeping straight

A checkpointer gives you memory within one thread - one conversation, one ongoing run. If you need an agent to remember something about a user across entirely separate conversations - a stated preference, a fact learned last week - that's a different problem, usually addressed with a long-term memory store (LangChain currently positions its LangMem library alongside LangGraph's own cross-thread store for this) rather than anything tied to a single thread's checkpoint history.

The practical takeaway: if you're starting a project today and see a tutorial reach for ConversationBufferMemory, treat that as a sign the tutorial is out of date - not a sign you're missing something. Start with a checkpointer instead.

That's the series

Between these five guides you've got the core of LangChain: what it actually is and where it hands off to LangGraph, the prompt/model/parser trio you'll chain together constantly, retrieval and RAG, the current way to build a tool-calling agent, and where memory actually lives now. If you haven't yet, the LangGraph 101 guides pick up directly where Tools & Tool-Calling Agents left off.

Share this guide

Was this guide helpful?

Thanks for the feedback!

Want more hands-on AI builds like this?

APA Mastery runs live, practical sessions on working with modern AI tools - not just theory.

See What's On →
← PreviousTools & Tool-Calling Agents