Multi-Agent Topology & Error Control: Preventing Deadlocks, Infinite Loops, and Hallucination Propagation

Multi-agent AI systems rarely fail because a model “doesn’t know enough.” They fail because the agents coordinate badly. They hand work back and forth, repeat the same tool call ten times, accept a shaky intermediate result, or let one flawed output become the premise for everything that follows.

This article is the control-plane guide for sovereign multi-agent systems. It covers how agents route work, how they stop, how their handoffs get validated, and how they recover when something goes wrong. It deliberately leaves out model sizing, local inference tuning, context compression, tracing setup, and compliance, which belong to other articles in this series.

Covered in this article Deferred to another cluster
Supervisor, peer-handoff, and workflow-graph patterns Model tiering and local inference optimization
Max-turn, recursion, and loop-detection boundaries Context engineering, shared memory, and tool scoping
Validator and critic nodes at handoffs GPU queueing, batching, quantization, and hardware sizing
Structured error contracts and recovery paths OTLP tracing, span metrics, security, and compliance

The split matters because orchestration decides the shape and failure modes of a system. Performance tuning and observability only make sense once that system is under control. Supervisor-worker, peer handoff, and graph-based orchestration are three distinct coordination models, and each one routes work and breaks in its own way.

1. Why orchestration, not more agents, determines reliability

Picture a production run that should take three steps. Instead, two agents start passing the task back and forth. Or an agent returns a half-checked result and three downstream agents act on it before anyone notices. Or the whole pipeline finishes, reports success, and the answer is wrong.

None of these starts with a broken model. They start with missing rules about who decides what happens next, when to stop, and what must be true before work moves forward. Put simply:

An agent system is only as reliable as its routing, termination, and validation rules.

Sovereign deployments feel this harder. Local compute is fixed, so every unnecessary reasoning turn, tool call, or retry takes capacity from real work. A cloud system can often absorb the waste by scaling up. A sovereign one can’t. And because the workflows usually involve private enterprise data, uncontrolled handoffs are also harder to audit after the fact.

This guide walks through four controls:

  • Topology: who can hand work to whom, and under what conditions.
  • Execution boundaries: when an agent, a handoff, or the whole workflow must stop.
  • Validation gates: what has to be true before an output moves downstream.
  • Structured error handling: how failures turn into usable feedback instead of opaque exceptions.

Key takeaway: More agents do not create more intelligence. They create more opportunities for coordination failure.

2. The three orchestration patterns, and when each one fails

There’s no universally best topology. The right choice depends on whether your task has clear stages, needs specialist judgment mid-flow, or must follow a predictable, auditable path.

Pattern Control model Best for Primary failure mode
Supervisor / orchestrator-worker A coordinator classifies, delegates, and synthesizes Multi-step tasks with clear specialist roles Supervisor ping-pong, unclear ownership, central bottleneck
Peer handoffs Agents transfer control directly to qualified peers Conversational or expertise-driven workflows Circular handoffs and diffuse accountability
Workflow graph Developer-defined nodes, edges, and conditional routing Repeatable business processes with auditable paths Over-rigid graphs that cannot handle legitimate exceptions

Supervisor patterns centralize routing. Peer handoffs distribute it. Graph workflows make the flow of information explicit, which is what makes them auditable.

Supervisor / orchestrator-worker

In this pattern, a lead agent breaks the task down, sends pieces to specialist agents, tracks what’s done, and assembles the final result. It works well when the task decomposes cleanly and benefits from one place that holds the overall plan.

Take an incident-response workflow. A triage agent classifies the issue, a diagnostics agent investigates likely causes, a remediation agent proposes a safe fix, and a communication agent drafts the stakeholder update. The supervisor isn’t valuable because it’s smarter than the specialists. It’s valuable because it keeps a single view of task state and stops agents from chasing conflicting plans.

