Agent Memory
Short-term, Long-term, RAG
The Problem: Every time you start a new chat, AI forgets everything. It doesn't remember your preferences, past conversations, or important context. It's like talking to someone with amnesia every single time.
The Solution: Give AI a Notebook
Agent memory is like giving an assistant a notebook where they write down important things. Next time you talk, they can check their notes. Short-term memory lives inside the context window, while long-term memory is often stored in a vector database and retrieved on demand using RAG.
Think of it like a personal assistant with a notebook:
- 1. Short-term memory: "You mentioned 3 items earlier in this conversation"
- 2. Long-term memory: "Last month you said you prefer morning meetings"
- 3. Episodic memory: "Remember when we worked on Project X together?"
- 4. Semantic memory: "Your company uses React and TypeScript"
Types of Agent Memory
- Conversation buffer: Keep the whole chat history (simple but limited)
- Summary memory: Compress old conversations into summaries
- Vector store: Search through past conversations by meaning
- Entity memory: Track facts about specific people, projects, etc.
Fun Fact: Human memory isn't perfect either! We summarize, forget details, and sometimes misremember. AI memory systems often mimic these patterns — keeping what's important and compressing the rest. The goal isn't perfect recall, it's useful recall.
Try It Yourself!
Explore the interactive demo below to see how different memory types work. Watch how the agent retrieves and uses stored information to maintain context across conversations.
Try it yourself
Interactive demo of this technique
Answer a question about a previous conversation: "What budget did I mention earlier?"
Unfortunately, I don't have information about your previous messages. Could you clarify which budget you mean?
Yes, I remember! Two days ago, while discussing the website redesign project, you mentioned a budget of $50,000. Would you like to discuss allocating this budget or update the amount?
An agent with memory persists key facts across sessions. Without memory an LLM cannot reference previous conversations — every request starts from scratch.
Create a free account to solve challenges
3 AI-verified challenges for this lesson
This lesson is part of a structured LLM course.
My Learning Path