Back to Blog
Published:
Last Updated:
Recently Updated
Multi-Agent Systems in ProductionChapter 4

Your Multi-Agent System Has No Brakes

9 min read
1,942 words
high priority
Mudassir Marwat

Mudassir Marwat

Founder & CEO, Cognilium AI

Your multi-agent system has no brakes. You designed which agents exist and how they connect, but not the thing that decides when they stop, and in most systems nothing does. Control is emergent: it falls out of agents calling each other, so the system stops only when something runs out. Four ways control fails: non-termination, where the loop never ends; premature stop, where an agent's "done" was not actually done; mis-routing, where the task orbits and never lands; and no budget, where the rare tail run wrecks the bill. The fix is explicit control, not a smarter agent.

TL;DR

A multi-agent system with no termination condition does not fail, it spends. The stopping criteria that actually hold, and the ones that only look like limits.

You designed which agents exist and how they connect. You did not design the thing that decides when they stop. In most systems, nothing does.

You can draw your multi-agent system on a whiteboard. Boxes for the agents, arrows for who calls whom. That drawing is the architecture, and it is static. The system that runs in production is not static. It is a loop, and that loop has to decide, over and over, what runs next and whether to stop. In most multi-agent systems, no single component owns that decision. Control is emergent: it falls out of agents choosing to call each other. And emergent control has no brakes.

A single model call stops by construction. You send tokens, it returns tokens, it is done. The moment you wrap that call in a loop that can invoke other agents, you give up that guarantee. The system now terminates only if something makes it terminate. If you did not build that something, your system's real stopping condition is whichever runs out first: the model's willingness to keep going, your token budget, or your patience at 3am watching a run that will not end.

TL;DR

In a multi-agent system, no single component owns the decision of what runs next and when to stop, so control is emergent, and emergent control does not reliably halt. It breaks four ways: non-termination (agents loop or ping-pong forever), premature termination (the system trusts an agent that said "done" when it only meant "I stopped"), mis-routing (a dynamic router sends the task in circles), and no global budget (the median run is fine while the tail run costs 20 to 50 times more). The repair is not a smarter agent or a better prompt. It is explicit control: a termination predicate the system checks instead of the agent's self-report, a hard global budget on steps and tokens and time, one controller that owns routing, and loop detection that reads the shared store. Architecture is the engine. Control is the brakes. Most teams ship the engine and forget the brakes.

Architecture is a diagram. Control is what happens at runtime.

The previous chapter on how to wire a multi-agent system was about shape: which agents exist, and which one is allowed to talk to which. Shape is necessary, and shape is not control. A supervisor-and-workers diagram tells you the supervisor can route to any worker. It does not tell you when the supervisor should stop routing, how it decides who is next, or what happens when a worker hands the task straight back. Those are runtime questions, and runtime is where the system actually lives or dies.

Think of it as the difference between a wiring diagram and a driver. The diagram is fixed the moment you draw it. The driver makes thousands of decisions while moving: accelerate, turn, and above all, brake. Nobody would ship a car as a wiring diagram and hope the braking emerges from the parts. Multi-agent systems get shipped exactly that way, and then the team is surprised when the thing accelerates into a wall.

The four ways control fails

Every runaway multi-agent system I have taken apart failed through one of four control gaps. None of them are exotic. They are the default behavior of a loop that nobody is steering.

Non-termination. Two agents ping-pong. A writer produces a draft, a reviewer asks for a change, the writer changes it, the reviewer finds something new to change, and the pair orbit each other until something external kills the run. It is not always two agents; a single agent stuck calling a tool that keeps returning "not quite, try again" loops just as hard. The reason frameworks ship a default recursion limit at all (LangGraph, for example, stops a graph at 25 steps unless you raise it) is that this happens constantly. Hitting that limit is a symptom that your system had no real stopping condition, not proof that it has one.

