Walk through how shared message history causes quiet context bloat in a multi-agent run
A 5 agent crew shows steadily climbing per turn cost as the workflow progresses, with no growth in problem complexity. Walk through how shared message history quietly bloats per agent context and three concrete techniques to bound it.
Shared chat-history coordination makes each agent re-read the growing log every turn, so per-turn cost climbs with turn count. Bound it with summary on handoff, per-agent context filtering, and structured payloads.
Picture five colleagues sharing one notebook. Every time someone speaks they write the whole thing into the notebook, and the next person has to read the entire notebook before deciding what to say. After ten exchanges, the notebook is long, and every new speaker spends most of their time re-reading old pages instead of doing new work. The reading time is the cost. Three fixes help. The team can pause and write a one-page summary, then keep going from the summary. Each colleague can be told to read only their own past notes, not everyone's. Or the team can stop using a free-form notebook entirely and instead pass index cards with only the specific facts the next person needs. The notebook is the shared history; index cards are structured payloads.
Concept explanation~2 min read
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Concept explanation~2 min read
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Context bloat in multi-agent crews is one of those failures that does not show up in any single trace yet shows up in the monthly invoice as a steadily rising line. The proximate cause is mechanical: shared message history is the default coordination idiom, and every agent on every turn reads the full growing log. The deeper cause is architectural: the chat-history metaphor hides the real coordination contract behind a familiar interface, and most teams do not notice the bloat until cost climbs past their tolerance.
This deep dive walks the mechanism end to end, separates worker growth from supervisor growth, and works through the three bounding techniques (summary on handoff, per-agent filtering, structured payloads) in order of how much architectural change each one requires. The closing section covers the observability discipline that makes the whole thing measurable.
The mechanism: linear growth, sometimes quadratic
The default chat-history coordination pattern works like this. The team starts with the task as turn zero. Agent A speaks; the framework appends A's full message to the log. Agent B speaks; the framework appends B's message. By turn N, the log contains turn zero plus the first N speakers' full outputs, and the agent about to speak reads all of it as its conditioning context.
If the per-turn output is roughly constant at K tokens, the log at turn N is roughly NK tokens. Each worker that speaks on turn N pays once for an NK input. Summed across N turns, the worker side's cumulative input cost is on the order of (N^2 * K) / 2, which is quadratic in the number of turns.
The supervisor in a hub and spoke topology pays even more. The supervisor speaks every other turn (after each worker), reading the full log each time to decide who speaks next. Its per-call input cost is also growing linearly with turn count, but its call frequency is higher than any individual worker, so its share of cumulative cost dominates.
The practical effect: a five-agent crew with 200-token average outputs running 30 turns burns roughly 30 times the input tokens of a single-shot call doing the same work. The cost climb on the dashboard looks alarming only after several runs have accumulated, which is why teams typically discover the problem on a budget alert rather than during development.
Situations where this technique stops working.
2–4 min · Everything important, quickly.
Real products, models, and research that use this idea.
- AutoGen 0.4's RoundRobinGroupChat and SelectorGroupChat both ship per-agent message-filtering options to scope each agent's input.
- LangGraph state-key filtering on node inputs lets each node read only the slice of state it needs rather than the full StateGraph.
What an interviewer would ask next. Try answering before peeking at the approach.
QWhat is the failure mode of summary on handoff and how do you guard against it?
Summariser drift: small fidelity losses accumulate across many handoffs and the brief eventually diverges from ground truth. Guard with a fixed JSON schema on the brief, periodic re-grounding against the raw log on key turns, and unit tests that compare summariser output against held-out reference summaries.
Red flags & common mistakes
The phrases that signal junior thinking. Click to expand.
Red flags & common mistakes
The phrases that signal junior thinking. Click to expand.
Diagnosing rising per-turn cost as a model-size or rate-limit problem instead of as the shared-log growth pattern that any chat-history crew exhibits by default.
60 second bullets to scan on the way to the call.
Describe the mechanism of shared message history bloat across turns
Explain why supervisor cost grows steeper than worker cost in a hub and spoke topology
Primary sources. Browse if you want the original framing.
Same topic, related formats. Practice these next.