# Agent Memory

> How an agent keeps facts from one task for the next one.

**Field:** Artificial Intelligence  
**Category:** AI Agents  
**Also known as:** Long-Term Memory (AI), AI Memory, Persistent Memory

## Think of it like

Think of it like a notebook. You write down what you learned, so you still know it the next day.

## Definition

Agent memory is how an agent keeps facts beyond one task. Short-term memory is the context window. It holds the chat so far, and it is gone when the task ends. Long-term memory is kept outside the model, in files or a database, and read back in later. The agent or its harness picks what is worth saving and when to load it.

## Example

Lucy's assistant saves a note that she likes short answers with sources. Next week, in a new chat, it reads the note and writes that way.

## Why it matters

It lets an agent learn your project and your habits. Then it does not have to ask again each time.

## Common mistake

Saving everything. A memory full of old or wrong notes misleads the agent more than an empty one.

## Three principles

- **Short-term is the context.** Gone after the task.
- **Long-term is stored.** Files or a database.
- **Choose what to keep.** Not everything.

## Related terms

- [Context Window](https://learn.benibix.com/term/ai/context-window)
- [Agent Harness](https://learn.benibix.com/term/ai/agent-harness)
- [Vector Database](https://learn.benibix.com/term/ai/vector-database)
- [Context Engineering](https://learn.benibix.com/term/ai/context-engineering)
- [Auto Memory](https://learn.benibix.com/term/ai/auto-memory)

## Told apart from

- [Agent Memory vs Context Window](https://learn.benibix.com/compare/agent-memory-vs-context-window): People often think an agent remembers all it ever saw in its context window. It does not. The context window is just what the model can see right now, and it is wiped when the task ends. Agent memory is kept outside the model and read back in later. If a fact was never saved, the next task will not know it.

![Short-term memory is the context window, which empties when the task ends. Long-term memory is a store outside the model that keeps notes for the next task.](https://learn.benibix.com/diagrams/ag-agent-memory.svg)

---

Source: https://learn.benibix.com/term/ai/agent-memory
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-19
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
