Long-Term Memory
What is long-term memory?
Long-term memory is information an AI agent retains for useful access across separate sessions, conversations, or tasks. It supports continuity beyond the current interaction, such as remembering a stable user preference or reusing knowledge learned during earlier work.
Long-term does not necessarily mean permanent. Information may be corrected, expire, lose relevance, or be deleted.
What long-term memory can store
Common examples include:
- approved user profile details and preferences;
- durable facts learned from trusted sources;
- summaries of completed tasks;
- prior decisions and their reasons;
- successful strategies or important failures;
- unresolved commitments that must continue later.
An agent may store these items in a database, document system, key-value store, or retrieval system. Before use, it retrieves relevant memories into the model’s current context.
Semantic and episodic memory
Semantic memory represents facts, concepts, and relationships, such as “the customer prefers email communication.” Episodic memory represents specific events, such as “the customer changed the delivery address during the July 30 support call.”
Both can be long-term. An agent may derive a semantic preference from repeated episodes, but it should preserve uncertainty and allow the user to correct the conclusion.
Long-term versus persistent memory
Long-term describes intended usefulness across time. Persistent describes a storage property: the information survives after the current runtime ends. Most practical long-term memory must be persistent, but persisted data is not automatically useful long-term memory.
A raw debug log may be stored for months without being appropriate agent memory. Conversely, an in-memory value intended for later use is not truly available long term if it disappears on restart.
Quality, privacy, and forgetting
Long-term memory can become stale, contradictory, or overly influential. Storing generated assumptions as facts may repeat errors across many sessions. Broad retention also increases privacy and security risk.
Reliable systems record source and timestamp where relevant, distinguish user-provided facts from model inferences, retrieve by current relevance, and support update, deletion, and expiration. Sensitive memories need access controls and clear user expectations.
Why it matters
Long-term memory lets agents personalize support, resume unfinished work, and apply useful prior experience without replaying every conversation. Its value depends on selective writing and accurate retrieval—not maximum retention.
Builders should ask whether a memory will be useful later, whether it is trustworthy, and how it can be corrected or forgotten. See [Memory in AI Agents](/memory-in-ai-agents/) for the complete memory lifecycle.
Learn More
Memory in AI AgentsContinue with the full AIRundown guide →