Agents need to remember, but not everything in the same way. Borrowing categories from cognitive science helps organize memory design.
Working memory
This is what is in the current context: the active task, recent steps, and tool results. It is fast and limited by the context window.
Episodic memory
Episodic memory stores records of specific past events: what the agent tried, what happened, and how a conversation went. It lets the agent recall that "last Tuesday this approach failed."
Semantic memory
Semantic memory holds facts and knowledge, such as user preferences, product details, or domain rules, independent of when they were learned. It is often implemented with a database or a retrieval index.
Procedural memory
Procedural memory records how to do things: reusable procedures, playbooks, and learned tool-use patterns. It might be stored as prompts, scripts, or workflow definitions.
Design questions for each type
- What gets written, and who or what decides?
- How is it retrieved at the right moment?
- When is it updated or forgotten?
- Who can see it? Memory must respect permissions and privacy.
A caution
Memory can preserve mistakes and stale facts. Include timestamps, sources, and ways to correct or delete entries.
Continue with the book
Explore the full treatment, worked examples, and exercises in Building Production-Grade AI Agents.
Adapted from Building Production-Grade AI Agents, published by Choral Software. Article text and original examples © 2026 Choral Software. All rights reserved.
