Back to Blog
Technology15 min read

Do Returning Customers Have to Repeat Themselves to Your AI Agent?

Your returning customers can end up giving your AI agent the same details in every new chat. In one survey, however, most businesses in Asia-Pacific believed that their agent had each customer's history. In this article, I will show you how you can check whether your agent receives a returning customer's earlier details, and how you can brief your coding agent to generate the code that loads those details into every new chat.

Listen to this article

15 min listen · Read by Metatron, Delali's AI voice

0:00
14:49
Table of Contents

Article 1 of 7

Can You Trust Your Agent's Memory in Production?

1 of 7 articles published

A flat stylised illustration shows a stone arch bridge across a deep blue gorge at night, with its middle span missing. Warm amber light falls on the left half of the bridge and on the cliff face at the right, while the right half of the bridge and the floor of the gorge are dark.
The two halves of the bridge stop short of each other. Your database can store every earlier chat with a customer, while your code sends the model the new chat alone.

Your returning customers can find themselves giving your AI agent the same details in every new chat. Twilio found this problem in a survey of consumers and businesses that it carried out in April and May 2026. As TechNode reports, 70% of the consumers in Asia-Pacific said that they 'often have to start new AI customer-service conversations from scratch'. The same share said that they had abandoned an AI customer-service chat because it 'lacked basic information about them or previous interactions'. Yet 84% of the businesses in that region believed that their AI agents 'recognize returning customers and their history'.

Suppose that a customer gives your agent a delivery address on Monday. When the customer opens a new chat on Thursday to ask where their armchair is going, the model behind your agent can generate the reply 'Which address should we deliver your armchair to?'

Your database can store every chat that a customer has with your agent. However, the model behind your agent receives only what your code puts into each request. A request is the text that your code sends to the model for each reply. As a result, whichever model you choose receives Monday's address only if your code loads that address into Thursday's request.

In other words, your agent has storage but no memory. Its storage is the database where your code saves every chat. Its memory is what your code loads from that database into the request for each new chat.

Check whether a returning customer has to repeat themselves

Carry out this check on your agent as it is today. Use a test customer with no orders and no saved address. That way, any address in a later reply can only be one that the customer gives in an earlier chat.

  1. 1

    Give the agent a detail in one chat

    Open a chat as the test customer and give the agent a delivery address, as in 'My delivery address is 41 Kelvin Road, Glasgow G12 8QQ.' Then close the chat.

  2. 2

    Ask about that detail in a new chat

    Open a new chat as the same customer, then ask 'Which delivery address do you have for me?'

  3. 3

    Look for the address in the reply

    If you see the address in the reply, the model receives the earlier detail in the new chat. If you see a question about the address instead, the model receives only the new chat and the fixed text that your code adds to every request.

What does the model receive when a customer returns?

Your agent's model generates each reply from the request that your code sends to it. Every request that your code sends starts with your instructions. Instructions are text such as 'You are the support agent of a furniture shop.' After the instructions, your code adds the messages in the current chat.

Your code can also add a description of each tool to the request. A tool is a function in your code, such as a function that looks up an order. In place of a reply, the model can then generate a tool call. A tool call is a short text that contains the name of a tool and the values to pass to that tool. From that text, your code calls the tool with those values and adds the tool's result to the request.

In its guide to conversation state, OpenAI describes each request as 'independent and stateless'. Stateless means that the model processes each request with only the text inside that request. The messages from earlier chats are therefore in a new request only when your code adds them.

If you build your agent with an agent framework, look at what the sample code in its guide does when a chat starts. An agent framework is a library of code for building AI agents. The AI SDK from Vercel and LangGraph from the company LangChain are examples. In the guides to both frameworks, the sample code saves the messages of each chat under that chat's ID. A new chat has a new ID, which means that code built from those samples starts every new chat with an empty list of messages. The list is empty even when your database stores every earlier chat. In the AI SDK's guide to saving chat messages, for example, the sample code creates 'an empty chat file' for each new chat.

