All concepts
Agent Memory
Store useful past information so an agent can personalize and continue tasks.
Agentic AI · Intermediate · ~8 min
In plain English
What the agent carries between turns and between sessions — the running state of this task, and the durable facts about this user.
Why it's worth your time
Memory is what makes an assistant feel like it knows you, and unbounded memory is what makes it slow, expensive and creepy.
If you remember three things
- Working memory (this task) vs long-term memory (this user)
- Write on an explicit signal, not on every turn
- The user must be able to see and edit what's stored
Overview
Persistent state that lets an agent carry facts across turns and sessions. A memory extractor pulls salient facts, preferences, and task state from conversations; they're stored with user scope, timestamps, and confidence, then selectively recalled into future prompts so the agent personalizes and resumes work.
How it works
- Start: Conversation Turn The agent receives new user context.
- Conversation Turn -> Memory Extractor Important facts, preferences, or task state are extracted.
- Memory Extractor -> Memory Store Memories are stored with user scope, timestamps, and confidence.
- Memory Store -> Recall Relevant memories are retrieved for future prompts.
- Recall -> Personalized Action The agent uses memory only when relevant and allowed by policy.
In an interview
Agent memory is storage of useful past information so the agent can personalize and continue tasks across sessions. You extract salient facts and preferences from conversations, store them scoped to a user, and retrieve the relevant ones into future prompts. The hard parts are what to keep, what to recall, and privacy.
Production defaults
- Tiers
- session · user · organization. Never blur the boundaries
- Retrieval
- fetch relevant memories, don't paste them all. Memory is a retrieval problem
- Compaction
- summarize working memory at ~70% of the window and drop the raw text
- Visibility
- an editable list the user can inspect. Invisible memory is untrustworthy memory
What breaks
- It remembers something irrelevant forever — Auto-write on every turn. Require an explicit signal, and add decay/TTL.
- Costs grow with conversation length — No eviction policy. Cap what you send and enforce it in code, not in a prompt.