1:1 mentoring with Big Tech AI engineers
LLM & Agentic

Agent Memory: Layers & Types

Agent memory two ways: four layers by lifetime and scope (context window, session, long-term user, shared org) and three types by content (episodic, semantic, procedural), with one map between them.

Last updated

Core8 min readFirst readStateless vs StatefulThe Agent Loop

After this section you can

  • Place a memory requirement in the right layer: context window, session, long-term user or shared org
  • Classify what is being stored as episodic, semantic or procedural, and say how each is written and retrieved
  • Budget a turn’s working memory across history, retrieved memories and documents
16

Agent Memory: Layers & Types

The model remembers nothing between calls. Memory is what your system loads back into the window: four layers sorted by lifetime and scope, three kinds of content, and one map between them.

Key idea

An agent remembers only what your code puts into its context window. Sort memory two ways: where it lives (window, session, long-term user, shared org) and what kind of thing it is (episodic, semantic, procedural). The first decides storage; the second decides how you write, find and update it.

The model reads one thing, the context window. Every other layer is your code putting tokens back into it.
WHAT THE MODEL READS 1 · Working memory = the context window system prompt · recent turns · loaded memories · tool results lifetime: one call, rebuilt and re-sent every time Model stateless keeps nothing after the call KEPT BETWEEN CALLS load write load write load (read-only) 2 · Session scope: one conversation lifetime: minutes to days session table · Redis 3 · Long-term user scope: one user or account lifetime: until deleted SQL rows · vector index 4 · Shared / org scope: every user lifetime: until source changes docs index (RAG) Your code decides what to load each turn what to write back when to forget Left to right: longer lifetime, wider sharing, and a bigger blast radius when something wrong gets written.

Related

More in LLM & Agentic

Get full access to all 74+ sections with code examples, diagrams, and interactive animations.

Unlock Premium