Retrieving relevant memory can reduce the amount of context we send between AI agents compared with replaying entire chat transcripts. The difference becomes more important as conversations grow and multiple agents need access to the same information. We can understand this cost by comparing token usage, retrieval overhead, and the number of handoffs in a shared workflow. Keep reading to see how we can compare both approaches fairly.
Why Transcript Replay Can Increase Token Costs
A conversation transcript contains useful information, but it also includes details that may not matter to the next task. When we pass the entire conversation to another agent, we pay for both relevant and unrelated context.
For example, imagine that we have a planning agent, a research agent, and an execution agent. The planning agent discusses the task with us, the research agent collects information, and the execution agent uses the findings to complete the work.
If every agent receives the full conversation history, each handoff sends many of the same tokens again.
This creates a repeated cost.
The total token usage depends on several factors, including transcript length, the number of agents, and how often we repeat the handoff. A short conversation may not create a noticeable difference, but a long-running workflow can make repeated context transfer more expensive.
Setting Up a Simple Three-Agent Test
To compare both methods, we need a consistent workflow. Our example uses three agents that share information while working on one fixed task.
Each agent has a separate responsibility:
| Agent | Responsibility | Required Context |
|---|---|---|
| Planning Agent | Defines the task and decisions | User goals and task requirements |
| Research Agent | Collects supporting information | Task details and planning decisions |
| Execution Agent | Completes the assigned work | Research findings and final decisions |
We use one shared memory scope to store information that other agents may need. The goal is to preserve useful facts and decisions without requiring every agent to read the entire conversation.
For a fair comparison, we keep the following conditions consistent:
All three agents receive the same task and have access to the same original information.
Both methods use the same model, task requirements, and output expectations.
We also separate context-transfer costs from output tokens. This helps us focus on the cost of sharing information rather than differences in how agents generate their answers.
Method A: Sending the Full Transcript
The first method uses transcript replay. We collect the conversation history and send the complete transcript whenever another agent needs the context.
For example, the planning agent may produce a conversation containing 6,000 tokens. When the research agent starts working, we send all 6,000 tokens. When the execution agent begins, we send the same history again.
Our token calculation looks like this:
| Handoff | Tokens Sent |
|---|---|
| Planning to Research | 6,000 |
| Research to Execution | 6,000 |
| Total | 12,00 |
These figures are illustrative inputs for explaining the calculation, not results from a real benchmark.
The main issue is repetition. Even if only a small section contains important decisions, the receiving agent still processes the complete transcript.
This method is straightforward because we do not need to create a separate memory structure. However, the amount of information sent can increase as the conversation becomes longer.
Transcript replay can still make sense when the conversation is short or when the next agent genuinely needs the full discussion. The problem appears when we repeat this process across many agents and tasks.
Method B: Retrieving Relevant Agent Memory
The second method uses a shared memory layer. Instead of sending the entire transcript, we extract useful information, store it, and retrieve only the parts needed by each agent.
Our workflow has three main stages.
1. Store Important Information
We first identify useful facts, task requirements, decisions, and relevant events from the original conversation.
We then organize these details into a structured memory system. This makes it easier to retrieve information based on the next agent's responsibilities.
For example, the planning agent may store the project requirements and important decisions. The research agent can later access those details without receiving every message from the planning conversation.
2. Flush and Index the Memory
Before another agent retrieves the information, we need to make sure the memory write process has completed.
Some memory systems process conversation messages asynchronously. This means recently added information may not be searchable immediately.
We may need to flush the session so the memory extraction process can process the latest messages. The system can then extract useful information and index it for retrieval.
We should also account for indexing delays when measuring search latency. Otherwise, our benchmark may overlook the time required to make new information available.
3. Retrieve Only Relevant Context
When another agent starts working, we search the shared memory using the current task as the retrieval query.
Instead of returning the entire conversation, the system selects a limited number of relevant memory entries.
A hybrid search approach can combine keyword matching and semantic retrieval. Keyword matching helps locate exact terms, while semantic retrieval helps identify information based on meaning.
We can also use a small top_k value to limit how many results enter the next agent's context.
This approach helps control the number of tokens sent during each handoff.
For a deeper look at how agents can access shared information without repeatedly passing full conversation histories, we can explore evermind.ai/features/shared-memory-of-ai-agents.
4. Pass the Retrieved Context
Once the system retrieves relevant information, we send those memory entries to the receiving agent.
For our example, assume that each handoff needs only 800 tokens of retrieved context.
The calculation becomes:
| Operation | Tokens |
|---|---|
| Initial memory write | 6,000 |
| Research retrieval | 800 |
| Execution retrieval | 800 |
| Total | 7,600 |
These numbers are also illustrative. Actual usage depends on the memory extraction process, retrieval results, metadata, and system implementation.
The important difference is that we write the information once and retrieve smaller sections when needed.
Comparing the Token Costs
We can now compare the two approaches using the same illustrative scenario.
| Metric | Transcript Replay | *Shared Memory |
|---|---|---|
| Initial context | 6,000 | 6,000 |
| Context per handoff | 6,000 | 800 |
| Number of handoffs | 2 | 2 |
| Total tokens | 12,000 | 7,600 |
In this example, transcript replay uses 12,000 tokens, while the shared memory approach uses 7,600 tokens, including the initial memory write.
That represents an illustrative reduction of approximately 36.7% in context-transfer tokens.
We can calculate the difference using this formula:
Token reduction = (Replay tokens - Memory tokens) / Replay tokens × 100
For our example:
(12,000 - 7,600) / 12,000 × 100 = 36.7%
This calculation does not include model output tokens, embedding costs, indexing overhead, or infrastructure expenses. Those costs need to be measured separately before making a complete cost comparison.
What Should We Measure Beyond Token Usage?
Token count is important, but it does not tell us everything about a memory system's performance.
A useful benchmark should include several measurements so we can understand both cost and speed.
| Metric | What It Measures | Why It Matters |
|---|---|---|
| Tokens per handoff | Context tokens sent to each agent | Shows repeated context usage |
| Total input tokens | All context tokens across the workflow | Helps estimate overall input cost |
| p95 search latency | Time taken by the slowest 5% of retrieval requests | Shows whether retrieval remains responsive |
| Memory write overhead | Tokens used to extract and store information | Captures the initial memory cost |
| Estimated API cost | Input and output charges based on model pricing | Connects token usage to actual spending |
We should also record retrieval quality. A system that returns fewer tokens is not necessarily better if it misses important decisions.
For example, if the execution agent fails to retrieve a critical requirement, the workflow may need another search or a repeated task. That creates additional costs that a simple token comparison would miss.
Where the Two Approaches Start to Diverge
The difference between transcript replay and memory retrieval depends on how much context we send and how many times we repeat the process.
We can express the basic comparison with two simple formulas.
Transcript replay:
Total tokens = Transcript length × Number of handoffs
Shared memory:
Total tokens = Initial write cost + (Retrieved context × Number of handoffs)
Using our illustrative values, we can see how the costs change as the number of handoffs increases.
| Number of Handoffs | Transcript Replay | Shared Memory |
|---|---|---|
| 1 | 6,000 | 6,800 |
| 2 | 12,000 | 7,600 |
| 3 | 18,000 | 8,400 |
| 4 | 24,000 | 9,200 |
| 5 | 30,000 | 10,000 |
The shared memory approach has a higher initial cost in this example because we include the 6,000-token memory write. However, each additional handoff adds only 800 tokens instead of 6,000.
In this example, shared memory costs 6,800 tokens after the first retrieval, compared with 6,000 tokens for transcript replay. After the second retrieval, shared memory reaches 7,600 tokens, while transcript replay reaches 12,000 tokens.
Therefore, the shared memory approach becomes more efficient from the second handoff onward under these assumptions.
These figures show the expected cost pattern under our assumptions. They are not measured production results, and real results may change with memory extraction, retrieval quality, and infrastructure overhead.
Practical Lessons for Building a More Efficient Handoff
We do not need to replace every transcript with a memory system. The better approach depends on the amount of information each agent actually needs.
For short tasks, passing a small conversation history may be simpler. For longer workflows, a shared memory layer can help reduce repeated context transfer.
We can improve the process by keeping a few practical principles in mind.
Keep Retrieval Bounded
We should start with a small top_k value and increase it only when the receiving agent needs more information.
Returning fewer, more relevant memory entries helps control input size. We should also monitor retrieval quality to make sure important facts are not excluded.
Use Hybrid Search
Keyword search and semantic search solve different problems. Combining them can help us find exact project details while also retrieving related information that uses different wording.
We should test both methods with real task queries before deciding which retrieval settings work best.
Preserve Important Decisions
Not every conversation message deserves a place in shared memory. We should prioritize information that can affect future tasks, such as user requirements, completed decisions, constraints, and unresolved issues.
This keeps the memory useful without turning it into another copy of the original transcript.
Reducing Token Costs With Better Agent Memory Handoffs
Transcript replay offers a simple way to share context, but its cost can increase when multiple agents repeatedly receive the same conversation history.
Our illustrative calculation shows why retrieving relevant memory can become more efficient as the number of handoffs grows. Instead of sending thousands of repeated tokens, we can store useful information once and retrieve smaller sections when needed.
However, token savings should not be our only goal. We also need to consider retrieval accuracy, search latency, memory write overhead, and the quality of the final output.
A good starting point is to test both approaches with the same task, measure their total input costs, and gradually improve retrieval settings.
When we treat agent memory as a bounded retrieval layer rather than a way to resend everything, we can build multi-agent workflows that use context more carefully and keep repeated handoffs easier to manage.
Top comments (1)
The 6,000-token-per-handoff math is the honest part — three agents replaying the same transcript turns one conversation into 12,000 tokens before any work happens. The pushback I'd add: retrieval isn't free either. The flush-and-index step has its own cost, plus staleness risk when a decision changes mid-run. Did you measure at what transcript length the index overhead stops paying for itself?