Agent Memory
The seven types of memory an agent can have — and when each one earns its place.
Goal
Know the kinds of memory an agent can
have, what each one is, and — most importantly — when each one earns its place. Memory
is the most over-engineered part of agent design: every type you add is state to store,
retrieve, secure, and keep fresh. Each type has its own page; this is the map.
Start from one fact
The model itself remembers nothing between calls — its only “memory” is whatever the harness
puts in the context window
this turn. Working memory is that window; the other six types are strategies for
persisting things outside the model and loading them back in when relevant.
flowchart LR
subgraph Persisted[Persisted outside the model]
SM[Semantic - facts]
EM[Episodic - past events]
PM[Procedural - how-to]
XM[External - documents]
PR[Prospective - to-do later]
end
Persisted -->|retrieve when relevant| W[Working memory - the context window]
Param[Parametric - baked in weights] --> LLM[Model call]
W --> LLMThe seven types
| Type | In one line | Add it when… |
|---|
| Working | The active context window | Always — the baseline |
| Semantic | Durable facts and preferences | Users repeat themselves across sessions |
| Episodic | Past events and outcomes | The agent repeats old mistakes |
| Procedural | How to do tasks | It re-derives the same procedure every run |
| External | Documents in a vector DB (RAG) | Knowledge is large and changes often |
| Parametric | Knowledge baked into the weights | Never at runtime — it’s always there |
| Prospective | Things to do later | Long-horizon jobs that resume after interruption |
Symptom → memory
Work backwards from failure, not forwards from the taxonomy:
| Symptom | What’s missing |
|---|
| Forgets instructions mid-task | Working memory management (trim/summarize), not more storage |
| Asks the user the same thing every session | Semantic |
| Repeats a mistake it made last week | Episodic |
| Solves a routine task differently (and worse) each time | Procedural |
| Doesn’t know your documents | External (RAG) |
| Knowledge is outdated | Parametric limit — RAG or fine-tune, no runtime fix |
| Loses the thread of a long, interrupted job | Prospective |
Example — a support agent’s memory stack
Turn 1 of a session: the harness loads the ticket thread (working), the customer’s plan and
language (semantic), a note that this customer’s last issue was mis-escalated (episodic), the
refund runbook (procedural), and retrieves the relevant policy passages (external). Five
types, one context window — each loaded because a past failure demanded it, not because the
diagram had a box for it.
Strengths & limitations
- Strengths — continuity across sessions is what separates an assistant from a stateless
chatbot; episodic + procedural memory is how agents get better instead of starting from
zero each run.
- Limitations — stored memories go stale and confidently wrong (a moved customer, a
changed policy); retrieval can surface the wrong memory, which poisons the turn; personal
facts raise privacy and retention duties (see
Responsible AI); every
store is infrastructure to run and sync.
Start with working memory only. Add one type at a time, when a real symptom appears — never
all seven because a diagram showed seven.
Sources
1 - Working Memory
The active context window — everything the model can see right now.
The active context window.
What it is
Everything the model can “see” this turn: the current messages, the system prompt, tool
outputs, and reasoning steps. It’s the agent’s scratchpad — and the only memory the model
truly has, since the model is stateless between calls.
flowchart LR
C[Client - web or app] --> W[Working memory - context window: messages, system prompt, tool outputs]
W --> LLM[Model]
W <--> CP[Checkpointer - thread id]When you need it
Always — it’s the baseline every agent runs on, managed by the
harness. A checkpointer keyed by a thread id
lets a conversation pause and resume.
Where it lives
In the context window itself — nothing is persisted
elsewhere. The engineering is context management: as it fills, you trim or summarize old
turns, or the run breaks.
Example
Ask “what did I just say?” and the agent answers by looking back in the window — no store,
no retrieval, just what’s in context right now.
2 - Semantic Memory
Durable facts, preferences, and profiles — knowledge that lasts across sessions.
Knowledge that lasts.
What it is
A persistent store of facts, preferences, and profiles about users or topics — the things
that should survive across sessions and be applied consistently.
flowchart LR
A[Agent] --> S[Semantic memory - facts, preferences, profiles]
S <--> DB[(Vector DB / profile store)]
S --> U[Personalized, consistent answers]When you need it
Users repeat themselves across sessions, or answers must be personalized and consistent —
without the user re-stating the same context every time.
Where it lives
A vector DB or a structured profile store,
written when a durable fact appears and retrieved when relevant to the current turn.
Example
The agent stores “user prefers metric units” once and applies it in every future session —
the user never has to say it again.
- Vector databases — where durable facts are stored and searched.
- Distinct from external memory: semantic is learned about the user, external is your documents.
3 - Episodic Memory
A record of past events and outcomes — experiences that teach.
Experiences that teach.
What it is
A record of past events: full conversations, task outcomes, successes and failures, with
timestamps. It’s how an agent learns from its own history instead of restarting from zero.
flowchart LR
E[Conversations, task runs, events] --> EM[Episodic memory - outcomes, successes, failures]
EM <--> LOG[(Event log DB)]
EM --> R[Recall past - learn - avoid repeats]When you need it
The agent repeats mistakes it already made, or you need an audit trail of what happened and
why.
Where it lives
An event/log store, retrieved by similarity to the current situation.
Example
Reflexion: the agent writes a self-reflection after each failed attempt, stores it, and
reuses it next time — reaching 91% on a coding benchmark versus GPT-4’s 80%. Episodic memory
is how an agent gets better run over run.
Sources
- Shinn et al., Reflexion: Language Agents with Verbal Reinforcement Learning (2023) — arXiv:2303.11366
4 - Procedural Memory
Knowledge of how to do things — skills, workflows, and rules.
Knowledge of how to do things.
What it is
Knowledge of how tasks get done: skills, workflows, tool-use patterns, and behavioral rules.
Tools give an agent capabilities; procedural memory gives it procedures.
flowchart LR
T[Task or goal] --> P[Procedural memory - skills, workflows, rules]
P <--> SK[(Skills / procedures store)]
P --> X[Apply a known procedure]When you need it
The agent re-derives the same procedure on every run instead of reusing a known-good one.
Where it lives
Skills, tool schemas, prompt templates, and
scripts — a library the agent draws on.
Example
Voyager (a Minecraft agent) builds a library of executable skills and, for new tasks,
reuses and composes existing ones instead of solving from scratch.
Sources
- Wang et al., Voyager: An Open-Ended Embodied Agent with Large Language Models (2023) — arXiv:2305.16291
5 - External Memory
Outside knowledge in a vector DB, fetched at inference — this is RAG.
Bring outside knowledge in.
What it is
Knowledge kept outside the model in a vector DB and fetched at inference by similarity search.
This is RAG, seen through the lens of memory.
flowchart LR
Q[Question] --> Emb[Embed query] --> Sim[Similarity search]
Sim --> DB[(Vector DB - embeddings, metadata, sources)]
DB --> TopK[Top-K chunks] --> Ctx[Inject into context] --> LLM[Model answers]When you need it
The knowledge is too large to keep in the context window and changes often — so you look it
up on demand instead of baking it in.
Where it lives
A vector database, holding embeddings,
metadata, and source references for citations.
Example
A support agent embeds your docs, stores them, and retrieves the most relevant chunks when a
user asks — grounding the answer and citing the source.
6 - Parametric Memory
Knowledge baked into the model’s weights — instant, but frozen at the training cutoff.
Knowledge baked into the weights.
What it is
Knowledge learned during training and stored directly in the model’s weights: language,
reasoning patterns, world knowledge, facts. No retrieval — it’s just there.
flowchart LR
Q[Question] --> LLM[LLM - parametric memory in weights: language, world knowledge, facts]
LLM --> A[Answer - instant, no retrieval]When you need it
You don’t add it at runtime — it’s always present, the fastest and cheapest memory. The
design question is what to rely on it for versus fetch externally.
The trade-off
Instant and free at inference, but frozen at the training cutoff and hard to update or
audit. Fill gaps with external memory (fresh, citable)
or fine-tuning (new behavior) — never at runtime.
Example
The model knows what a REST API is without being told, but won’t know a library released last
month. The first is parametric; the second needs external memory.
7 - Prospective Memory
Things the agent plans to do next — remembered across interruptions.
Remember what you plan to do next.
What it is
Future intentions and scheduled goals the agent has committed to but not yet executed:
pending tasks, goal stacks, reminders. It’s how a long-horizon agent survives interruptions.
flowchart LR
A[Agent - interrupted mid-task] --> Store[Prospective store - pending tasks, goals, reminders]
Store --> Trig{Trigger - time or event}
Trig --> Resume[Reload intent and continue]When you need it
Long-horizon agents that must act on future events — not just respond to the current turn —
and jobs that span interruptions or restarts.
Where it lives
A task queue, goal stack, or reminder log, fired by a time / event / agent trigger.
Example
An agent finishes step 2 of 5, gets interrupted, and logs “resume at step 3 with these
inputs.” When it restarts it reads the intent and continues exactly where it left off,
instead of losing the thread.