The tradeoff is concentration of control. If the supervisor keeps delegating the same subtask, changes plans without a clear trigger, or ends up responsible for every validation decision too, it becomes both a bottleneck and a single point of failure.

Peer handoffs

Here, agents pass control directly to whichever peer is better suited for the next part of the conversation. A general support agent might hand a billing question to a billing specialist, who later hands a technical question to a troubleshooting agent. There’s no central coordinator, which makes this feel natural for conversational workflows where the needed expertise shifts as the dialogue unfolds.

The weakness is accountability. When any agent can transfer to any other, nobody clearly owns the outcome. Circular handoffs are the classic failure: agent A decides the question belongs to B, B decides it belongs to A, and the user waits while the system politely passes them back and forth.

Workflow graphs

A workflow graph defines the process up front as nodes (steps), edges (transitions), and conditional routing rules. Agents do work inside nodes, but the path between nodes is designed by a developer, not improvised by a model.

That makes graphs the best fit for repeatable business processes like claims handling, document review, or approval chains, where you need to explain afterward exactly why the system did what it did. The cost is rigidity. A graph built only for the happy path will struggle when a legitimate exception shows up, and teams often respond by adding more and more conditional edges until the graph is as hard to reason about as the free-form system it replaced.

A practical selection rule

  • Use a supervisor for delegation-heavy work with clear specialist roles.
  • Use peer handoffs for genuinely conversational expertise transfer.
  • Use a workflow graph when the process must be deterministic and auditable.

Hybrid topologies

Most real systems end up mixing these. A common shape is a graph skeleton for the overall process, with a supervisor-controlled specialist subgraph inside one stage that needs flexibility. Another is peer handoffs confined to a single bounded stage, such as a support conversation, wrapped inside a deterministic outer workflow. The point of mixing is to keep autonomy local. Let agents improvise where improvisation pays off, and keep the rest of the process predictable.

Anti-patterns to avoid

  • Agent swarm by default. Starting with a crowd of agents because it looks sophisticated, before checking whether two would do.
  • Every agent can call every other agent. This maximizes the number of possible loops and makes ownership impossible to assign.
  • The supervisor decides everything, including validation. The component that plans the work shouldn’t be the only one judging whether the work is good.

Key takeaway: Choose the least autonomous topology that can solve the task. Add autonomy only where the workflow genuinely requires it.

"Three diagrams of the same five agents. In a supervisor topology, one central agent connects to four others with 8 directed paths. In a peer mesh, every agent connects to every other with 20 directed paths, and several circular handoff loops are highlighted in red. In a workflow graph, agents are linked by a few fixed one-way edges, so no free-form loops can form."

3. Mapping the failure modes: coordination bloat, loops, and cascading errors

Before adding controls, it helps to have names for what you’re controlling. Multi-agent failures fall into three families.

Coordination bloat. The system technically works but wastes effort: too many supervisor turns, unnecessary peer consultations, duplicated work, agents repeatedly asking each other for clarification. Nothing crashes. You just burn compute and time, which hurts most on fixed local hardware.

Runaway execution. This is the dramatic one. An agent calls the same tool over and over with identical arguments. Agent A hands off to agent B and back again. A retry storm hammers a failing service. A graph never reaches an end state because a routing rule or tool behavior is malformed. This is why explicit termination controls aren’t optional.

Cascading failure. A hallucinated fact, a malformed payload, a wrong tool result, or a bad assumption passes through a handoff and becomes the foundation for later agents. Here’s how it plays out:

  1. A research agent returns an unsupported claim.
  2. The planner accepts it as fact.
  3. The writer produces a recommendation built on it.
  4. The reviewer sees a coherent final answer and approves it.
  5. The pipeline completes, with a confidently wrong result.

Every step in that chain behaved reasonably given its inputs. The failure wasn’t in any single agent. It was in the absence of a checkpoint at the first handoff.

Key takeaway: A failure that isn’t caught at its origin becomes more plausible-looking and more expensive to reverse with every step downstream.

