Agent memory

Agentic AIContext and memoryPublished By Simon Budziak

Agent memory is the mechanism that lets an AI agent retain and recall information across steps and sessions instead of starting from a blank context window every time, split into short-term memory that holds the current task's working state and long-term memory that persists facts, preferences, and past outcomes between runs.

What is the difference between short-term and long-term agent memory?

Short-term memory is the working state inside the current run, the plan, recent tool results, and the conversation so far, and it disappears when the run ends. Long-term memory survives between runs, usually written to a database or vector store, so an agent recalls a preference or an earlier decision without replaying the whole history each time. Most production agents need both: short-term memory for the task at hand, long-term memory for anything that should carry over.

Why does a stateless model need agent memory at all?

A language model holds nothing between calls; every fact it appears to remember was fed back into its context on this call. Deep agents that run long, multi-step tasks lean especially hard on memory to survive a session without losing track of what already happened, and an AI agent without any memory layer re-plans from zero on every turn, which is slow and prone to repeating a mistake it already made once. Choosing what to write to memory and what to leave out is itself a discipline, one covered under context engineering; an agentic workflow that spans several steps usually cannot run reliably without it.

Frequently asked questions

Is agent memory the same as a longer context window?

No. A context window is the space available on a single call. Agent memory is a separate storage layer, often a database or vector store, that decides what gets written down and pulled back into that window on a later call, including calls in a different session entirely.

Do all AI agents need long-term memory?

No. A narrow, single-turn agent can run fine on short-term memory alone. Long-term memory earns its cost once an agent needs to recall a user's preferences, an earlier decision, or a past outcome across separate sessions rather than just within one run.

Summarize this page with

See this working in a system we built