Premature termination. The mirror image, and it inherits the semantic drift from the last chapter on hand-offs. An agent emits "done" or "final answer," the orchestrator halts, and the goal was never actually met. "Done" meant "I ran out of ideas," or "I hit my own limit," not "the task is complete and correct." A system with no explicit goal check is trusting a self-report, and a self-report is the one signal an agent has every incentive to produce whether or not it earned it.

Mis-routing. A dynamic router, the supervisor that reads the state and picks the next agent, is a classifier, and classifiers are wrong some fraction of the time. Send the task to the wrong specialist and it comes back unfinished, gets routed again, and orbits without converging. The error compounds per hop. If a router is right 90 percent of the time on a single decision, a task that needs four correct routing hops lands cleanly only 0.9 to the fourth, about 66 percent of runs. At five hops it is 59 percent. Every added hop multiplies the chance the task never reaches the agent that could have finished it.

No global budget. Each agent step is locally cheap and locally reasonable. The failure is that there is no system-level ceiling on steps, tokens, tool calls, wall-clock, or dollars. The median run is fine. The tail run, the one in 50 that catches a loop, is what pays you back with a latency-SLA breach and a line on the invoice you cannot explain. You budgeted for the median and the tail is what ships to production alongside it.

Do the math on the tail

Put numbers on the last one, because the tail is where the money is and the average hides it. Say a healthy run is 6 agent steps at roughly 1,500 tokens each, about 9,000 tokens. A run that catches a review-loop and rides the 25-step limit is about 37,000 tokens, roughly 4 times the healthy cost, and it produced a worse answer than it had at step 6. Suppose only 2 percent of runs do this. The effect on your average bill is small, about 6 percent, which is exactly why it hides. But your p99 is now 4 times your median. The tail does not move the average enough to notice on a dashboard, and it moves the worst-case enough to wake you up.

The clean way to see why a budget is not optional: with a hard cap of N steps at per-step cost c, the worst a run can cost you is N times c. Remove the cap and the worst case is unbounded, because the loop has no reason of its own to end. A step ceiling is not a tuning knob. It is the single thing that turns "unbounded" into a number you can put on a slide.

A diagram of why a multi-agent system does not stop on its own, and how to make it stop. Across the top, the control loop: agent A calls agent B which calls back to agent A, a loop that runs itself with no exit; it reaches a STOP question, who decides we are actually done; and the answer is no one, because no controller owns the decision, so it never stops. Below on the left, the four ways control fails: non-termination, where a writer and reviewer ping-pong until a step limit kills the run, commonly a default of 25 steps; premature termination, where the system trusts an agent that said done when done only meant I stopped; mis-routing, where a router that is right ninety percent of the time lands a four-hop task cleanly only about sixty-six percent of runs; and no global budget, where the median run is fine but the one-in-fifty tail run costs twenty to fifty times more. On the right, the tail is the bill: a healthy run of six steps is about 9,000 input tokens while a looped run riding the 25-step limit is about 37,000, the tail is roughly one in fifty, and the p99 is about four times the median; the worst case equals N times the per-step cost, and with no cap it is unbounded. A fix band: explicit control, not a smarter agent, means a termination predicate the system checks rather than the agent's own done, a hard global budget on steps and tokens and time, one controller that owns routing, and loop detection; the predicate and the loop detector both read the shared store from the previous chapter, because state and control are two halves of one machine. The takeaway: architecture is the engine and control is the brakes, and most teams ship the engine and forget the brakes.

The fix is explicit control, not a smarter agent

You cannot prompt your way out of this. "Please stop when you are done" is not a control system; it is a wish addressed to the same agent whose judgment about "done" you already could not trust. Control has to live outside the agents, in a component that owns it. Four mechanisms, in rough order of how much they save you.

A termination predicate the system checks. Replace "the agent said done" with a goal check the controller evaluates against state: are the required fields present in the shared store, validated, and above the confidence threshold you set? A predicate is a fact the system can verify. A self-report is a vibe the agent can fake. The predicate reads the shared store rather than asking the agent, which is the whole reason the store from the last chapter exists.

