What is AI agent memory?
Agent memory is the set of components letting an AI agent store conversations, intermediate results, facts and preferences during and between tasks and recall them; since the model sees only its context window per call, continuity comes from it.
It covers both working memory for the current task and long-term memory stored persistently outside the context window. Agent state is the record of where the agent is in its current task and which steps are done.
- Topic
- Agents and protocols
- Also known as
- AI agent memory
How AI agent memory works
- Working memory keeps the current task's history and results in the context window, summarising or dropping older parts when full.
- Long-term memory stores summaries, facts and past experience in an external store, often a vector database or structured records.
- At a new step the agent searches for relevant memories by similarity, time or topic and adds selected ones to the context.
- Within rules and permissions, the agent decides what to write permanently, what to update and what to delete.
In more detail
Memory types: episodic, semantic and procedural
Following cognitive architectures such as CoALA (2023), long-term agent memory is commonly divided into three functional types: episodic memory (specific past task traces and outcomes), semantic memory (structured facts, entities and user preferences) and procedural memory (reusable rules, workflows or refined system prompts). Treating all three identically in a single flat vector store degrades precision and makes retention policies harder to enforce.
Memory updates, conflict resolution and temporal weighting
Because user preferences and business facts change over time, simply appending new memories creates contradictions (for instance, storing both an old and a new delivery address). Production memory managers run extract-consolidate-update pipelines that detect conflicts, supersede or expire outdated entries with timestamps and combine recency, relevance and importance weighting during retrieval.
Hybrid memory storage and multi-tenant isolation
Pure vector similarity search struggles with relational queries ("which vendor did we switch away from last quarter?") and exact entity constraints. Enterprise implementations increasingly pair vector stores with knowledge graphs or relational tables (hybrid memory) and enforce strict user, role and department namespace isolation at query time.
Commonly confused terms
| Term | How it differs |
|---|---|
| Context window | The context window is the volatile, per-call token buffer visible to the model during inference, whereas agent memory is the broader architecture that persists, indexes and selectively retrieves information across turns and sessions. |
| RAG | RAG typically retrieves static, shared domain documents (policies, manuals), whereas agent memory stores dynamic, agent- or user-specific interaction history, learned preferences and task experiences written during operation. |
| Agent state | Agent state tracks the execution position and variables of an active workflow instance (such as completed steps or pending approvals), whereas long-term memory retains cross-task knowledge and user facts after the workflow finishes. |
Why AI agent memory matters for on-premises AI
Memory keeps an agent from repeating questions and keeps it consistent over long tasks, but persistent memory keeps personal data and trade secrets for a long time. In-house it is managed by defining who sees what, retention and deletion. Wrong or malicious information written to memory can affect later tasks, so writing content from external sources into memory is controlled.
A hospital's administrative assistant writes departments' working rules to long-term memory during appointment planning, while keeping patient details only in working memory for the task and deleting them when it ends.
Common questions
How does agent memory differ from the context window?
The context window is the text a model sees in one call. Agent memory stores information outside it and brings it back when needed.
Does agent memory carry personal data risks?
It can. Persistent memory keeps information for a long time, so access, retention and deletion rules are defined.
Related terms
- AI agent state
- AI long-term memory
- AI conversation history
- Context window
- Context engineering
- AI vector database
Sources
- Cognitive Architectures for Language Agents, 2023
- Generative Agents: Interactive Simulacra of Human Behavior, 2023
In the glossary: Glossary, A to D