Learn Agentic Patterns
CoursesInterviewSchoolVideosAI agent videosAI now
Learn Agentic Patterns

Learn agentic AI, then get interviewed on it. A free course, four job paths, a daily broken agent, and the interview.

learnagenticpatterns.com

Navigation

HomeThe courseThe interviewPatterns (developer track)PM trackBlogCareer GuideAboutSign Up

Connect

Cheat sheet (free PDF)Reskilling guideLinkedIn (Mousa Jawaheri)

© 2026 learnagenticpatterns.com

Privacy PolicyTerms of Service

Based on “Agentic Design Patterns” by Antonio Gullí

> All Patterns

[01]Prompt Chaining[02]Routing[03]Parallelization[04]Reflection[05]Tool Use[06]Planning[07]Multi-Agent Collaboration[08]Memory Management[09]Learning & Adaptation[10]State Management (MCP)[11]Goal Setting & Monitoring[12]Exception Handling & Recovery[13]Human-in-the-Loop[14]Knowledge Retrieval (RAG)[15]Inter-Agent Communication (A2A)[16]Resource-Aware Optimization[17]Reasoning Techniques[18]Guardrails & Safety[19]Evaluation & Monitoring[20]Prioritization[21]Exploration & Discovery[22]Boundary Translation
HomeCurriculumMemory Management
Pattern [08]

Memory Management

≈ Database / Caching / Session State Management

[08]

TL;DR

Mechanisms for agents to store, index, and retrieve information over time, spanning short-term (conversation context) and long-term (knowledge base/episodic) history. This gives the agent a sense of continuity and identity.

SWE: Database / Caching / Session State
Architecture Flow
agentgate
Short-Term MemorygateLong-Term MemorygateMemory RetrieveragentResponse Agentagent

> Agentic Definition

Mechanisms for agents to store, index, and retrieve information over time, spanning short-term (conversation context) and long-term (knowledge base/episodic) history. This gives the agent a sense of continuity and identity.

Before: Explicit State Persistence

Explicit State Persistence
1# Traditional Session
2user_session = db.get_user_session(user_id)
3last_action = user_session['last_action']

After: Semantic Memory

Semantic Memory
1# Vector Database Retrieval (Long-Term Memory)
2relevant_memories = vector_db.similarity_search(
3 query=current_user_input
4)
5
6# Inject memories into prompt context (Short-Term Memory Loading)
7agent.run(
8 input=current_user_input,
9 context=relevant_memories
10)

Traditional SWE

Database / Caching / Session State

≈maps to

Agentic Pattern

Memory Management

≈How They're Similar

Persistence of state is crucial for both. Short-term memory ≈ RAM/Redis (Session Store); Long-term memory ≈ Disk/SQL/NoSQL (Persistent Store).

≠Key Divergence

Agentic memory is often Vector-based (semantic similarity) rather than Key-Value or Relational. Retrieval is probabilistic (getting "relevant" memories based on embedding distance) rather than exact (getting "row ID 123").

> Production Considerations

01

Storing everything in context windows is expensive. Efficient RAG and summarization strategies are needed to manage the "Context Window Economy."

02

Long-term memory risks storing PII indefinitely. Implementation of "Forgetting" mechanisms and strict data governance is required.

💡

Key Takeaway

Adapt: Database schema design is replaced by "Information Retrieval Strategy." You don't just query data; you curate context. You must decide what the agent needs to know to be effective.

BuildBuild a Context-Aware Chatbot. Create a chatbot that maintains conversation context using short-term memory and retrieves relevant past interactions from long-term memory to personalize responses.

Frequently Asked Questions

When should I use the Memory Management pattern?

Mechanisms for agents to store, index, and retrieve information over time, spanning short-term (conversation context) and long-term (knowledge base/episodic) history. This gives the agent a sense of continuity and identity.

How does Memory Management relate to Database / Caching / Session State Management?

Persistence of state is crucial for both. Short-term memory ≈ RAM/Redis (Session Store); Long-term memory ≈ Disk/SQL/NoSQL (Persistent Store). However, there is a key divergence: Agentic memory is often Vector-based (semantic similarity) rather than Key-Value or Relational. Retrieval is probabilistic (getting "relevant" memories based on embedding distance) rather than exact (getting "row ID 123").

What are the production trade-offs of Memory Management?

Storing everything in context windows is expensive. Efficient RAG and summarization strategies are needed to manage the "Context Window Economy." Long-term memory risks storing PII indefinitely. Implementation of "Forgetting" mechanisms and strict data governance is required.

Further Reading

Blog · 2 min read

AI This Week: Building Robust, Efficient, and Safe Agents

This week, we dive into critical advancements for agent builders: persistent memory benchmarks, open-source infrastructure for desktop agents, and efficient tool-calling models.

Next Pattern

[09] · Learning & Adaptation