A hard global budget. Cap steps, tokens, tool calls, wall-clock, and dollars, at the system level, not per agent. When any ceiling trips, stop and escalate; do not silently keep going. This is the circuit breaker that bounds worst-case cost from unbounded to N times c, and it is the difference between a bad run that costs 4 times the median and a bad run that costs 50 times the median because nothing was counting.

One controller owns routing. Give a single supervisor an explicit policy or state machine for who runs next, instead of letting agents freelance calls to each other. And prefer the least dynamic control that still does the job. If the flow is known, a static directed graph is the most reliable thing you can ship, because it cannot route in a circle. If it branches, a bounded state machine. Reserve free-form, agent-decides-the-next-agent control for the genuinely open-ended tasks that need it, and even then, run it inside the budget above.

Loop and progress detection. Hash the shared state; if the same state appears twice, you are in a cycle, so break out and escalate rather than paying to discover it again. Track whether any new information was written across the last K steps; if nothing changed, the system is stuck even though it is still busy. This is what converts an infinite loop from a runaway bill into a caught, logged, recoverable event.

Control needs the shared store from the last chapter

None of this works without somewhere to look. The termination predicate and the loop detector both read the shared, typed store that fixed the communication problem in chapter 3. That is the pattern worth holding onto across both chapters: state and control are two halves of the same machine. Shared state without a controller loops forever, because nothing decides to stop. A controller without shared state is blind, because it has nothing trustworthy to check its termination predicate against. You need both, and they are cheaper to build together than to bolt on separately.

There is a debugging payoff too. A run that never terminates is a run you cannot evaluate, which is why the question of which agent broke starts with being able to end a run and read its trajectory. Loop detection and a recorded store give you exactly that trajectory. The same machinery that stops the system is the machinery that lets you explain what it did.

A single model call terminates because it was built to. A multi-agent system terminates because you built it to. If you did not, it does not.

When you do not need any of this

The honest caveat: the reason a single agent so often feels more reliable is not that it is smarter. It is that a single model call has a trivial, guaranteed control loop, it returns once, and that is a feature you give up the moment you add a second agent. This is the same argument as the case for keeping it to one agent. If your task fits one agent, the cheapest control system is no control system, and you should take it. Add agents only when the task genuinely needs them, and when you do, treat control as a first-class part of the build with its own budget and its own tests, not as something you will add after the demo works. The demo always works. The demo is a single happy path with no loops in it.

We build production multi-agent systems for document-heavy work in legal, finance, and insurance, where a run that loops for an hour or halts on a stale guess is not a curiosity, it is a bill and a liability. If your agents are wired but you are not sure what actually stops them, the missing piece is almost always control, not intelligence. Talk to an engineer or see how we work.

Share this article

The work behind this series

Orchestration, failure isolation, shared state and cost control — the engineering these articles describe, as an engagement.

Mudassir Marwat

Mudassir Marwat

Founder & CEO, Cognilium AI

Mudassir Marwat's argument is that ERP systems record decisions they never optimise.

Founder & CEO of Cognilium AI; 37 AI agents in production across four products; 4 production AI products built and operated; three clouds in production (AWSGCPAzure)
Agentic AIRAG → GraphRAG retrievalVoice AIMulti-Agent Orchestration

Frequently Asked Questions

Find answers to common questions about the topics covered in this article.

