Memory (Short-term / Long-term)

What an AI agent remembers: the current conversation context, and the knowledge and preferences that remain available in future sessions.

AI memory, short-term memory, long-term memory, context memory

Definition

Memory in AI agents refers to the mechanisms that allow an agent to retain information temporarily within a session (short-term memory) or preserve knowledge across multiple sessions (long-term memory).

What is it?

Memory in AI agents has two layers. Short-term memory covers everything the agent tracks during the current session: the instructions, the conversation history, and data it has already retrieved. Once the session ends, this memory is gone unless it is saved.

Long-term memory is knowledge stored outside the session, typically in a database or vector store. An agent can query that knowledge when it becomes relevant, allowing it to pick up where a previous conversation left off, or to access company-specific information that was not part of its training.

Why it matters for SMEs

Without memory an AI agent starts fresh on every task. That works for one-off questions, but not for processes where context builds over time: client relationships, project status, earlier agreements. Memory is what turns an agent from a single-use tool into a functioning digital colleague.

  • Short-term memory ensures an agent completes a multi-step task coherently: it remembers what has already been done and adapts the next step accordingly, without you having to repeat everything.
  • Long-term memory makes personalisation and continuity possible: an agent that recognises a client, knows their previous questions, and builds on that context produces better output than one that starts blank every time.
  • Good memory management is also a security question: what an agent remembers must be auditable, controllable, and erasable, especially when client data is involved.

Deciding which memory to use, how long to retain it, and who has access is a design judgement that determines how useful and safe an agent is in practice.

How it works

Short-term memory works through the model's context window: all the text exchanged in the current conversation sits there and is visible to the model. Long-term memory works through external storage that the agent must actively query.

  1. During a session the agent stores the conversation history in the context window.
  2. When relevant information from the past is needed, the agent sends a query to the external memory store.
  3. The retrieved information is added to the current context so the model can reason over it.
  4. After the session the agent can write relevant new information back to the external store for future use.

The context window has a limit: with very long sessions or a lot of background material you need to prioritise what fits inside it. Sound memory strategy is therefore both a technical and a content design question.

Example in practice

Picture a real estate agency using an AI agent for client communication. The agent has access to a long-term memory store containing each client's search profile: preferred area, budget range, property type, and previously viewed listings. When a client gets in touch, the agent retrieves their profile and drafts a personally relevant response without the client needing to restate their preferences. Any newly mentioned preferences are written back to the profile after the conversation ends.

Comparison and misconceptions

Short-term memory is active for the duration of a conversation and disappears afterwards, comparable to working memory in a person. Long-term memory is persistently stored and remains available across sessions, but the agent must actively query it. The difference lies in duration and in how information is stored and accessed.

Frequently asked questions

What is short-term and long-term memory in an AI agent?
Short-term memory is the context an agent retains within a single conversation or task: what was said earlier or what has already been done. Long-term memory is information that persists between sessions: customer history, preferences, previously completed tasks. Without explicit memory storage, every session starts from scratch.
Why does an AI agent need memory?
Without memory an agent cannot build on what was done before. For simple tasks that is not a problem, but the moment an agent works across multiple sessions with the same customer or on the same project, retaining context is essential to being useful. Memory is what turns a one-off tool into a working digital employee.
How do you build memory into an AI agent?
Via an external database or memory layer that the agent updates after each session. Common approaches include vector stores for semantic retrieval, simple key-value storage for fixed profile data, or summaries of previous conversations passed as context. The right pattern depends on what the agent needs to remember and for how long.
From insight to impact

Curious what AI
can do for your processes?

In a free intro call we look at where AI saves you the most time, and what a connected setup looks like.