AI agent memory is a crucial aspect of context engineering - the practice of managing what information an AI model receives to make decisions. Simply storing data is not the same as enabling an agent to "remember" it effectively.
Working Memory
Contains immediate information (instructions, recent messages, tool results) that an AI model can process in real-time during a conversation (1:28). It serves as the model's current "short-term" context and is essential for maintaining coherence during an active session.
Key Components
Working memory typically includes the following elements sent as the current context:
· System Instructions: High-level guidance on how the agent should behave.
· Current User Request: The specific question or prompt just received.
· Recent Message History: The flow of the conversation leading up to the current turn.
· Selected Documents: Any retrieved files or external information relevant to the current task.
· Latest Tool Results: Real-time data or outputs generated by tools the agent has accessed.
Limitations and Management
· The Context Window: Every model has a fixed limit on the total amount of information it can read in a single call. Because we cannot send infinite data, systems must actively manage this memory.
- Decision Making: To keep the interaction efficient, applications must decide what to keep, what to summarize, and what to remove as the conversation grows.
- Trade-offs: Expanding the context window increases both cost and latency. Furthermore, overflowing the context with too much data can make it significantly more difficult for the model to isolate and identify the most important details
Semantic Memory
Stores long-term storage for stable facts, preferences, and knowledge that must persist across different conversations. Unlike working memory, which is limited by the context window and resets, semantic memory ensures an agent remembers key details without needing to reload entire chat histories.
Core Characteristics
- Durable Information: It holds specific, semi-permanent records such as a user’s name, time zone, or preferred programming language.
- Owner and Scope: Each piece of semantic memory is linked to an owner and a specific scope, defining where and for whom the agent can access that information.
- Lifecycle Management: Because facts can change (e.g., switching from Python to TypeScript), systems must be able to update, replace, or delete stored facts as needed.
Implementation Best Practices
- Selective Storage: Not every detail mentioned in a conversation should be saved. An application must filter to ensure only truly
Episodic Memory
Records specific past events or individual agent runs, focusing on the history of an interaction rather than just static facts. It is essential for an agent to "recall what happened" during a particular task, providing context for how to handle similar situations in the future.
Key Components
- Goal and Context: The initial objective and the state when the task began.
- Process: The specific steps the agent took to attempt the task.
- Tool Interactions: Any external tools used and the data returned by those tools.
- Results and Feedback: Any errors encountered, user feedback received, and the final outcome.
Why it Matters
While semantic memory tells an agent what true, episodic memory provides the narrative of what occurred. By storing these episodes, an agent can:
· Improve Decision Making: When faced with a similar task later, the agent can retrieve the most relevant past episode to see what previously succeeded or failed.
· Learn from Experience: It serves as a historical log that allows the system to analyze past behaviors and refine its future approach.
Procedural Memory
Preserves the rules, habits, and workflows the agent follows to perform specific tasks (e.g., "check documents before searching the web"). In AI agents it represents the methods, rules, and workflows that govern how an agent performs a specific task. Rather than focusing on user data or static facts, this type of memory acts as the "instruction manual" or "habit" the system follows to ensure consistency and safety in its operations.
Key aspects
· Defining Rules & Steps: It establishes the standardized sequence of actions for a task. For example, a rule might dictate that the agent must search internal documents before checking the web.
· Safety & Validation: It incorporates critical gatekeeping steps, such as validating a database query before execution or requiring human approval before performing high-impact actions like issuing a refund.
· Implementation: These procedures are typically stored within the system instructions, tool descriptions, reusable skills, or the underlying workflow code of the application.
By codifying these behaviors, procedural memory ensures the agent operates in a predictable manner, regardless of the specific input it receives from a user.
External Memory
Information stored outside of the AI model's internal weights, such as in databases, document stores, email inboxes, or other external applications. Since models have limited internal knowledge, this memory provides a way for agents to access private, up-to-date, or vast amounts of specific data.
Retrieval-Augmented Generation (RAG) is a design technique that lets a model look facts from external memory and then populate it into working memory.
Parametric Memory
General knowledge embedded directly within the model's weights during training, providing basic language and reasoning capabilities. These weights are the learned parameters or internal settings that allow an AI to function as a general-purpose model.
Key characteristics
- Innate Abilities: This memory enables the model to perform core tasks like understanding human language, writing code, or explaining common concepts without needing to access an external database.
- Static Knowledge: Because this knowledge is baked into the model's weights during training, it does not update during a standard inference call.
- Limitations: It is generally a poor choice for storing private, frequently changing, or highly specific facts. Because the information is fixed at the time of training, it may become outdated and lacks awareness of a user's private data unless the application explicitly provides it in the context
Prospective Memory
The agent's ability to schedule and trigger future tasks, such as sending a follow-up email on a specific day. Because an AI agent is not constantly running, it cannot simply "wait" for a future date like a human might; it requires a specialized system to wake it up.
Core Components
- Future Tasks & Triggers: The system must save a task along with a trigger, which could be a specific date, time, or set of conditions.
- Context Preservation: To ensure the agent can resume work later, the task must store the necessary context, its current status (e.g., pending, in progress), and any approval requirements.
- Reliable Scheduling: A scheduler is used to monitor these triggers and "wake" the application at the correct time. Upon waking, the application checks the latest situation to determine if the task should proceed or if circumstances have changed (e.g., the user replied in the meantime).
- Workflow Safety: Since schedulers may retry, the system requires a clear status management mechanism to prevent the same action from being executed multiple times.
Example covering all seven types of memory
A customer named Rani inquiring about a late order: "My order is late. Can you tell me what happened?"
- External Memory: The system stores Rani’s order records, shipping status, and company policies outside the model. The agent retrieves the relevant order ID and policy status.
- Semantic Memory: The agent loads persistent facts, such as the company’s required communication tone and Rani's verified language preferences.
- Episodic Memory: If applicable, the agent retrieves a similar past delivery case to inform its response.
- Working Memory: Rani's email, the retrieved external facts, and the specific task instructions are bundled into the current context window for the model to process.
- Parametric Memory: The model uses its pre-trained linguistic knowledge to draft a friendly, helpful reply.
- Procedural Memory: The agent follows a defined workflow: check the order, check the policy, draft a reply, and wait for human approval.
- Prospective Memory: The agent schedules a future follow-up task for Friday. If Rani has not replied by then, a scheduler will wake the system to prepare a follow-up for approval.
Designers should not treat these as seven separate databases, but as seven distinct design responsibilities.
Note: AI is used to polish this article















