# Agent memory

> Agent memory is the set of techniques that let an AI agent keep and reuse information beyond a single model call, such as the current conversation, facts about a user, past actions or lessons learned, so it can act consistently over time.

Also called: AI memory, LLM memory, long-term memory, conversation memory, persistent memory. Category: Agents and automation. Source: https://aibuildindex.com/glossary/agent-memory

## In the index

- Custom AI agent: median $3,850, middle half $600 to $10,000, 2,831 priced briefs (https://aibuildindex.com/cost/custom-ai-agent)
- Vector databases: median $4,000, middle half $500 to $11,400, 264 priced briefs (https://aibuildindex.com/skills/vector-databases)

A language model has no memory of its own between calls; it only knows what is sent to it each time. Agent memory is everything a builder adds so that an agent remembers what matters: what was said earlier in a conversation, a customer's preferences, which tasks it already finished, or which approach worked last time. For a business buyer memory is what makes an assistant feel continuous rather than starting from zero, and it raises real questions about storage, privacy and cost.

## How it works

Builders usually separate memory into layers:

- **Short-term or working memory.** The recent conversation and intermediate results, passed into the model's [context window](https://aibuildindex.com/glossary/context-window). When it gets too long, older parts are summarised or dropped.
- **Long-term memory.** Facts stored outside the model, in a database or [vector database](https://aibuildindex.com/glossary/vector-database), and retrieved when relevant, much as in [retrieval-augmented generation](https://aibuildindex.com/glossary/retrieval-augmented-generation).
- **Structured state.** Records such as customer ID, open tickets or task progress kept in ordinary database tables.
- **Procedural memory.** Instructions or examples updated over time, for example a note that a particular supplier always sends invoices as images.

The hard parts are deciding what to save, when to retrieve it, and when to forget it. An account management assistant, for instance, might store each customer's preferred contact times and past issues, retrieve them when that customer's name comes up, and ignore everything else so the context stays small.

## What it means for cost

Memory adds design and running costs:

- **Storage and retrieval.** Extra databases, embeddings and queries add infrastructure and latency.
- **Token use.** Every remembered item passed to the model costs tokens on every call, so careless memory increases running costs.
- **Quality.** Wrong or outdated memories cause confident mistakes, so builds need ways to correct or expire them.
- **Privacy.** Remembered details are often [personal data](https://aibuildindex.com/glossary/personal-data). Users may need to see or delete them, and [retention](https://aibuildindex.com/glossary/data-retention) rules apply.

Ask a builder what the agent will remember, where it is stored, who can see it, and how a user or administrator can correct or delete it.

## Common questions

### Why does a chatbot forget what I said earlier?

Either the conversation outgrew the model's context window and older messages were trimmed, or the system was not designed to store anything between sessions. Both are design choices that a builder can change, at some cost.

### Is agent memory the same as training the model?

No. Memory is stored and retrieved alongside the model; the model's weights do not change. That makes memory quick to update and easy to delete, which training does not allow.

## Related terms

- [AI agent](https://aibuildindex.com/glossary/ai-agent): An AI agent is software built around a language model that can plan steps, call tools such as APIs, databases or a browser, look at the results and keep going until it completes a task, rather than only replying to a single message.
- [Context window](https://aibuildindex.com/glossary/context-window): A context window is the maximum amount of text, measured in tokens, that a language model can take in and produce in a single request, including instructions, documents, conversation history and its own reply.
- [Vector database](https://aibuildindex.com/glossary/vector-database): A vector database is a data store built to save embeddings, the numeric representations of text, images or audio, and to find the stored items most similar in meaning to a query, which makes it the usual search layer behind RAG systems.
- [Retrieval-augmented generation (RAG)](https://aibuildindex.com/glossary/retrieval-augmented-generation): Retrieval-augmented generation is a way of answering questions with a language model that first looks up relevant passages in your own documents, then writes an answer grounded in what it found.
- [Personal data (PII)](https://aibuildindex.com/glossary/personal-data): Personal data is any information that relates to an identifiable living person, such as a name, email address, phone number, location or customer ID; in the US it is often called personally identifiable information, or PII, and its handling is governed by data protection law.
- [Data retention](https://aibuildindex.com/glossary/data-retention): Data retention is the set of rules deciding how long a system keeps each kind of data, such as chat logs, recordings, prompts and documents, and when it deletes or anonymises them, balancing legal duties, business needs and privacy.