Put the stopping logic outside the agents. The reliable combination is a hard step-and-token budget that bounds the worst case, a termination predicate the controller checks against shared state instead of trusting the agent's "done", and loop detection that spots a repeated state or a stretch of no-progress and breaks out. A raw step limit alone stops the bleeding but does not fix the wound.
No. A step limit is a backstop, not a control system. It caps the damage of a runaway loop, which is worth having, but it does not decide correctly when the task is actually finished, and it does not tell a healthy long task from a stuck one. Pair the limit with a real termination predicate and progress detection so that hitting the limit becomes the rare exception, not your normal stopping condition.
Prefer the least dynamic control that does the job. If the sequence of work is known, a static directed graph cannot route in a circle and is the most predictable thing you can run. Use a bounded state machine when the flow branches, and reserve open-ended, agent-chooses-the-next-agent control for tasks that truly need it. Dynamic routing buys flexibility and pays for it in mis-routing and non-termination, so only buy what the task requires.
Read the shared store. Hash the relevant state after each step; if an identical state recurs, the system is cycling, so stop and escalate. Separately, check whether any new information was written across the last K steps; if nothing meaningful changed, the run is stuck even while it looks busy. Both checks are cheap because the state already lives in one place if you built the shared store from the previous chapter.
A goal predicate over the shared state, not the agent's word. Concretely: are all required outputs present, do they pass their validation, and is the system's confidence above the threshold the task warrants. "The agent returned a final answer" is not a termination condition, it is a self-report, and the whole point of a predicate is to verify the goal independently of the component that claims to have met it.
Directly. A hard global budget is what bounds worst-case spend from unbounded to a number, N steps times the per-step cost. The trap is optimizing for the median run, which looks cheap, while the tail run that catches a loop quietly costs 20 to 50 times more and blows both your latency target and your bill. Control is the cheapest cost optimization you will make, because it removes the tail rather than shaving the average.

Still have questions?

Get in touch with our team for personalized assistance.

Contact Us

Still have a question this did not answer?

The person who wrote this article answers these. Describe your setup and what you are stuck on — you will get a straight answer, including where we think the approach is wrong.

Related Articles

Continue exploring related topics and insights from our content library.

Your Agents Don't Share a Brain. They Pass Notes.
10 min
1
Mudassir Marwat
July 6, 2026

Your Agents Don't Share a Brain. They Pass Notes.

You wired the agents, and you learned the failures live in the seams between them. This chapter names the seam: it is the hand-off. When one agent finishes and the next begins, everything the first learned, its documents, its discarded hypotheses, its doubt, has to survive a trip through a single message, and the next agent acts on that message alone. Your agents do not share a brain, they share a mailbox, and every message is a lossy compression of what the sender knew. Four things go wrong: context loss, semantic drift, error laundering, and a coordination tax that grows with the square of the chain length. The fix is not a better prompt. It is a shared, typed store the agents read and write, plus hand-off contracts that make a bad message fail loudly instead of quietly.

words
Read Article
When a Multi-Agent System Fails, Which Agent Broke?
18 min
2
Mudassir Marwat
July 3, 2026

When a Multi-Agent System Fails, Which Agent Broke?

You decided to use multiple agents, and you wired them. Now the system gives a confident wrong answer and hands you no stack trace, and the hardest production question arrives: does this work, and when it does not, which agent broke? Single-agent evaluation does not transfer, because a multi-agent system fails in the seams. You need three layers: outcome tells you whether it failed, component tells you which parts work and gives you the per-agent reliability, and trajectory tells you where in the flow it broke. Put them together and the reliability math becomes a diagnostic: if the parts predict about seventy-three percent and the system delivers fifty-five, the gap is an interaction bug. And because these systems are non-deterministic, one green run is not a passing grade, so you measure a rate over many runs off a trace you can actually read.

words
Read Article
Four Ways to Wire a Multi-Agent System (and When Each One Breaks)
17 min
3
Mudassir Marwat
July 2, 2026

Four Ways to Wire a Multi-Agent System (and When Each One Breaks)

