Agent memory
In short
Agent memory is information an AI agent keeps and can bring back later, either as a block of facts inside the current prompt or as records stored outside that prompt.
- Also called
- Memory for AI agents, Persistent agent memory, Long-term agent memory
- Topic
- AI agents
- Level
- Some background helps
- First described
- Charles Packer and colleagues submitted MemGPT on 12 October 2023, proposing virtual context management inspired by fast and slow memory in operating systems1.
Packer and colleagues proposed virtual context management in MemGPT, submitted on 12 October 2023 and revised on 12 February 20241. A fixed context window limits extended conversations and document analysis1. The February 2024 paper splits storage into main context, which is inside the prompt, and external context, which is outside it2. Main context holds read-only system instructions, a working context and a first-in, first-out queue2. External context is archival storage and recall storage2. Data kept there has to be moved into main context by a function call2.
Working context is a fixed-size block of text, and only MemGPT function calls can write it2. In a conversation it is meant to hold key facts, preferences and other important information about the user and the persona the agent is adopting2. The queue stores a rolling history, and its first entry is a recursive summary of messages that have been evicted2. When the prompt tokens exceed a warning count, the system warns the model so it can store important information in working context or archival storage2. When they exceed a flush count, the system evicts messages, writes a new recursive summary and keeps the evicted messages in recall storage, where a function call can read them2. The authors test the design on documents far larger than the window, and on multi-session chat in which agents remember, reflect and evolve through long-term interactions1.
Anthropic's note of 29 September 2025 uses a related name, agentic memory, for a narrower habit: the agent writes notes outside the context window and pulls them back later3. Its examples are a Claude Code to-do list and a NOTES.md file, which the agent can read after the context is reset3. The same note says a memory tool, then in public beta on the Claude Developer Platform, stores and consults information outside the window through files3.
Example
In MemGPT's conversational design, working context holds key facts and preferences, and a function call updates that text inside the prompt2. Figure 4 of the paper shows a conversation snippet in which the system updates information stored in working context2.
Why it matters
A fixed context window blocks long conversations and analysis of documents that do not fit, which is the limit MemGPT is built to work around1.
Questions people ask
Is agent memory the same as the context window?
No. In MemGPT, main context is the tokens in the prompt, including working context and a message queue2. Archival storage and recall storage sit outside that window until a function call moves data in2.