4. Hard execution boundaries: making every run terminate

“Don’t let agents loop forever” is good advice and useless as a design instruction. It has to become concrete rules that the architecture enforces.

Max-turn enforcement. Set three budgets: a per-agent turn limit, a per-task handoff limit, and a global workflow limit. Each one catches a different kind of overrun.

Recursion limits. Graph-based systems typically offer a ceiling on how many execution steps a run can take. Treat that as the emergency brake, not the primary control. If your system regularly hits it, something upstream is wrong. The ceiling is there to stop damage, not to define normal behavior.

Loop detection. Watch for repeated state signatures, repeated tool calls with identical arguments, repeated handoff pairs, and outputs that don’t change between turns. A system that’s doing the same thing twice and expecting a different result should be interrupted.

Graceful degradation. Decide in advance what happens when a limit is reached. The options are returning a partial result, escalating to a human, retrying with a narrower task, or failing with a structured reason. Pick one deliberately for each path. A system that simply cuts off mid-task leaves everyone guessing what state things are in.

Idempotency and retry policy. Not all retries are equal. Retrying a read-only lookup is harmless. Retrying “send the customer an email” or “create a record” can duplicate a side effect. Your retry policy has to know the difference.

Here’s the full boundary stack:

Layer Question it answers Example rule
Agent turn limit Can this agent keep thinking? Maximum 5 reasoning/tool turns
Handoff limit Can agents keep transferring work? Maximum 3 handoffs per task
Graph recursion limit Can the workflow keep executing? Hard ceiling on graph super-steps
Loop detector Is the system repeating itself? Block repeated identical tool calls
Wall-clock timeout Is the workflow merely slow? End or escalate after a defined time budget

The last row deserves attention. A step limit and a time limit are different things. A workflow can stay well under its step ceiling while still burning an unacceptable amount of time on slow tool calls. You need both.

Key takeaway: Every agent path needs a defined exit: complete, escalate, retry safely, or fail with a structured explanation.

"Timeline infographic titled 'Which Brake Fires First.' A tangled orange line shows an agent run spiraling out of control. Five safeguards trigger in order: the loop detector, the agent turn limit, the handoff limit, the wall-clock timeout, and finally the graph recursion ceiling as the emergency brake. Each safeguard leads to a controlled exit: a partial result, escalation to a human, or a structured failure with a reason."

5. Validation gates: stopping bad outputs at the handoff

The cheapest place to catch an error is the moment it’s produced. By the time it’s been through three more agents, it’s wrapped in layers of plausible reasoning.

It helps to separate three kinds of checks:

  • Validator nodes are deterministic checks for schema, required fields, types, ranges, permissions, and format.
  • Critic or auditor agents are model-based checks for factual support, task completion, policy adherence, and reasoning quality.
  • Human approval gates are required checkpoints for consequential or irreversible actions.

A useful gate taxonomy:

Gate type Checks Placement
Schema validator JSON structure, required fields, types, enums Immediately after every agent output
Task-completion validator Acceptance criteria, missing deliverables, unresolved dependencies Before a handoff or final response
Fact-support validator Citations, source coverage, unsupported claims Before research enters planning or writing
Policy validator Allowed actions, prohibited content, approval requirements Before external or irreversible actions
Critic agent Reasoning quality, contradiction detection, instruction adherence At high-risk synthesis or decision points

Validators should be cheap, deterministic, and local to the handoff. Save critic agents for judgment calls that rules can’t settle, because every critic is another model call on hardware you already have to budget.

Apply a fail-closed principle. If a gate can’t determine that an output is safe or complete, the output shouldn’t move forward quietly. Silence is how bad results get through.

When a gate rejects something, the rejection should say what failed, which field or criterion failed, what the agent should correct, and whether a retry is allowed. A bare “invalid output” gives the agent nothing to work with.