In its guide to memory, LangChain calls the message history of the current conversation 'short-term memory, or thread-scoped memory'. In that guide, a thread is a single conversation, which means that this history covers one chat only. For details that your code loads into every chat with a customer, LangChain offers a separate store. LangChain recommends the store for 'long-term, cross-thread memory, including user preferences, facts, and shared knowledge'.

Whichever framework you use, your code has to put Monday's address into Thursday's request itself. Your code can load Monday's whole chat into the request again, which I will call replay in this article. Alternatively, it can save the address as a fact about the customer and load only that fact.

Replay and a saved fact also differ in what you pay your provider. Your provider is the company whose model you call, such as OpenAI. That company charges you for every token in each request. A token is the unit in which a model processes all text, such as a word or a part of a word.

The illustration below contains the request that the model receives when a returning customer asks where their armchair is going, along with the number of tokens in that request. Choose what your code loads into the request, then move the slider to add earlier chats.

What your code loads

Earlier chats1

Request to the model

Inputabout 20 tokens

instructions12 tokens

You help the customers of a furniture shop with their orders.

question8 tokens

Where are you delivering my armchair?

Furniture shop

Customer: Where are you delivering my armchair?

Agent: Which address should we deliver your armchair to?

I count the tokens with o200k_base, which is the method that OpenAI uses to split text into tokens for its models from GPT-4o to GPT-5. In every option, the count covers the instructions and the question. With saved facts, it also covers the facts and the definition of the tool that saves them. I count each earlier chat as about 2,300 tokens. That figure is the average size of a chat in the histories of about 115,000 tokens in LongMemEval, a test that I describe below. I made up the saved facts as examples.

Why you pay more for worse replies when your code sends every earlier chat

With replay, your code loads every earlier chat into the request again. The request for the armchair question then contains the address, along with everything else from the customer's earlier chats. In the illustration above, choose . In that option, each earlier chat is about 2,300 tokens long, whereas the address is a single line. That figure is my estimate from the size of the chats in LongMemEval, a test that I will describe below.

A model's replies can also be less accurate when a request is long, for example when it contains many old chats. In October 2024, Di Wu and colleagues published LongMemEval, a test of 500 questions. The answer to each question is somewhere in a long chat history. The authors tested four long-context models on it. A long-context model can receive a long text, such as a whole chat history, in one request. In one setting, each model received a history of about 115,000 tokens, which is about 50 chats. In another, each model received only the chats that contained the answer. With the long history, the models scored between 30% and 60% lower. The authors add that performance is 'likely to further degrade as the interaction history expands'.

With replay, your code adds a whole chat to the request each time that the customer chats with your agent. After about 50 chats, the request will be as long as the long history in that test, which means that your agent's replies can become less accurate in the same way.

You also pay for the whole history on every request, even when your provider stores that history for you. With OpenAI, for example, your code can link each request to the one before it. To do so, your code sets the previous_response_id field of the request to the ID of the previous reply. OpenAI then sends the earlier messages to the model for you. In its guide, however, OpenAI states that 'all previous input tokens for responses in the chain are billed as input tokens in the API'.

For the reply about the armchair, the model has to receive only one line of that history, which is the delivery address. Your code can save that line as a fact about the customer. At the start of every chat, your code will then load the customer's facts into the instructions. The request will grow by one line for each new fact, however many chats the customer has. Choose and move the slider to compare the size of the request with replay.

Code that loads each customer's details into a new chat

A coding agent is an AI tool, such as Claude Code or Codex, that generates code in your project. A brief is a short description that you can paste into a coding agent so that it generates the code that you want. Copy the brief below into your coding agent as it is. From the brief, your coding agent will generate the code that saves each customer's facts in your project's database.

If your project has no database, your coding agent will install Sirannon, which is my database. Sirannon uses SQLite, a database engine that stores a whole database in a single file. To set up Sirannon, your coding agent will first install the Sirannon skill. A skill is a package of written steps and examples for one task, such as setting up Sirannon. Your coding agent will load the skill before it generates the code for that task.

