How To Implement Short Term Memory Using LangGraph

CampusX · Beginner ·🤖 AI Agents & Automation ·5mo ago
In this video, we continue the Agentic AI using LangGraph series by learning how to implement short-term memory in LLM-based systems. The video explains why LLMs are stateless, how short-term memory works using conversation history, and how to implement it in LangGraph using checkpointers and thread IDs. You’ll then learn why in-memory storage is not suitable for production and how to persist conversation state using PostgreSQL with Docker. Finally, the video covers the context window problem in LLMs and teaches practical techniques like trimming, deletion, and summarization to handle long conversations safely and reliably in real-world agentic AI systems. Code -https://github.com/campusx-official/memory-in-llms Notes: https://learnwith.campusx.in/s/store/courses/YouTube%20Notes 📱 Grow with us: CampusX' LinkedIn: https://www.linkedin.com/company/campusx-official CampusX on Instagram for daily tips: https://www.instagram.com/campusx.official My LinkedIn: https://www.linkedin.com/in/nitish-singh-03412789 Discord: https://discord.gg/PsWu8R87Z8 E-mail us at support@campusx.in ⌚Chapters⌚ 00:00 - Introduction and video overview 00:01:38 - Recap: LLMs are stateless and memory fundamentals 00:03:33 - Short-term memory concept and checkpointers in LangGraph 00:04:46 - Implementing short-term memory with threads and in-memory storage 00:09:22 - Limitations of in-memory memory storage 00:11:16 - Need for persistence in production systems 00:12:38 - Setting up PostgreSQL using Docker 00:15:54 - Implementing persistent memory with PostgreSQL checkpointer 00:17:36 - Verifying persistence after application restart 00:19:30 - Context window and context overflow problem 00:21:38 - Trimming strategy to control token limits 00:31:19 - Limitations of trimming 00:32:03 - Summarization concept for long conversations 00:35:24 - Deletion and its role in summarization 00:40:12 - Implementing summarization workflow in LangGraph 00:49:26 - Testing summarization behavior in practice 00:52
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Related AI Lessons

AI Disguised as INSONIA: how generative AI redefines suspense
Learn how INSONIA uses generative AI to redefine suspense by integrating agents with personas and conflicting objectives into the fiction itself
Dev.to AI
A IA Disfarçada de INSONIA: como a IA generativa redefine o suspense
Learn how generative AI redefines suspense in interactive fiction like INSONIA, where AI agents with persona, memory, and conflicting objectives create a unique experience
Dev.to AI
Building a Production-Grade MCP Memory Server: Lessons from MindCore
Learn how to build a production-grade MCP memory server to overcome AI amnesia with circuit breakers, hybrid search, and a novel boundary algorithm
Dev.to AI
Designing Send Limits for AI Agents
Learn to design send limits for AI agents to prevent spam and protect users, and understand the importance of quota design in autonomous senders
Dev.to AI

Chapters (16)

Introduction and video overview
1:38 Recap: LLMs are stateless and memory fundamentals
3:33 Short-term memory concept and checkpointers in LangGraph
4:46 Implementing short-term memory with threads and in-memory storage
9:22 Limitations of in-memory memory storage
11:16 Need for persistence in production systems
12:38 Setting up PostgreSQL using Docker
15:54 Implementing persistent memory with PostgreSQL checkpointer
17:36 Verifying persistence after application restart
19:30 Context window and context overflow problem
21:38 Trimming strategy to control token limits
31:19 Limitations of trimming
32:03 Summarization concept for long conversations
35:24 Deletion and its role in summarization
40:12 Implementing summarization workflow in LangGraph
49:26 Testing summarization behavior in practice
Up next
These Students Are Building the Future of AI
Scaler School of Technology
Watch →