- Agents
- Context
- LLM systems
- Architecture
Cutting Token Overhead in a Multi-Agent System
Agent-to-agent polling and multi-turn status checks spend tokens and add latency without doing the work. A read-only export, a one-time structured extract, and a check that never sees the writer’s context.
The expensive part of a multi-agent system is rarely the step that does the work. It is the traffic between the agents.
One agent asks another whether anything changed. The answer is a reread of a log, written out as a paragraph. Another agent asks again, because a paragraph is not a field it can branch on. Each hop is a full generation. None of it edits the artifact, makes the decision, or checks the result. Context moves. The next step waits.
I want that overhead gone. The way there is dull. If a script or a small record can hold the fact, do not spend a turn on it. Save the model for a judgment a file cannot make.
The turn that does no work
Polling. An agent wakes up and asks if anything changed. The answer is either that nothing did, or a dump of whatever the other side last saw. The question is cheap to phrase. The answer is expensive, because it is generated. Most of those rounds change nothing downstream. You paid for a generation to learn that the picture was the same as last time, and you waited on it.
Back-and-forth. One agent holds a decision and needs a fact from another. The reply comes back as prose, with the question restated and the caveats mixed in. The first agent does not quite trust the prose, so it asks a follow-up. The second rereads its own history to stay consistent. That is not reasoning about the problem. It is both sides negotiating a format they should have agreed on before the first token.
The trap is that the system looks busy. Turns complete. Logs grow. The task is blocked on a conversation that is not the task. When I read a trace and cannot point at the turn where the state of the world changed, that turn was overhead.
What replaces it is a path with no model in it. Something deterministic writes down the small thing the next step needs. The next step reads it. A model runs when there is a judgment to make, and stays off the path when there is not.
Write the snapshot. Stop asking.
If the question is “what is the state,” do not ask an agent that happens to have seen the state. Read the system that holds it, with a script, and leave the answer on disk.
The script runs next to the source. A repository, a log, a tracker file, a local database: whatever is actually true. It writes a compact snapshot, JSON or a short markdown file, and only the fields a later step branches on. It is read-only against the source. It does not fix, label, or tidy while it reads. A write hidden inside an export is how you stop knowing which side changed the world. A script that reads CI status and, in the same pass, flips a retry flag or stamps the run as handled is that write: the file looks like a snapshot, and the source is no longer what you read.
The before is a loop that asks. The after is a function that writes a file and does not touch the source.
# before
loop:
reply = ask(agent, "anything new? paste the log")
act(reply.prose)
# after: read-only. same inputs, same file.
def export(source):
write("snapshot.json", {
"exported_at": source.updated_at,
"status": source.status,
"root_cause": record.root_cause,
"fix": record.fix,
"area": record.area,
"lesson": record.lesson,
"raw": source.log_path,
})
Deterministic is the whole point. Same inputs, same file. No sampling, and no pass that cleans up the wording. The moment a model touches the export, you no longer have a snapshot. You have an opinion of the state, and every reader inherits it.
Other agents do not query the owner of the data. They read the file. Reading a file is not a turn. There is no second model waiting to phrase the answer, and no chance the answer comes back as a paragraph that has to be parsed again. Consumers that need the same picture read the same bytes, instead of each paying to have it regenerated.
Keep the file small on purpose. A snapshot that pastes the raw log back in has recreated the original problem and given it a filename. Drop anything the next step will not branch on. A field that is there “for context” is context you will pay to reread.
Refresh the file when the source changes: a finished run, a new commit, an event you already handle. Refreshing by asking an agent whether anything is new, on a timer, is the poll again, with extra machinery around it.
source of truth
│
│ read-only script, when the source changes
▼
snapshot on disk ─────────────► the next step reads the file
(no model on this path)
Extract the fields once
Raw history is evidence. It is a bad default for context.
A log, a transcript, a thread: the first time through, something has to understand it. That understanding is a handful of typed fields. Write them down while the evidence is fresh. Every later run reads the fields.
The set I reach for is short. It is an example, not a schema to copy because it looks complete:
- Root cause. What actually broke, in a sentence a later run can trust without deriving it again.
- Fix. What changed, specific enough to tell a retry from a repair.
- Contribution area. Which part of the system this belongs to, so routing and review do not start from the whole history.
- Lesson. The rule worth applying next time, kept separate from the incident itself.
The test for a field is whether a later step branches on it. A field nothing reads is a second log, and I would rather omit it.
Extraction runs once. The raw source stays where it is, with a pointer, so a check can open it when a field looks wrong. The default path does not open it. Re-attaching the transcript on every run, “for context,” is how a short record turns back into the original document.
Type the fields. A free-text blob called summary invites the extractor to be vague, and it invites the next agent to reinterpret it. A required root cause, a fix that points at a change, a contribution area drawn from a closed set: that is a contract between the run that saw the evidence and the run that did not. Prose has no contract. Every consumer re-parses it, and you pay for the re-parse.
Do the extraction when you have the evidence, not when a downstream agent gets curious. Curiosity here is a poll. A record written at the source is a read.
Publish, then check from the outside
The writer is the agent with the context. The draft, the decisions, the alternatives it threw out. That context is why it can write. It is also why it is a bad verifier. Ask the same agent whether the result is good and it will argue from a transcript it already believes. You also drag that transcript into a check that only needed the artifact.
Split them.
The writer produces an artifact and publishes it. A file, a commit, a pull request, a rendered page. Publishing is the handoff. After that, the check does not receive the writer’s history. It receives the artifact and a short contract, and it should run where that history is not loaded. A clean checkout of what was published, on another machine if you have one, is the version of this I trust. A session that still has the draft open will cheat, usually without meaning to.
Use a script when the contract is mechanical. Does it build? Does the schema validate? Does the diff stay inside the paths you named? A script returns pass or fail, and a little output. No model, no inherited context, and no chance the checker helps by rewriting the thing it was asked to judge.
Some checks really are a judgment. Give those to a fresh agent with a narrow brief: the artifact, the checklist, and nothing else. Not the thread that produced the artifact. The reply should be a small structured result. What failed, where, and whether it blocks. If the check starts a conversation, the back-and-forth has moved a stage later and the savings are gone.
The property that matters is independence. A check against the published result cannot see the scratchpad. That is what you want. Verification that needs the scratchpad is the writer talking to itself, at the price of a second copy of the context.
On failure, the writer gets that short result and another turn aimed at a specific defect. It does not get a transcript of the checker thinking. The loop stays short because each side’s input stays small.
writer ──publishes──► artifact
│
▼
independent check
a script, or a fresh agent
that sees only the artifact
│
▼
short structured result
When a file is the wrong tool
A snapshot goes stale the moment the world moves and the file does not. If the decision is whether something is green right now, whether a lock is held, or whether a value is current, read the live source. A snapshot is for state that is allowed to be as of the last export. Say so in the file: what it was exported from, and that it is not a live query. Writing exported_at into the file does not stop a caller from ignoring it: the consumer has to check that timestamp, or a TTL beside it, and reject or refresh a snapshot that is stale. A consumer that treats a stale file as current will do the wrong thing with full confidence. That is worse than a slow poll.
The schema is a cost you keep paying. Every field is a promise the extractor must keep and a promise a reader may rely on. Add a field when a real consumer needs it. The review that asks for another column “in case” is how the snapshot grows back into the log you were trying to leave. Then you are paying to read it again.
Scripts fail the same way every time. That is useful, and it is the risk. A bad extractor writes the same wrong root cause into every later run. I prefer that to a model inventing a new cause on each pass, but only while something can still see the raw source. I flip that when the error is silent and nothing downstream will reject it, so the repeated wrong answer reads as truth, and when a person is iterating on an open problem in front of the output, where an occasional right answer is usable and a frozen wrong one is not. Keep the pointer. When a check fails, or when you do not yet trust that area, open the evidence and compare it to the field. The record existing is not a reason to delete the log.
A direct call between agents is still the right tool when the conversation is the work. An open question you could not have precomputed. A reviewer pushing on a design that is not finished. A task that does not have a shape yet, being split by agents that have to talk in order to find one. Putting a file in that spot pretends the judgment already happened. The file is for a fact you can freeze. The turn is for a judgment you cannot.
I also keep models out of the export. If a summary is worth keeping, it is a field from the extraction step, stored next to the pointer, and labeled as a model output. It does not get blended into the bytes that claim to be the state.
What I keep
A read-only script writes the smallest true snapshot when the source changes. An extraction step runs once, turns the history into a few typed fields, and leaves the raw evidence in place. The writer publishes an artifact. A separate check, a script whenever the check can be a script, judges that artifact without the writer’s context. Agents talk when one of them has a judgment a file cannot hold.
A turn that does not change the artifact, the decision, or the check is tokens and latency spent on not doing the work. I would rather not pay it.
FAQ
- Why does agent-to-agent polling waste tokens?
- The answer is generated. If that turn does not change the artifact, the decision, or the check, you paid for it twice and the task waited.
- Why write a snapshot instead of asking the other agent?
- A read-only script writes the state to a file, and the next step reads the file. Same inputs, same bytes, and no model phrasing the answer.
- What belongs in a structured extract of a log or transcript?
- A few typed fields, written once, plus a pointer to the raw source. Root cause, fix, contribution area, and lesson. Drop a field if nothing branches on it.
- Why shouldn’t the agent that wrote the artifact be the one that verifies it?
- It already believes its own transcript. Publish the artifact, then check that, with a script or a fresh agent that never sees the draft.
- When is a direct agent-to-agent call still the right choice?
- When the conversation is the work, or the fact has to be live. A file is for a fact you can freeze.
