← AI glossary

AI glossary · Basic · Agents

Agent memory

Agent memory is a mechanism that lets an AI agent store information needed for the current conversation or task, along with what it learned in past conversations and tasks, and retrieve it when needed. The model itself remembers nothing once a conversation ends, so memory is managed separately outside the model.

About this term
Level
Basic · Technical terms you often meet in AI news
Fields
Agents
Added
2026-10-08
In plain words It is similar to an employee who keeps a work notebook. Current work is laid out as notes on the desk (short-term memory), and things worth keeping are written in the notebook (long-term memory) to be looked up the next time similar work comes up. However, AI relies heavily on rules designed by people for what to write down and what to look up, and it can pull out the wrong note.

How it works

It is usually split into two layers. Short-term memory is the content that fits in the context window the model reads at once; the current conversation history and intermediate task results live here. Long-term memory is records kept in external storage such as files or a vector DB, storing things like user preferences, summaries of previous tasks and learned tips. During a task, the agent selects, organizes and saves what is worth remembering, and when a new task comes in, it searches for relevant memories and puts them back into the context.

Short-term memory and long-term memoryConversation · task → Agent (LLM); Agent (LLM) → Response · task result; Short-term memory → Agent (LLM)(Read together); Response · task result → Organize what to remember(Save); Organize what to remember → Long-term memory; Long-term memory → Find relevant memories; Find relevant memories → Short-term memory(Recall)Conversation ·taskAgent (LLM)Response · taskresultShort-term memoryContext windowOrganize what torememberLong-term memoryFiles · vector DBFind relevantmemoriesRead togetherSaveRecall
Short-term memory and long-term memory The top row is the flow of the current task, and the bottom is the loop for saving and recalling long-term memory. Recalled memories must be put into the context before the model can use them.

Why it matters

Without memory, an agent has to hear the same explanations again every time, as if meeting someone for the first time. In long tasks, the context window can also fill up so that the agent forgets what it did earlier. Well-designed memory enables personalized responses and lets the agent continue tasks that span several days. That is why, in context engineering, what to remember and what to discard has become an important design topic.

Things to know

More memory is not always better. Outdated or incorrect memories that get recalled can actually spoil an answer, and irrelevant memories taking up the context hurt both performance and cost. Because personal information is stored, users should be able to see what is remembered and delete it. Also, if malicious content gets mixed into the memory store, it can become a channel for prompt injection.

Example

Several AI chatbot services offer a 'memory' feature that remembers things the user has shared, such as their occupation or preferred response tone, and reflects them in later conversations. Coding agents write project rules or cautions learned from previous tasks in a separate memory file and read that file first when starting a new task so they do not repeat the same mistakes.

Related terms