Agent memory is information that an AI agent preserves and retrieves across steps, conversations, or tasks. It allows the agent to maintain continuity beyond the information currently present in the model's context window.
Memory is not the same as context. Context is the information supplied to a model for a particular inference. Memory is stored state that may later be selected and inserted into that context through context engineering.
Agent systems commonly distinguish several forms of memory:
- Working memory: temporary plans, observations, and intermediate results needed for the current task.
- Episodic memory: records of previous interactions or completed tasks.
- Semantic memory: durable facts, preferences, concepts, and relationships.
- Procedural memory: reusable instructions, policies, or skills that describe how to perform an operation.
Memory can be implemented with relational databases, document stores, event logs, vector stores, knowledge graphs, or combinations of these systems. Retrieval-Augmented Generation (RAG) is often used to retrieve relevant memories, but RAG is a retrieval pattern rather than a complete memory architecture.
A useful memory pipeline includes extraction, validation, storage, retrieval, and deletion. The system must decide what is worth remembering, identify its source and scope, resolve conflicts with newer information, and avoid reintroducing irrelevant history. Unfiltered accumulation can produce stale preferences, duplicated facts, privacy risks, and incorrect personalization.
Memory writes should therefore be more conservative than ordinary model outputs. Important facts may require user confirmation or deterministic validation. Stored records should include provenance, timestamps, ownership, retention rules, and access controls. Users should be able to inspect and remove personal memory.
During long-running tasks, context compaction can preserve short-term execution state, while external memory retains authoritative records. The distinction matters because compaction is usually lossy, whereas durable memory may need exact recovery and auditability.
Agent memory improves continuity and personalization, but it also expands the system's security boundary. Retrieved memories and external documents should be treated as untrusted data, particularly when they can contain prompt injection attacks.
The LLM Knowledge Base is a collection of bite-sized explanations for commonly used terms and abbreviations related to Large Language Models and Generative AI.
It's an educational resource that helps you stay up-to-date with the latest developments in AI research and its applications.