Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Chapter 5: Memory Systems

🧩 "An Agent without memory starts from scratch every conversation. Memory systems allow Agents to 'remember' the past and provide truly personalized experiences."


Chapter Overview

Memory systems are the key that distinguishes "ordinary chatbots" from "true personal assistants." This chapter introduces three types of memory: short-term memory (conversation history), long-term memory (vector databases), and working memory (Scratchpad), and builds a personal assistant Agent with memory in a hands-on project.

Chapter Goals

After completing this chapter, you will be able to:

  • ✅ Understand the role and applicable scenarios of three memory types
  • ✅ Implement conversation history management and window trimming
  • ✅ Use vector databases to build long-term memory
  • ✅ Build a complete personal assistant Agent with memory

Chapter Structure

SectionContentDifficulty
5.1 Why Do Agents Need Memory?The value and challenges of memory⭐⭐
5.2 Short-Term Memory: Conversation History ManagementSliding window, summary compression⭐⭐
5.3 Long-Term Memory: Vector DatabasesChromaDB, similarity search⭐⭐⭐
5.4 Working Memory: Scratchpad PatternRecording the reasoning process⭐⭐⭐
5.5 Hands-on: Personal Assistant with MemoryComplete system implementation⭐⭐⭐⭐

⏱️ Estimated Study Time

Approximately 90–120 minutes (including hands-on exercises)

💡 Prerequisites

  • Completed Chapter 4 (Tool Calling)
  • Familiar with Python lists and dictionary operations
  • Intuitive understanding of "vectors" (no linear algebra background required)

🔗 Learning Path

Prerequisites: Chapter 4: Tool Calling

Recommended Next Steps:

🚀 Extended Projects

ProjectDescriptionStars
supermemoryA memory and context engine for the AI era. Supports automatic fact extraction, user profile building, forgetting-curve-style memory decay, and hybrid search (RAG + Memory). Ranked #1 on three major benchmarks: LongMemEval, LoCoMo, and ConvoMem. Provides API, MCP service, and LangChain/LangGraph integration.17.5k+

Next section: 5.1 Why Do Agents Need Memory?