AI agent memory explained: task memory, long-term memory and retention

Updated · 5 min read

What a model actually remembers

A language model has no memory of its own between calls. Each call receives a block of text, called the context, and produces a response. Anything the agent appears to remember is text that your software put back into that block. If you do not send it again, the model has no knowledge of it.

This is why memory is an engineering decision, not a switch you turn on. The questions are what you place in the context each time, how much space it takes, and who is allowed to see it.

Task memory: the working context for one job

Task memory holds what the agent needs to finish the current job: the request, the records it has read, the tool results and the steps it has taken. It usually lasts only as long as the task. When the job ends, the working context is discarded unless you choose to save a summary.

Long tasks can fill the context space, so good designs summarise older steps rather than carrying every raw result forward. Check your model provider's current documentation for context limits before you design around them.

  • The original request and the brief.
  • Tool results, such as a customer record or an excerpt from a file.
  • A short list of the steps taken so far and what remains.
  • Any answers a person gave during the task.

Long-term memory: storing preferences and history

Long-term memory is information kept between sessions, such as a customer's preferred language, a standing approval rule or a history of past tickets. It is almost always stored in an ordinary database, and the agent reads a selected part of it at the start of a task. The agent does not carry the whole database in its head.

Be strict about what you store. A preference that staff recorded with a source and a date is worth keeping. A guess the model drew from one ambiguous message is not.

  • Store explicit facts with a source and a date, such as a contact channel that a staff member recorded.
  • Store the reason a preference exists when that reason affects decisions.
  • Do not store guesses the model inferred from a single message.
  • Do not store passwords, card numbers, or sensitive health or identity details unless you have a clear need and strong controls.

Retention, privacy and deletion rules

Every stored memory is personal data if it relates to a person. Decide how long each kind of memory is kept, who can read it, and how a person can ask for it to be corrected or deleted. Write these rules down before the agent starts storing anything, and check them against the data protection law in each market you serve, using the official text.

Make deletion work across the whole chain. A deleted memory should not survive in a cached summary, a log or a backup beyond the period you have set. Confirm the details with your legal adviser, because the answer depends on where your customers are.

Why unlimited memory makes agents less predictable

It is tempting to remember everything. The result is an agent whose behaviour depends on old, conflicting or irrelevant notes. A preference from long ago can override a current policy, and one odd conversation can shape every later answer. The more the context holds, the harder it is to explain why the agent did what it did.

Keep memory narrow and let it expire. Load only the entries a task needs, rank current rules above past notes, and let staff correct or remove an entry that is wrong. A short, reviewed memory is far easier to test than a long, unchecked one.

How to test memory

Test memory with the cases that break it: a changed preference, a note that contradicts a current record, a deleted record, and a request from someone who should not see the memory at all. Keep a log of which memory the agent loaded for each task, so a surprising answer can be traced back to its cause.

How Hundred Seas helps

Hundred Seas is a product studio in Taipei that builds AI agents and AI CRM systems on Claude and on OpenAI models. Memory is where an agent CRM earns or loses trust, so we choose the model and the storage for each client on cost, speed, quality and where the data has to stay.

Scope takes about one week at a fixed price and ends in a written plan, a clickable prototype and a firm quote. The build runs two to four weeks in weekly releases, and a monthly run plan keeps the memory rules and the software maintained as your business changes.

Questions

Do AI chat products remember my past conversations?
Some consumer chat products offer a memory feature that stores selected notes between conversations. How it works, what is kept and how to delete it depends on the product and its settings, so check the provider's current help pages. Business agents you build should have memory designed on purpose, rather than inherited from a chat product.
Is agent memory the same as training the model?
No. Memory is information placed into the context or stored in a database and read back later. Training changes the model's internal weights and is a separate, much larger process. Your stored notes do not teach the base model anything, and deleting a note removes it from what the agent sees, which is the change you usually need.
How much should an agent remember about each customer?
Only what changes what the agent should do: a preferred language, a consent status, open issues and the decisions staff have recorded. Avoid storing full conversation transcripts by default. Set a retention period for each field, and let staff review what is kept. Less data is easier to justify under privacy rules.
Can memory make an agent give wrong answers?
Yes. Old notes can be out of date, and one incorrect entry can repeat in every later task. Attach a source and a date to each entry, prefer current records over remembered summaries, and give staff a quick way to correct a memory.
Where should agent memory be stored?
Usually in a standard database that you control, with the same access rules as any other customer data. Keep it in the region your data rules require, and check your database provider's current terms. Storing memory inside a prompt or a chat transcript makes it hard to find, correct or delete.

Have a project in mind?

Tell us what you want to build. We reply with a plan, not a sales call.

AboutAI agent memory explained: task memory, long-term memory and retention