What are the types of AI agent memory?
The four useful categories are working, semantic, episodic and procedural memory. Working memory holds the state needed during the current run. Semantic memory stores stable facts and concepts. Episodic memory records what happened in a specific interaction. Procedural memory represents how the agent should perform a task, including successful methods, constraints and tool-use patterns.
The categories are a design tool, not a requirement to build four databases. One storage service can hold all four, but each needs explicit metadata, retrieval rules and lifecycle policy. Mixing them into an undifferentiated transcript makes it impossible to know whether the agent is recalling a fact, repeating an old episode or following a learned procedure.
What is the difference between semantic, episodic and procedural memory?
Semantic memory answers “what is true,” episodic memory answers “what happened,” and procedural memory answers “how should this task be done.” Working memory is the temporary layer that keeps the current goal, recent turns and tool results available while the agent reasons.
| Memory type | Core question | Typical content | Preferred retrieval |
|---|---|---|---|
| Working | What is happening right now? | Current goal, recent messages, partial tool output | Thread state and bounded recent context |
| Semantic | What is true about this entity? | Plan, preference, account fact, approved decision | Entity, scope, validity and semantic relevance |
| Episodic | What happened in a previous situation? | Support incident, failed attempt, meeting outcome | Similar situation, participants, time and project |
| Procedural | How should this task be executed? | Workflow, tool sequence, escalation rule, coding convention | Task, environment, role and version |
The same event can create several memory records. A failed deployment is an episode, the rollback rule learned from it is procedural, and the current service version is semantic.
What is working memory in an AI agent?
Working memory is the short-lived state needed to complete the current run. It includes the active goal, the latest conversation turns, intermediate reasoning results, tool responses, open tasks and interruption state. It should usually live in the agent runtime, checkpointer or session rather than in a durable user profile.
Keep working memory bounded. A runtime that retains every message until the context window fills has not created memory; it has moved transcript replay into the execution loop. Compact completed steps, discard irrelevant tool output and promote only confirmed facts or reusable procedures into a longer-lived layer.
- Use working memory for the current goal, latest turns and pending actions.
- Keep durable preferences and authoritative account data outside the session.
- Compact completed reasoning before it crowds out the next action.
- Clear working memory when the task ends unless policy requires an audit record.
What is semantic memory in an AI agent?
Semantic memory stores durable facts without requiring the original conversation to be replayed. Examples include a customer’s preferred language, an account’s approved region, a project’s database choice or a capability supported by a tool. Good semantic memory records the entity, value, source, observation time, validity and scope.
Semantic facts need correction and supersession. If the customer moves from Berlin to Lisbon, the current time zone should win while the older value remains historical. Store current truth separately from evidence, and never let the model invent a new account setting from a retrieved sentence.
| Field | Example |
|---|---|
| Subject | Customer account 841 |
| Fact | Preferred support channel is email |
| Scope | Tenant acme + user 841 |
| Source | Confirmed profile update on 2026-10-28 |
| Validity | Current until a newer confirmed preference |
What is episodic memory in an AI agent?
Episodic memory records a bounded experience: who participated, what happened, when it happened, which tools were used and what outcome followed. A support escalation, a failed migration or a completed planning session can become an episode that later helps the agent recognize a similar situation.
Do not store an episode as an unredacted transcript by default. Keep a source-linked summary, important decisions, result and unresolved follow-ups. Retrieval should depend on situational similarity, recency and scope, not simply semantic similarity to a few words.
- Summarize the event and keep links to its permitted source record.
- Record success, failure and uncertainty rather than only positive outcomes.
- Expire raw transcripts independently from extracted episode summaries.
- Prevent one customer’s episode from entering another tenant’s retrieval set.
What is procedural memory in an AI agent?
Procedural memory captures how to perform work. In an agent, that can mean a tested tool sequence, a coding convention, a review workflow, a recovery playbook or an escalation rule. Unlike a semantic fact, a procedure needs versioning and evidence that it worked in a particular environment.
Procedures should be promoted deliberately. A model correction in one session is a candidate lesson, not automatically a permanent rule. Validate the lesson, attach the environment and task scope, then test it against representative cases before allowing it to influence future runs.
await memory.add({
userId,
agentId: 'deployment-agent',
kind: 'procedural',
text: 'Run the schema compatibility check before production migration.',
metadata: {
tenantId,
projectId: 'billing-api',
source: 'reviewed-runbook',
validatedAt: '2026-11-02',
version: 3,
},
});How should each memory type be stored and retrieved?
Start with the retrieval decision, then choose storage. A relational record is often best for current facts, a search or vector index for episodic similarity, a graph for relationships and a versioned policy store for procedures. The storage engine can be shared, but the scoring rules should reflect the memory type.
| Type | Write trigger | Retrieval signal | Lifecycle |
|---|---|---|---|
| Working | Every meaningful turn or tool step | Current thread and execution state | End or compact with the task |
| Semantic | Confirmed fact or correction | Entity, scope, validity, relevance | Supersede, retain evidence, delete on request |
| Episodic | Completed event or unresolved incident | Situational similarity, time and participants | Summarize, retain by policy, expire raw source |
| Procedural | Reviewed lesson or approved workflow | Task, environment and version | Version, evaluate and retire explicitly |
How do you test each type of agent memory?
Test the memory type against the behavior it is supposed to improve. Semantic tests check current-fact recall and contradiction resolution. Episodic tests check whether a similar prior situation produces a useful lesson. Procedural tests check whether the agent follows a validated method without applying it outside the correct scope. Working-memory tests focus on task continuity and context budget.
- Semantic: move a fact, then verify the current value wins.
- Episodic: replay a similar incident and require the relevant outcome.
- Procedural: change the environment and ensure the old procedure is not misapplied.
- Working: interrupt and resume a run without losing the active goal.
- Cross-type: verify facts, episodes and rules do not leak across tenants.
- Deletion: remove one type and confirm derived summaries and indexes also disappear.
What is the recommended AI agent memory architecture?
Keep working memory in the agent runtime, then add a durable memory service for semantic, episodic and procedural records. Route writes by type, enforce scope before retrieval, rerank a small candidate set and delete every derived artifact when the source scope is erased. The architecture should expose why each record was selected, not return an opaque block of text.
Frequently asked questions
How many types of memory does an AI agent need?
Most production agents need working memory plus a durable layer that can distinguish semantic facts, episodic experiences and procedural rules. A simple chat agent may start with only working and semantic memory.
Is episodic memory the same as conversation history?
No. Conversation history is raw source material. Episodic memory is a bounded, source-linked representation of what happened, including outcome, participants and relevance.
What is procedural memory in AI agents?
Procedural memory stores validated methods for completing tasks, such as tool sequences, coding standards, recoveries and escalation rules. It should be versioned and scoped to the environment where it was tested.
Should semantic, episodic and procedural memory use separate databases?
Not necessarily. They can share storage when records include a memory type, scope, provenance and lifecycle fields. Retrieval scoring and policy still need to differ by type.
Which memory type is most important for personalization?
Semantic memory usually carries stable preferences and account facts, while episodic memory supplies recent experiences. Both are useful, but current authoritative data must still come from the source system.
How do these memory types relate to context engineering?
Context engineering decides which working, semantic, episodic and procedural records enter the current prompt. Memory stores the candidates; context engineering assembles the smallest useful subset.