You settled the question of whether to use multiple agents. Now comes the choice that matters more than the head count: how to wire them. There are four topologies, a sequential pipeline, an orchestrator with parallel workers, a hierarchy of supervisors, and a peer-to-peer network, and each fits one shape of work and hides one failure. The same three agents at eighty percent each are about fifty-one percent reliable wired to all-must-succeed, about ninety percent as a majority vote, and about ninety-nine percent when any one can and you can verify it. Topology, not head count, sets your reliability. Underneath it, share structured state instead of messages, keep the writes single-threaded, and read the shape off the task dependency graph.

words
Read Article

Explore More Insights

Discover more expert articles on AI, engineering, and technology trends.

Personalized for You

Curated content recommendations based on your current reading and interests.

Your agents do not share a brain, they pass notes. Every hand-off compresses one agent's full working state into a message, and the next agent acts on that message alone, so the context one agent has is not the context the next one gets. Four ways a hand-off fails: context loss, where the sender drops what you needed; semantic drift, where the same words carry a different meaning; error laundering, where an uncertain guess arrives as a clean fact; and the coordination tax, where re-sending the accumulated context makes token cost grow quadratically. The fix is a shared store, not a better message.
Trending
126%

Your Agents Don't Share a Brain. They Pass Notes.

Same topic cluster: Multi-Agent Systems in Production
Same author: Mudassir Marwat

You wired the agents, and you learned the failures live in the seams between them. This chapter names the seam: it is the hand-off. When one agent finishes and the next begins, everything the first learned, its documents, its discarded hypotheses, its doubt, has to survive a trip through a single message, and the next agent acts on that message alone. Your agents do not share a brain, they share a mailbox, and every message is a lossy compression of what the sender knew. Four things go wrong: context loss, semantic drift, error laundering, and a coordination tax that grows with the square of the chain length. The fix is not a better prompt. It is a shared, typed store the agents read and write, plus hand-off contracts that make a bad message fail loudly instead of quietly.

Mudassir Marwat
10 min read
Multi-Agent Systems in Production
Read Article
Plain white envelopes laid out overhead
Recommended
36%

Can an AI agent price a quote line without knowing the customer?

High priority content
Related topic cluster: Engineering Quote Automation

It can produce the document but not the price. The agent resolves identity from the email address alone and is designed not to discuss discounts at all.

Ali Ahmed
7 min read
Engineering Quote Automation
Read Article
Your multi-agent system is a black box. A broken microservice returns a 500, but a broken agent returns a 200 OK and a confident wrong answer, so your dashboard stays green while the system is wrong. Four things you cannot see without instrumenting the run: who spent the tokens, where it broke, whether the run is healthy, and whether the brakes tripped. Instrument it, or you are flying blind and calling it production.
Trending
123%

Your Multi-Agent System Is a Black Box

Same topic cluster: Multi-Agent Systems in Production
Same author: Mudassir Marwat

You gave the agents brakes in the last chapter. Brakes stop a runaway, but they do not tell you which agent is dragging, what a run costs, or why last night's batch tripled. Most multi-agent systems ship to production as a black box: the team can see that a run happened and returned, and nothing in between. Worse, agent failures are silent, they return a 200 OK with a confident wrong answer, so uptime and error rate read green while the output is wrong. This chapter builds the instrument panel: the trace tree as the unit of observability, per-span cost attribution that finds the one agent owning two-thirds of the bill, structural sampling that keeps every run worth investigating, and continuous semantic evaluation, the only signal that catches a wrong answer no system metric will flag. Brakes stop a runaway. Instruments show it coming.

Mudassir Marwat
11 min read
Multi-Agent Systems in Production
Read Article
You pay for the same context fourteen times. A single call you pay for once. A naive multi-agent run re-reads the same context on every call. Where the bill goes, in four steps: input dominates, about eighty percent of the tokens are prompt and not output; context accumulates, each handoff adds to it; it is re-sent on every call, so fourteen calls read the same context; and the result is about fifteen times a single call, not six times for six agents. Cut the tokens per call, not the number of agents.
Trending
121%

You Pay for the Same Context Fourteen Times

