Problem
Many agents don’t fail because the model is bad. They fail because they remember poorly.
They mix chat history, preferences, business data, instructions, old errors, partial results and approved decisions within the same context. At first it seems to work. Then drift appears: the agent starts retrieving irrelevant things, repeats expired criteria, confuses preferences with policies and treats a past failure as if it were a rule.
That is not memory. It’s accumulation.
An enterprise agent needs to distinguish what it is thinking now, what happened before, what it knows is true, how it should perform a task, what is pending, what it shares with other agents and what it must forget.
Thesis
Agent memory is not a feature. It is a state system.
The correct stack does not try to make the agent “remember more”. It tries to make it remember with semantics: each type of memory has its own source, expiration, permissions, retrieval method and update criteria.
When everything lives in a single context bag, the agent degrades. When each memory lives in its own layer, the system can audit, correct and scale.
Framework
An enterprise memory stack has seven layers.
| Layer | What it stores | Risk if mixed |
|---|---|---|
| Working memory | What is needed for the current task | Saturate the window with noise |
| Episodic memory | What happened, when, and with what outcome | Repeat errors as if they were learning |
| Semantic memory | Facts, entities, relationships and stable state | Turn rumors or outputs into truth |
| Procedural memory | How to do a task, workflow or skill | Execute outdated procedures |
| Hierarchical memory | What is hot, warm, cold or archived | Retrieve too much or too little |
| Prospective memory | What must be remembered or executed later | Forget follow‑ups, deadlines and commitments |
| Shared memory | What several agents must share | Create incompatible versions of reality |
The key difference is not technical. It is operational.
A CRM data point should not enter through the same door as a tone preference. A lesson learned from a failure should not have the same weight as an approved policy. A procedure used by sales should not be automatically updated because an agent improvised it once.
Good memory is not longer. It is more governable.
Why it matters now
Frameworks are already separating these layers. LangGraph distinguishes short‑term memory tied to the thread and long‑term memory via stores. OpenAI Agents SDK documents sessions to maintain history across runs and allows custom sessions with retention policies, encryption or metadata. Letta treats memory as an explicit part of the agent architecture, with editable memory and layers inspired by MemGPT.
Research is heading the same direction. MemGPT proposed an operating‑system‑inspired architecture to manage different memory levels beyond the context window. CoALA described agents with modular memory components, action space and decision processes.
Practical translation: memory is no longer “add a vector database”. It is a runtime piece, governance, security and operational design.
For the enterprise, this changes three things:
- Cost: retrieving irrelevant memory increases tokens, latency and rework.
- Risk: memory without permissions can leak data or reactivate untrusted instructions.
- Quality: memory without expiration turns old decisions into current criteria.
Anti‑example
The typical anti‑example is building “memory” with an embeddings table over the entire history.
Each conversation, ticket, document, decision, error and preference is chunked, vectorized and retrieved by similarity. It looks sophisticated. In production it generates very concrete problems:
- similarity does not mean relevance
- recall does not mean authority
- history does not mean truth
- experience does not mean procedure
- old data does not mean valid data
The agent does not need to retrieve the similar. It needs to retrieve what it has permission, validity, source and utility for the current decision.
Protocol (3 steps)
-
Define memory types before choosing technology. Working, episodic, semantic, procedural, prospective and shared should not share the same write policy.
-
Add authority metadata. Each persistent memory needs source, owner, date, permission, expiration and usage reason. Without that you cannot distinguish learning from contamination.
-
Design the write‑path, not just retrieval. What matters is not only what the agent remembers. It is who can write memory, when it is consolidated, how it is corrected and how it is deleted.
| Decision | Question | Healthy signal |
|---|---|---|
| Store | This should survive the current run | Memory with source and owner |
| Consolidate | This changes a rule or procedure | Human review or traceable automatic criterion |
| Retrieve | This helps the current decision | Ranking by utility, validity and permission |
| Expire | This should no longer influence | TTL, versioning or archiving |
| Share | Other agents should use it | Common state with access control |
Simple rule: if you cannot explain why a memory is there, the agent should not use it either.
Related
- Agent Memory from Trace: useful memory lives not in the chat, lives in the operation
- Context Budgeting: the context architecture that saves tokens without blinding the agent
- Context Supply Chain: the invisible supply chain of corporate AI
- AI Traces: the layer that turns agents into auditable systems
- Tool Registry: the risk map that enterprise agents need
Sources consulted
- LangGraph: Memory overview
- OpenAI Agents SDK: Sessions
- Letta Docs: Memory overview
- MemGPT: Towards LLMs as Operating Systems
- CoALA: Cognitive Architectures for Language Agents
Next step
Audit a real agent with an uncomfortable question: what memory can it write, what memory can it read and what memory can it share.
If the answer is “depends on the prompt”, you have no memory. You have accumulated context. The next step is to design the state stack: layers, permissions, expiration, traces and consolidation criteria.
Translated from the Spanish original with AI assistance and reviewed for accuracy. Read the original in Spanish.