Key takeaway: Don’t ask a downstream agent to discover an upstream error. Make the handoff itself the quality checkpoint.

6. Structured error handling: replace stack traces with actionable contracts

When a tool fails and the agent receives a raw exception trace, it has to guess what happened. Was that a temporary timeout, a malformed input, a permissions problem, or a logic error? Agents guess poorly, and the guesses produce either pointless retries or confident continuation past a real failure.

The fix is a structured error contract. A good one includes an error code, a human-readable message, the failing field or step, severity, whether a retry is allowed, a suggested remediation, and a correlation ID so the failure can be traced across agents.

Classifying errors makes the system’s response predictable:

Error class Example Correct system response
Transient Tool timeout Bounded retry with backoff
Recoverable Missing required field Return field-specific correction request
Non-retryable Invalid business rule Stop and escalate
Policy-blocked Unauthorized action Block, log reason, route to approval
Unknown Unrecognized failure Fail closed; do not silently continue

Recovery paths follow from the class: correct and retry, re-route to a more capable agent, ask a human for input, degrade to a partial result, or terminate cleanly.

One more principle: errors should go back to the agent responsible for the output, as structured feedback, not as a generic system exception. The agent that produced the bad field is the one best positioned to fix it. Modern graph frameworks support this directly, with error handlers that receive the current state once retries are exhausted and can update state or route execution somewhere else.

Key takeaway: An error message is part of the agent interface. If it isn’t structured, the agent can’t recover intelligently.

"Side-by-side comparison of a raw exception and a structured error. On the left, a cluttered stack trace leaves an agent confused about whether the failure is a timeout, bad input, or permissions problem, leading to blind retries or continuing past the failure. On the right, a structured error card lists an error code, message, failing step, severity, retry rule, suggested fix, and correlation ID, so the agent knows to retry with a narrower request and escalate if it fails again."

7. A reference control loop for sovereign multi-agent systems

Pulling the controls together, here’s the pattern in one line:

Task intake → Router/supervisor → Specialist agent → Validation gate → Handoff or retry → Final synthesis → Final verification → Controlled completion

Here’s what each transition is doing:

  • The router creates a bounded task brief, not an open-ended conversation.
  • Each specialist receives only the authority and inputs needed for its stage.
  • Every exit from a specialist passes through a validation gate.
  • Failed outputs return to the responsible agent with a structured correction request.
  • A final verifier checks the assembled result against the original acceptance criteria.
  • The system ends through an explicit completion state, not because the agents ran out of things to say.

As a flow:

User task
   ↓
Router / Supervisor
   ↓
Specialist Agent A
   ↓
Validation Gate ──fail──▶ Structured correction → Agent A
   ↓ pass
Specialist Agent B
   ↓
Validation Gate ──fail──▶ Structured correction → Agent B
   ↓ pass
Final synthesis
   ↓
Final verification
   ↓
Controlled completion / escalation

Key takeaway: Reliable multi-agent systems aren’t agents talking freely. They’re bounded workflows with explicit control transfer and validation.

8. Implementation checklist

  • Define the minimum viable topology before adding agents.
  • Assign one accountable owner per task stage.
  • Set explicit turn, handoff, recursion, and time budgets.
  • Make every handoff a structured, validated transfer.
  • Add deterministic validators before model-based critics.
  • Return structured errors to the agent that can fix them.
  • Define partial-result and escalation behavior before deployment.
  • Test the unhappy paths: invalid tool output, contradictory research, circular handoff, schema failure, and final-answer rejection.
  • Review topology decisions whenever agents, tools, or task complexity change.

Every control here is a tradeoff. Too little autonomy limits what the system can do. Too much creates coordination and audit risk. The strongest position is that topology is the first reliability control. Supervisor-worker patterns centralize routing, peer handoffs distribute it, and graph workflows make it explicit. But all three need termination rules, validation gates, and structured recovery paths before they can operate safely.

Leave a Comment