Long-Term Knowledge Storage and Retrieval › Combining Short-Term and Long-Term Memory
Michael BrenndoerferJuly 3, 20252 min read
AI Agent HandbookAll chapters Part 6 of 15Memory and Retrieval - How Agents Remember
Long-Term Knowledge Storage and Retrieval › Combining Short-Term and Long-Term MemoryOne section · Sections in this chapter9 / 13 ↓
Sections in this chapter13
Reading tools Definitions & inline links
Toggle tooltip visibility. Hover over underlined terms for instant definitions.
Article links
Make inline references clickable
Your assistant now has both types of memory:
- Short-term memory: Recent conversation history (from the previous subchapter)
- Long-term memory: Persistent facts and knowledge (this subchapter)
The most effective assistants use both together. Short-term memory provides immediate context for the current conversation. Long-term memory provides background knowledge and personalization.
Here's how they work together:
User: "I'm planning a dinner party next week"
Assistant: [Uses short-term memory to track this conversation]
"That sounds great! What kind of cuisine are you thinking?"
User: "Maybe Italian?"
Assistant: [Retrieves from long-term memory: "User prefers Italian food"]
[Uses short-term memory: knows we're discussing a dinner party]
"Perfect choice! I know you love Italian food. Are you thinking
of going to Luigi's Italian Kitchen, your favorite restaurant,
or cooking at home?"
User: "Cooking at home. Can you suggest a menu?"
Assistant: [Retrieves from long-term memory: "User is allergic to peanuts"]
[Uses short-term memory: dinner party, Italian, cooking at home]
"I'll suggest a menu that avoids peanuts since you're allergic.
How about starting with a Caprese salad, followed by homemade
pasta with marinara sauce, and tiramisu for dessert?"Notice how the assistant seamlessly blends information from both memory systems. It remembers the ongoing conversation (short-term) and applies personal knowledge (long-term) to provide helpful, customized suggestions.