Preload or Tool Call? Benchmarking How Memory Reaches an AI Agent
When does an AI agent actually need memory? I tested three agents on the same question to find out, and compared two ways of giving them memory: handing it over before every call, or letting the agent look things up itself.
There are two common ways to give an agent long-term memory. The harness can search a memory store before every call and put the results in the prompt. Or the agent can get the store as a tool and decide when to query it. Both reach the same facts. They differ in who decides, and in what that decision costs.
This benchmark isolates that difference. Retrieval is held constant, so the only variable is how memory reaches the model. It answers three questions: when does memory change the answer, what does each delivery design add in latency, and what does it add in tokens.
Three agents
The benchmark compares three agents that differ in one thing only: how memory reaches the model. All three run on Claude Haiku with the same history and the same question. Each one tests a different answer to the question of who decides when to look something up.
1. No memory: the baseline
The agent receives the conversation history and the question, nothing else. Whatever is not in its context window does not exist for it. This agent shows what the model can do on context alone, and where that stops being enough.
2. Preloaded: the harness decides
Before the model runs, the harness searches Mem0 with the question and prepends the results to the message. The model gets its memories without asking for them, in a single call. The decision to look things up is made in code, on every request.
Preloading has to live in harness code, not in the agent's instructions. An instruction to "search first" would leave the decision with the model and turn this agent into a variant of the third. The agent also has the Mem0 toolkit, but made no tool calls in any run.
3. MCP only: the model decides
The agent has the Mem0 toolkit over MCP and nothing preloaded. It reads the question, decides whether it needs to search, calls the tool, and answers in a second model call. Memory becomes a tool the model can reach for, and the model pays for every reach.
Building the agents
I built all three agents on JigJoy. It covers the whole loop in one place: describe an agent, test it in chat, and deploy it. All three were created in a single Studio session.

Every deployed agent gets its own HTTP endpoint, /v1/agents/<id>/messages, and one account API key calls all of them. That is exactly what a benchmark needs. The harness is a plain Python script that sends the same request shape to three URLs, so any difference in the results comes from the agent, not the client.

Data
Each of 20 synthetic cases is a project-assistant conversation. It opens with a target decision, such as "For project Atlas, we agreed to use Golden Crane as the staging alias", followed by four near-identical decisions for other projects and then filler about owners, reviews and releases. The target appears exactly once.
Every case is cut at five checkpoints of roughly 1k, 4k, 8k, 16k and 32k tokens, and each ends with the same probe: "What staging alias did we agree on for Atlas? Reply with the name only." An answer is correct if it contains the expected name. 20 cases, 5 checkpoints and 3 agents give 300 runs, all of which completed.
Controls
Context policy. Every agent sees the most recent 17,000 characters of history, about 4.25k tokens. The target fact sits at the start of the conversation, so it is visible at 1k and 4k and evicted from 8k on. That gives two clean conditions: fact in context and fact out of context.

Simulating overflow. Haiku's real context window is far larger than 32k tokens, so none of these conversations would overflow it on their own. The benchmark simulates the overflow instead. Cropping the history to the most recent 17,000 characters is what an agent harness does when a conversation outgrows the window: the oldest turns are dropped and the newest ones are kept. From the model's side the two cases are identical. A turn that was cropped and a turn that never fit are both simply absent from the prompt. What the test depends on is where the window edge falls relative to the fact, not how large the window is. A larger window moves the point at which memory starts to matter; it does not change what happens there.
Cropping does not reproduce one thing: a model reading a very long prompt that still fits, where a fact buried deep in the context can be missed even though it is present. That is a separate question from overflow, and this benchmark does not measure it.
Retrieval. Before each case the harness wipes the Mem0 scope and writes the case's five facts verbatim, with infer=false. The search limit is five, so every search returns the full set, target and distractors included. Retrieval is perfect by design. Verbatim storage matters here: in an earlier run with Mem0's fact extraction enabled, only 27% of memory runs found the answer.
Measurement. Latency is wall clock from request to final answer, including the Mem0 search for Preloaded. Tokens are estimated as characters divided by four, because the API does not return usage.
Accuracy

While the fact is in context, all three agents answer 20 of 20. Once it is evicted, No memory answers 0 of 20 and both memory agents still answer 20 of 20. Given perfect retrieval, the two designs are indistinguishable on accuracy. The 8k, 16k and 32k checkpoints all fall on the same side of the window, which is why their results are identical.
Latency

The cleanest comparison is the 1k checkpoint, where every agent sees the fact and the Mem0 search is cold. Preloading added 0.53 s on the mean and 0.42 s on the median, the cost of one search. MCP only added 1.50 s, because it makes a tool call and then a second model round trip. Across all 100 runs per agent the gap holds: 2.86 s for MCP only against 1.24 s for No memory. Later Preloaded checkpoints reuse a cached search result, so their latency is not used here.
Tokens

Input size tracks the window: about 1k tokens at the first checkpoint and about 4.3k once the window is full. Preloading adds 81 tokens at every checkpoint, the five retrieved facts and a header, or about 2% of a full window. That figure scales with what you retrieve: longer memories or a higher limit raise it linearly. The MCP agent called the tool in 100 of 100 runs, and its real input cost is the figure shown plus the tool result and the second call.
Findings
- Memory matters at eviction, not at a token count. The threshold is set by the context policy. With a 4k window it sits between 4k and 8k; with a 200k window it would sit wherever the harness starts dropping history.
- While the fact is in context, memory buys nothing. Both designs cost latency and add no accuracy.
- With reliable retrieval, preloading is the cheaper delivery. It costs one search and a small, predictable token overhead, and it never depends on the model choosing to look.
- Tool-based memory costs a model round trip per lookup. Here it added nearly three times the latency of preloading. Its advantage, skipping lookups that are not needed, only pays off on workloads that contain such requests.
- Storage fidelity outweighs delivery design. How facts are written into the store moved accuracy far more than how they were read out.
Scope
This benchmark measures delivery, not retrieval or memory formation. The store held exactly the relevant facts, written by the harness rather than extracted from the conversation, and every search returned all of them. Every probe needed memory, so it says nothing about whether a tool-equipped agent skips lookups when it should. The 8k to 32k checkpoints test eviction from a fixed window, not long-context reasoning.
The next runs relax these controls one at a time:
- Let agents write their own memories from the conversation.
- Grow the store well beyond the search limit, so retrieval has to rank.
- Mix in questions that do not need memory, to measure when MCP only chooses not to search.
- Vary the position of the fact and run with the full history in context.