Every agent resets by default — memory is what you add deliberately. This is consistently the layer that separates a demo from something that feels like it actually remembers you.
What Is It?
Memory lets agents remember prior turns, user facts, and retrieved docs across sessions.
Short-term lives in the context window; long-term uses databases and embeddings.
Child pages cover compaction, caching, and persistent stores.
Why Should I Care?
Demo agents feel smart with memory; production agents fail without eviction and privacy rules.
Memory bugs leak data across users — design tenancy early.
Real World Analogy
Short-term memory is the sticky note on your monitor; long-term memory is the filing cabinet across the hall — agents need both on purpose.
Visual Mental Model
context window (short)
+
vector/DB store (long)Beginner Explanation
Agents reset every session unless you add memory. This hub splits short-term (context, compaction) and long-term (vectors, structured stores).
Smallest Possible Example
HISTORY = ["user: hi", "assistant: hello"]
LONG_TERM = {"user_id": "prefs"}
print(len(HISTORY), LONG_TERM.keys())Common Mistakes
❌ Dumping entire chat logs into every prompt.
You blow token budgets and leak irrelevant noise.
❌ One global memory bucket for all users.
Partition by user/tenant ID always.
❌ No deletion path for GDPR requests.
Long-term memory needs erase APIs.
Real Project Example
ChatGPT memory features and Notion AI workspace context follow these patterns.
Support copilots at Zendesk-scale store ticket summaries in vector stores.
Build This Mini Project
Sketch what should be short-term vs long-term for a fake tutoring bot; write max token budget for each.
Interview Question
Short-term vs long-term agent memory?
Short-term is conversation context within window limits, managed via trimming/compaction; long-term persists facts or embeddings across sessions in external stores with retrieval.
Key Takeaways
- Memory is designed, not automatic.
- Hub links short vs long chapters.
- Tenant isolation is mandatory.
- Plan compaction and deletion.
YouTube learning
Core concepts from video walkthroughs:


