NirDiamant/Agent_Memory_Techniques
Agent memory for LLMs: 30 runnable Jupyter notebooks covering conversation buffers, vector stores, knowledge graphs, episodic and semantic memory, MemGPT, Mem0, Letta, Zep, Graphiti, LoCoMo benchmarks, and production patterns.
🧠 Agent Memory Techniques – What This Repo Is
A hands‑on learning resource for anyone building LLM‑powered agents that need to remember things.
The repository contains 30 fully runnable Jupyter notebooks that demonstrate the most common (and some cutting‑edge) memory patterns used in modern LLM agents—from simple conversation buffers to production‑grade frameworks like Mem0, Letta, Zep and Graphiti. Each notebook is self‑contained, can be opened in Google Colab, and shows the exact code you would use to plug the technique into your own agent.
Why “agent memory” matters
- LLMs have a limited context window. Without a memory strategy, an agent forgets everything after a few turns.
- Real‑world agents need to persist knowledge across sessions, users, and even different tasks (e.g., personal assistants, customer‑support bots, autonomous planners).
- The repo groups the 30 techniques into six families so you can quickly pick the right tool for your problem:
- Short‑term – keep recent turns cheap and fast.
- Long‑term – store facts, entities, graphs, episodic logs, etc.
- Cognitive architectures – layered, hierarchical, or reflective memory systems.
- Retrieval & routing – decide what to recall and when.
- Frameworks – ready‑made libraries (Mem0, Letta, Zep, Graphiti).
- Evaluation & production – benchmarking, monitoring, and deployment patterns.
What you’ll find inside
| Section | Techniques (notebook links) | What you learn |
|---|---|---|
| Short‑term | 01‑05 – Conversation Buffer, Sliding Window, Summary, Summary Buffer, Token Buffer | Managing the context window, token budgeting, on‑the‑fly summarisation. |
| Long‑term | 06‑11 – Vector Store, Entity, Knowledge‑Graph, Episodic, Semantic, Procedural | Persisting embeddings, building entity stores, constructing knowledge graphs, separating raw episodes from extracted facts and procedures. |
| Cognitive architectures | 12‑19 – Working Memory, Hierarchical Layers, Consolidation, Compaction, Self‑Reflection, Routing, Temporal, Forgetting | Human‑inspired memory hierarchies, automatic promotion/demotion, periodic consolidation, forgetting policies. |
| Retrieval & routing | 20‑23 – Retrieval‑augmented, Cross‑Session, Multi‑Agent Routing, Hybrid Retrieval | Choosing the right retrieval strategy (similarity search, hybrid, multi‑agent dispatch). |
| Frameworks | 24‑27 – Graphiti, Mem0, Letta (MemGPT), Zep | Plug‑and‑play libraries that implement many of the above patterns out of the box. |
| Evaluation & production | 28‑30 – Benchmarks, Monitoring, Deployment patterns | How to measure memory effectiveness, set up observability, and ship a memory‑enabled agent to production. |
Quick start guide
- Clone the repo (or open any notebook directly in Colab via the badge).
- Install the minimal dependencies – the README lists
python>=3.10and the usual Jupyter stack; most notebooks also pull inlangchain,openai,faiss-cpuorchromadbfor vector stores, andnetworkxfor graph work. - Run the first notebook
01_conversation_buffer_memoryto see the simplest pattern. - Follow the Learning Paths section in the README to jump to a family that matches your project (e.g., “Long‑term → Vector Store” for a retrieval‑augmented chatbot).
- When you’re ready for production, explore the Frameworks notebooks (Mem0, Letta, Zep) which include snippets for CI testing and deployment.
Who should use this
- Developers building a personal assistant, customer‑support bot, or any LLM‑driven workflow that must retain context over time.
- Researchers wanting concrete implementations of emerging memory architectures (e.g., Mem0, Letta) to benchmark against.
- Educators / students looking for a visual, notebook‑driven curriculum on agent memory.
Tech stack & requirements
- Python 3.10+
- Jupyter notebooks (run locally or on Google Colab)
- Core libraries:
langchain,openai(or any compatible LLM API),faiss-cpu/chromadbfor vector stores,networkxfor graph memory, plus the specific SDKs for the framework notebooks (e.g.,mem0-sdk,zep-python). - Apache‑2.0 license – free to use, modify, and commercialise.
Maturity & community
- The repo is actively maintained (issues badge, contribution guide, and a Discord community).
- Each technique is marked with a ✅ notebook badge, meaning the code runs end‑to‑end.
- The author also offers a paid course and a companion book for deeper study, but the notebooks themselves are fully functional and open‑source.
Bottom line: If you need concrete, copy‑paste‑ready examples of how to give an LLM agent memory—whether for a quick prototype or a production system—this repository is a concise, well‑organized toolbox that covers the whole spectrum of memory strategies.
Related
- Project
- Project
- Project
- Project
- Project