Pattern · intermediate
Memory Systems Pattern
Patterns for agent memory: working state, summaries, long-term stores, and retrieval with governance.
- memory
- state
Memory systems give agents continuity. The pattern is to split stores by lifetime and trust, not dump everything into the prompt.
Pattern blueprint
- State object — JSON schema for the run
- Episode log — trajectory events
- Summarizer — compress old steps
- Long-term KV / vector store — durable facts
- Retriever — fetch relevant world docs
Write policies
- What can be written automatically?
- What needs user approval?
- What is never stored?
Read policies
- What is injected every turn vs on demand?
- How many items max?
- How do you handle conflicts?
Anti-patterns
- Infinite chat history as the only memory
- Storing secrets in model-visible memory
- Unbounded “remember this” from untrusted text
Deep dive: Agent memory explained.
Frequently asked questions
How should agents store memory?
Use typed working state for control flow, summarized thread history for context, and governed long-term stores with provenance for durable facts—plus RAG for world knowledge.
Related reading
Agent Memory Explained
Working memory, thread memory, long-term memory, and RAG—how memory works in agentic systems and how to govern it.
Memory
Agent memory is retained state across steps or sessions, including working context, thread history, durable facts, and retrieved knowledge.
Agentic Architecture: Core Components of Production Agents
A practical architecture model for agentic systems: goals, planners, tools, memory, orchestration, evals, and control planes.