Knowledge & memory

Agent memory

Agent memory is how an agent retains information beyond a single context window — from short-term working state within a task to long-term stores it can search and reuse across sessions.

The context window is finite, so a capable agent needs memory beyond it. Short-term memory is the running conversation and scratch state within one task. Long-term memory persists facts, past results, or user preferences in an external store — often a database or vector index — that the agent writes to and retrieves from later. Good memory design decides what is worth keeping, how to summarise it, and when to recall it; otherwise the agent either forgets what matters or drowns in stale detail.

Key points

  • Short-term = working state inside the current task; long-term = persisted and searchable across sessions.
  • Long-term memory usually lives in an external store, not the context window.
  • The hard parts are deciding what to store, how to compact it, and when to recall it.
  • Memory plus retrieval is what keeps an agent coherent on long or recurring tasks.

Learn it by building

Way of the Agent teaches AI agent engineering level by level — concepts like this one, then hands-on practice, XP, and the AI Chronicles.

Start learning free →