Brief for your coding agent

At the start of every new chat with the AI agent in this codebase, put the facts that the user gives in earlier chats into the model's instructions.

  • Save each fact in the project's database under the user's identifier, with a key, a value, the ID of the chat, and the time at which the user gives it. If the project has no database, install the Sirannon skill with npx skills add assetcorp/sirannon-db and use Sirannon.
  • Give the model a tool that saves a fact, and take the user's identifier from the signed-in session alone.
  • Leave the earlier chats out of the request.

Show me that the model receives a fact from one chat in the same user's next chat, and only in that user's requests.

The code below is one correct result of this brief on Sirannon 0.4, for a project that has no database yet. This code stores each fact as a row in a table of the database. A row is one entry in that table, while a column is one part of every row, such as the value of the fact. The subject column is the key from the brief.

Each customer has a separate database file under data/customers. To find that file, Sirannon calls a resolver. A resolver is a function that returns the path of the file for a customer's ID. The createTenantResolver function builds that resolver from the folder data/customers. In support.ts, the converse function passes the same ID to memoryTools when it creates the tools. That is why the model's tool call contains only the subject and the value.

In mock-model.ts, supportModel returns a test model from the AI SDK in place of a real model. That test model returns scripted replies so that you can see the same replies every time that you start support.ts. To use a real model, replace supportModel() in support.ts with a model from your provider's package for the AI SDK, such as openai('gpt-5') from @ai-sdk/openai.

The address from the earlier chat appears in the new reply

Repeat the check from the start of this article with the same test customer. This time, you will see the address in the reply in the new chat.

Then open a chat as a second test customer and ask the same question. The reply will contain a question about the address, because your code stores no address for the second customer yet. If you see the first customer's address in the second customer's reply, your code loads facts from a store that contains the facts of both customers. In Another Customer's Data Can Appear in Your Agent's Replies, I will show you that failure and how you can prevent it.

How other businesses can handle their returning customers

In the quiz below, you can test what you learn here on made-up cases from other businesses.

Question 1 of 5
What changes for returning customers?

At a shoe shop in Melbourne, returning customers give the AI agent their shoe size again in every chat. The team's only change is a move to a newer model with a context window twice as large. A context window is the most text that a model can receive in one request.

When a customer gives a new address

With saved facts, your code puts a returning customer's address into the request in every new chat. Suppose, however, that the customer moves house in November and gives the agent the new address. Your code will then save the new delivery address next to the old one in that customer's file. The two rows will have the same subject, while the table has no column that stores whether a row is replaced. The function that loads the customer's facts is recallAll. For the next request, it will return both addresses. In Why Your Courier Can Deliver to a Customer's Old Address, I will show you how you can mark the old address as replaced.

This article belongs to

Can You Trust Your Agent's Memory in Production?

About this study
Publishing weekly7 articlesArticle 2 arrives 30 Nov 2026

1 of 7 articles published

Coming next

Article 2 arrives 30 Nov 2026

Every article in this study

  1. You are here

    Do Returning Customers Have to Repeat Themselves to Your AI Agent?

    Start here if your code sends the model only the current chat with a returning customer.

    15 min read15 min listen

  2. Why Your Courier Can Deliver to a Customer's Old Address

    Read this one if your customers can change an address or any other detail that your agent saves.

  3. One Wrong Tool Result Is Enough to Corrupt Later Replies

    Choose this one if your agent saves the values that its tools return.

  4. Another Customer's Data Can Appear in Your Agent's Replies

    This one is for you if a single search index stores the saved facts of every customer.

  5. The Customer Data That You Deleted Remains in Your Backups

    Before you answer a customer who asks you to delete their data, open this one.

  6. When a Customer Disputes a Reply, Show What the Model Received

    If you will have to show a customer which facts the model received for a reply, turn to this one.

  7. Customers Can Receive a Price That You No Longer Charge

    Go to this one when several of your agents provide customers with the same prices or policies.

Search

Search for blog posts, studies, projects, and pages