05. Memory
Why memory exists in agents
A basic model call has very limited working context.
An agent often needs to remember:
- what the user asked earlier
- which steps are already done
- what tool outputs were returned
- preferences, constraints, and history
- facts gathered during execution
Without memory, the agent behaves like it is starting over again and again.
Types of memory
1. Short-term memory
This is working memory for the current task.
Examples:
- current plan
- last tool result
- active constraints
- current conversation state
2. Long-term memory
This persists across sessions or tasks.
Examples:
- user preferences
- historical decisions
- saved facts
- reusable project context
3. Episodic memory
Memory of past events or prior runs.
Example:
- “Last week this API failed because the token expired.”
4. Semantic memory
Stored knowledge in structured or retrievable form.
Example:
- documentation chunks
- team processes
- company knowledge base
- personal notes
Memory is not always the same as chat history
A long chat transcript is not automatically good memory.
Useful memory should often be:
- compressed
- structured
- searchable
- relevant to the current goal
Common storage approaches
- in-context summaries
- vector databases
- key-value stores
- relational databases
- file-based logs
The correct choice depends on the task and system scale.
Risks
Memory can hurt a system if it becomes:
- stale
- noisy
- too large
- incorrect
- privacy-sensitive
Bad memory is worse than no memory.
Good design principle
Remember only what helps future decisions.
If a stored fact will not improve reasoning, execution, personalization, or recovery, it may not be worth storing.
Next
Continue to Multi-agent systems.
