Agents
Memory and chat history
How to control what an AI agent remembers: chat history within a conversation and memory across conversations.
An agent can remember in two different ways. Chat history is what it sees of the current conversation. Memory is a store of notes it can write to and read from across conversations. They are separate settings, and you can use either, both or neither.
Chat history#
Chat history decides how many of the earlier messages in a conversation the agent receives along with each new question. Without it the agent would answer every message as if it were the first.
You find it in the Advanced tab, in the Chat history section. The switch in the section header turns it on or off. It is on for a new agent. The section header summarizes the setting, for example “Last 10 messages · 8000 tokens”.
With the switch on, you can set:
- History Message Count. How many recent messages to include. The default is 10, and you can choose from 1 to 50.
- History Max Tokens. The most text from history to send. The default is 8000, and you can choose from 100 to 8000 in steps of 100.
- Message Types. Which kinds of messages count: User Messages, AI Messages and Tool Calls. By default the agent sees user and AI messages.
A longer history gives the agent more context, and it also means more text goes to the model with every message.
Memory#
Memory lets the agent keep information beyond one conversation, such as a customer’s preferences or facts it learned. It is off for a new agent.
You find it in the Memory section of the Preferences tab. Turn on the switch in the section header, then set:
- Memory Category. The group of memory entries the agent reads from and writes to. You must pick one. While memory is on and no category is picked, the builder warns “Pick a category, or turn Memory off. The agent refuses to run while Memory is on with none picked.” You create and manage categories under memory.
- Access Mode. Read Only lets the agent search memory. Read/Write also lets it add and update entries.
- Read Memory Prompt. Instructions that tell the agent how and when to use the read tools.
- Write Memory Prompt. Instructions for how and when to use the write tools. It matters in Read/Write mode.
- Offload Flow Input. When on, the input of the run is stored and the agent can fetch it later with a tool named
get_offloaded_memory. It is off by default.
The two prompts start with defaults that work for most agents. Edit them when the agent writes too much, too little or the wrong things.
Memory belongs to a category
The agent stores and retrieves entries through the category you pick. Agents that use the same category work on the same memory, so use a separate category when two agents should not share notes.
Which to use#
| You want | Use |
|---|---|
| The agent to follow a back-and-forth conversation | Chat history |
| The agent to know something from yesterday’s conversation | Memory |
| Answers based on your documents | A retriever tool, see agent tools |
If something goes wrong#
- If the agent stops answering after you switch memory on, check that a category is picked.
- If it forgets what you said two messages ago, check that the Chat history switch is on and that User Messages is selected.
- If it writes nothing to memory, check that Access Mode is Read/Write.