Agent Memory
Persisting context across turns (short-term) and sessions (long-term) for agents.
Step 1 of 4
Short-term
The current conversation sits in the context window as recent messages, usually as a sliding window.
Summarise old turns instead of dropping them, and keep per-user facts outside the prompt.
Simple explanation
Memory lets an agent remember things. Short-term = the current conversation. Long-term = facts learned across sessions (user preferences, past decisions). Without memory, every conversation starts from scratch.
Engineering explanation
Short-term: conversation history (sliding window, summarised when too long). Long-term: vector store of facts/preferences per user, retrieved at query time. Episodic: log of past runs. Production memory: summarise old turns (plain truncation loses facts), persist long-term per user, version the schema.
Example
Agent remembers user's name from session 1 → in session 2, retrieves it from long-term memory → greets by name without asking.
When to use it
Any conversational agent. Essential for personalisation and continuity.
Common misconception
Memory is NOT just 'storing messages'. Truncating old messages loses facts. Summarise rather than simply truncate.