liveBook · Manning

Episodic memory

As explained in Build a Multi-Agent System (from Scratch)

Episodic memory retains discrete experiences from an agent's task executions.

Episodic memory lets an LLM agent retain discrete experiences from completed task executions and recall relevant ones for future tasks. It can help the agent avoid repeated work and apply lessons from earlier runs. section 7.0 section 7.1.2

An episode is one unit of experience. Memory records can draw on task inputs, results, tool calls, trajectories, or lessons extracted from an execution. What to retain is a design decision that can affect performance; it is separate from how records are stored. section 7.1.2

Boundary of memory
Artifact
Derived from LLM agent experience?
Working or Episodic Memory
Input and output of a task execution
Yes
Episodic
Lesson extracted from task execution
Yes
Episodic
Rollout injected into system message
Yes
Working
User preference
No
N/A
Skill
No
N/A
LLM’s parametric weights
No
N/A
RAG over Wikipedia
No
N/A

Compare experience-derived episodic and working memory with artifacts outside this definition of memory. section 7.1.2

Working memory tracks progress within a single task, typically through a rollout supplied to the model. It is transient and limited by the context window. Episodic memory instead carries experience across tasks; recalled information must be supplied to the stateless model at inference time. section 7.1.2 section 7.7

A task lifecycle can incorporate episodic memory in three steps:

  • At the start, recall relevant Episode objects for the current task. section 7.7
  • Provide the recalled experience in the model’s prompt or context so it can influence execution. section 7.7
  • At the end, record the completed execution as an Episode for later recall. section 7.0 section 7.7

Memory is the core type responsible for recording and recalling Episode objects through a BaseMemoryStore backend. Recall and storage choices are coupled: semantic-similarity recall, for example, requires vector-based storage. section 7.7

Memory across subagent dispatches

A subagent configured with episodic memory can preserve context across separate dispatches, even when each dispatch starts with a fresh execution rollout. This does not resume an interrupted task: without memory, the main agent must supply necessary prior context in the new task instructions. section 9.2.3

How Build a Multi-Agent System (from Scratch) covers it

How deep it goes
Defines episodes and memory boundaries, then outlines recall and recording operations, backend responsibilities, and storage tradeoffs.
Examples
Uses task inputs, outputs, extracted lessons, and separate subagent dispatches to illustrate retained experience.
What you can do after
Build it from scratch by representing episodes and wiring recall and recording into an agent’s task lifecycle.
How it connects
Connects episodic memory to working memory, context windows, semantic similarity, vector storage, and subagents.

Also explained in

Compare how 2 books explain episodic memory →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Build a Multi-Agent System (from Scratch). The section links point to the parts of the book it draws on.