Agent Memory and Planning
Better agents are not just bigger prompts. They need state, memory, planning, tools, and stopping rules.
Memory types
| Memory | Purpose | Example |
|---|---|---|
| Working memory | current task state | checklist for today's run |
| Episodic memory | prior interactions | what happened in last support case |
| Semantic memory | durable facts | user's stable preference |
| Procedural memory | how to do work | run tests before finishing |
Memory should be intentional. Storing everything creates privacy risk and confusion.
Planning patterns
| Pattern | Use when |
|---|---|
| ReAct | tool use and observation loops |
| Plan-and-execute | multi-step tasks with clear subtasks |
| Reflection | agent needs to critique or repair its work |
| Tree search | multiple possible solution paths |
| Supervisor/subagents | specialized workers are useful |
Good plans are testable
A strong agent plan includes:
- objective
- constraints
- required inputs
- tools needed
- steps
- success criteria
- stopping condition
- escalation rule
Reflection without loops
Reflection helps agents catch mistakes, but it can loop forever.
Use:
- max iterations
- budget limits
- changed-output requirement
- external tests
- human approval after repeated failure
Memory safety
Do not store:
- secrets
- credentials
- regulated personal data
- one-time user instructions
- unverified facts
- malicious instructions from documents
Store only stable, useful, permitted information.
Knowledge check
Q1: Why is "remember everything" a bad agent strategy?
It increases privacy risk, context noise, stale assumptions, and prompt-injection exposure.
Q2: What makes an agent plan testable?
Clear success criteria, stopping conditions, and verification steps.