Conversational Memory in LangChain for 2025
James Briggs
Conversational memory allows our chatbots and agents to remember previous interactions within a conversation. Without conversational memory, our chatbots would only ever be able to respond to the last message they received, essentially forgetting all previous messages with each new message.
Naturally, conversations require our chatbots to be able to respond over multiple interactions and refer to previous messages to understand the context of the conversation.
LangChain versions 0.0.x consisted of various conversational memory types. Most of these are due to deprecation, but they still hold value in understanding the different approaches to building conversational memory.
Throughout the video, we will refer to these older memory types and then rewrite them for LangChain v0.3 (the latest version in 2025) using the recommended RunnableWithMessageHistory class. We will learn about:
- ConversationBufferMemory
- ConversationBufferWindowMemory
- ConversationSummaryMemory
- ConversationSummaryBufferMemory
We'll work through each of these memory types in turn and rewrite each one using the RunnableWithMessageHistory class.
š Article and code: https://www.aurelio.ai/learn/langchain-conversational-memory
šš¼ AI Consulting: https://aurelio.ai
š¾ Discord: https://discord.gg/c5QtDB9RAP
Twitter: https://twitter.com/jamescalam LinkedIn: https://www.linkedin.com/in/jamescalam/
#ai #coding #aiagents #langchain
00:00 Conversational Memory in LangChain 01:12 LangChain Chat Memory Types 04:26 LangChain ConversationBufferMemory 08:23 Buffer Memory with LCEL 13:14 LangChain ConversationBufferWindowMemory 16:01 Buffer Window Memory with LCEL 22:32 LangChain ConversationSummaryMemory 25:17 Summary Memory with LCEL 30:12 Token Usage in LangSmith 32:08 Conversation Summary Buffer Memory 34:36 Summary Buffer with LCEL ... https://www.youtube.com/watch?v=EtldFS3JbGs
496425185 Bytes