Same topic cluster: Multi-Agent Systems in Production
Same author: Mudassir Marwat

You made a run reliable and secure. Now look at what it costs. A single model call has an obvious, fixed cost, paid once. A multi-agent run is dominated by input tokens, and in a naive pipeline every agent re-ingests the accumulated context, so you pay to re-read the same system prompt, tools, and documents on every one of the roughly fourteen calls. The bill scales with context-per-call times number-of-calls, not with agent count, so six agents cost closer to fifteen times a single call, not six. Cost control is structural: minimize the context at every handoff, tier the models so the mechanical agents run cheap, cache the static prefix that repeats every call, and do not fan out when a single call will do. Stacked, they take a naive run from about forty-one thousand frontier-priced tokens to roughly a seventh of the cost for the same output. The most effective lever is minimization, because a token you never send is free at every tier, in every cache, and on every retry.

Mudassir Marwat
13 min read
Multi-Agent Systems in Production
Read Article
Your retry just sent the email twice. A single call fails all at once, so a retry is safe. A multi-agent run fails in the middle, and the retry fires again. How a retry duplicates, in four steps: the run fails mid-way when finalize times out, the retry replays and re-runs steps one to five, the email sends again because the tool holds no idempotency key, and the result is two identical filings while no metric flags it. Make the replay safe, or the retry doubles the damage.
Trending
117%

Your Retry Just Sent the Email Twice

Same topic cluster: Multi-Agent Systems in Production
Same author: Mudassir Marwat

You secured the tool boundary against an attacker. Now the tool fails on its own, with no attacker in sight: a model call times out halfway through the run, a retry kicks in, and the send-email tool that already fired once fires again. A single model call fails atomically, so retrying the whole call is safe. A multi-agent run is fourteen calls with no transaction around them, so it fails in the middle, after some agents have already sent the email or written the row, and there is no rollback. A blind retry replays the steps that succeeded and duplicates their side effects, so the retry is not recovery, it is a second bug. What works is structural, at the action boundary: make every side-effecting tool idempotent with a key so a replay is a no-op, checkpoint each step so a retry resumes instead of restarts, and compensate the steps you cannot make idempotent. Across fourteen calls, one run in eight lands partial. The failure rate does not change. The cost of a failure does.

Mudassir Marwat
13 min read
Multi-Agent Systems in Production
Read Article
One poisoned agent poisons the chain. A prompt injection does not stop at the agent that reads it, and in a multi-agent system one untrusted document can reach every tool you have. How one document wins, in four hops: an agent reads the poisoned chunk, the instruction rides the hand-off as its provenance is dropped, it reaches the privileged agent that holds the dangerous tool, and the data is sent out while no system metric flags it. Scope the tools, or one document owns them all.
Trending
117%

One Poisoned Agent Poisons the Chain

Same topic cluster: Multi-Agent Systems in Production
Same author: Mudassir Marwat

You gave the agents brakes, then instruments. Neither stops a poisoned document from turning the pipeline against you. A single model call has one trust boundary, trusted system prompt versus untrusted input; a multi-agent system erases it, because every agent's output becomes the next agent's trusted input. So an injection planted in one document read by one agent propagates through the hand-offs to the agent that can send email or write to a system of record. The lethal trifecta, untrusted content, private data, and the ability to communicate out, gets split across your agents and recombined by the chain, so a per-agent review clears every agent and still misses the exploit. You cannot filter your way out. What works is structural: least privilege so the reader holds no dangerous tool, quarantine untrusted content behind a tool-less model, and a deterministic guardrail on the dangerous action. Tracing shows the attack. It does not stop it.

Mudassir Marwat
12 min read
Multi-Agent Systems in Production
Read Article

Smart Recommendations

Our AI analyzes topic clusters, author expertise, and content relationships to surface the most relevant articles for you.

Topic Matching
Author Expertise
Content Quality
Personal Interests

Questions on this?

Talk to an engineer

Schedule a call