Swarm vs. Supervisor Architecture for Coding Agent Teams
Supervisor orchestration handles sequential work; swarm architecture handles parallel tasks.

A monolithic coding agent does not fail by slowing down. It fails by stalling: a single agent processing tasks in sequence builds queuing delays as work accumulates, and when one task in that pipeline breaks, nothing behind it can move. There is no fallback path, no peer to absorb the stuck work, just a dead stop in the middle of the queue.
That ceiling appears exactly where coding work becomes valuable. Cross-module refactors, dependency upgrades across a codebase, parallel test generation, multi-file code review justify an engineering team's investment in agentic tooling in the first place, and they require more tools, more context, or both, at the same time. A single agent running these tasks sequentially either runs out of context or runs out of time. The response to that constraint is multi-agent architecture, but adopting multiple agents does not resolve the problem on its own. It immediately raises a second, harder question: how do those agents coordinate with each other, and does the coordination method match the shape of the work.
What supervisor and swarm architectures do, precisely defined
Supervisor and swarm are structurally different control flows, and treating them as interchangeable variations on "multi-agent" leads teams to inherit the wrong failure mode for their workload.
A supervisor architecture, sometimes called orchestrator-worker, has a single coordinating agent running it. That coordinator receives the task, builds a plan, routes subtasks out to specialist workers, tracks their progress, and merges the results into a final output. Workers report back to the supervisor, not to each other. No sub-agent speaks directly to the user; every output has to pass through the coordinator first. This gives the supervisor two jobs at once: it holds the conversation state, and it enforces the order in which steps execute. That second job is what makes the supervisor the right choice when sequence determines correctness. Picture one agent writing a function, a second writing its test, a third reviewing the result for security issues: none of those steps can run out of order without corrupting the result, and the supervisor is the mechanism that guarantees they don't.
A swarm architecture runs through an open population of peer agents, spawned dynamically and sized to the task. Instead of reporting to a coordinator, agents communicate through shared memory or a message bus, and the population expands or contracts as the work demands. Roles in a swarm are not fixed. If an agent starts out writing code, it might shift to testing mid-task when it notices a backlog of unreviewed pull requests sitting on the shared blackboard. In LangGraph's swarm implementation, this fluidity extends to how responses reach the user: when an agent responds, that response goes directly to the user, and the active agent stays active until it explicitly hands control off to another agent. There is no central router approving that handoff. Tracing a failure in a swarm means following messages across a peer-to-peer network, since there is no single decision log to inspect. Shared state, often held in a vector store or a fast in-memory store acting as a blackboard, replaces the supervisor as the coordination medium: agents pin results there, and other agents pick them up on their own.
How task structure, not preference, determines which pattern performs
The deciding question for any coding task is whether its subtasks can run independently or whether each one has to wait on another's output. Writing a function, then writing its test, then reviewing that test for security issues, then merging the result is a different kind of task. The order has to hold, and a swarm's fluid role assignment creates a specific risk in that setting: a testing agent could act before the function it is meant to test even exists.
The benchmark evidence lines up with that structural distinction, though not as cleanly as a simple "swarm wins" headline would suggest. LangGraph's benchmarks, run on a modified version of τ-bench, found swarm architecture slightly outperforming supervisor architecture across the board. But the supervisor pattern is also the more generic of the two, in the sense that it makes the fewest assumptions about the agents underneath it, and a naively implemented supervisor can underperform a carefully tuned one by a wide margin. LangChain's own team improved their supervisor implementation, and when they did, they measured a nearly 50% increase in benchmark performance. That gap matters for how teams should read the comparison: architecture choice is one variable, but implementation quality within a chosen pattern moves the numbers just as much.
It's tempting to respond to all this by saying: run both patterns against your actual tasks and keep whichever wins. That advice understates what is actually at stake. Running the wrong architecture in production does not cost a few benchmark points. A supervisor applied to a workload it cannot structurally support produces queuing failures under load. A swarm applied to sequential tasks produces cascading incorrect outputs because steps execute out of order. Task structure is the variable that determines which of those two failure modes a team is signing up for.
The supervisor's real failure mode: what happens when sequential tasks scale
The supervisor's bottleneck is a structural property of the pattern that appears predictably as task complexity grows. Hierarchical orchestration has a scalability limit bounded by the supervisor's own context window: as the work gets more complex, the coordinator has to hold more state, route more decisions, and synthesize more outputs, and all three of those draw on the same finite pool of context.
Consider a large fleet of agents working to refactor an enterprise codebase under a single supervisor. The supervisor has to read every agent's output, reconcile conflicts between them, and issue new instructions back out, and that loop makes the entire system synchronous, bound by the slowest component operating under the highest-ranking model in the hierarchy. A misrouted instruction at the top compounds this problem. Because workers have no way to correct the supervisor's framing of a task, an early hallucination in the coordinator's plan propagates into every downstream worker action. The resulting failure is total. There's a specific operational signal engineering teams should watch for here: if adding more agents to a supervisor-based system increases latency instead of raising throughput, the supervisor's context ceiling has been hit, not the workers' capacity.
The right response to that signal is to stack supervisors rather than abandon the supervisor pattern for sequential work. If mid-level coordinators each manage a bounded subset of workers in a hierarchical arrangement, any single supervisor's context load stays within range, and sequential tasks still get the ordering they need. Swarm architecture avoids this particular bottleneck entirely, but it pays for that avoidance with a different and equally real cost.
The swarm's real failure mode: coordination overhead and debugging opacity

No single agent's failure stalls a swarm, but that advantage comes at a price that grows faster than the agent count does. Supervisor coordination overhead scales roughly linearly as workers are added. Peer-to-peer coordination in a swarm can scale quadratically instead, because every agent is a potential communication partner for every other agent, and that communication graph grows far faster than the agent count itself.
The debugging problem that follows is structural. When a swarm produces a wrong answer, there is no central routing log to check the way there is with a supervisor. Reconstructing what went wrong means piecing together a distributed conversation spread across agent handoffs and shared blackboard state after the fact. Fluid role allocation, the very feature that makes swarms adaptive to shifting workloads, is also the source of their most dangerous failure mode in a coding context specifically: an agent that reassigns itself from code generation to testing mid-task can generate tests against code that does not exist yet, or against a function that gets rewritten two steps later by another agent in the swarm.
In LangGraph's swarm implementation, each sub-agent needs explicit handoff tools for every agent it is permitted to transfer control to, but it doesn't need one for every agent in the system. In practice, that constraint means swarm works well for a closed, team-controlled set of agents, and breaks down once a third-party or externally managed agent needs to join, since there's no way to guarantee an outside agent implements the handoff protocol correctly. The practical signal to watch for on the swarm side mirrors the one on the supervisor side: if a swarm system produces inconsistent outputs on work that looked parallelizable on paper, the likely culprit is an implicit ordering dependency that nobody spotted at design time, often a shared file, a shared module boundary, or a shared data structure that two "independent" subtasks both touch.
Reading a coding workload and matching it to an architecture

Matching architecture to workload starts with two questions asked about the task in front of you, before any architecture gets chosen at all: do its subtasks carry ordering dependencies on each other, and do any of them need to see another subtask's intermediate output before they can finish their own work. Take a workload built from generating tests for independent modules: it answers no to both questions, since no module's test depends on another module's test existing first. The same is true of dependency scanning and version upgrades across a monorepo's separately versioned packages, documentation synchronization across services that don't share state, and lint error resolution across a codebase where each error is local to its own file. These are swarm-shaped problems. Bug fix pipelines require ordering if root cause analysis has to finish before a patch gets written, and so do compliance-sensitive workflows that require auditable, deterministic execution order, and any workflow where a downstream agent's correctness depends on a specific output from an upstream agent. These are supervisor-shaped problems.
The hardest cases sit in between. Cross-module refactors that touch a shared interface look parallelizable on the surface, because you can edit the individual modules independently, but the interface change itself is a hidden sequential dependency that runs through all of them. Teams that treat this kind of work as a swarm task tend to generate merge conflicts that then require a supervisor pass to sort out anyway, undercutting the point of avoiding the supervisor. If the work can be written up as a set of independent tickets in Linear or GitHub with no blocking relationships between them, it's a swarm candidate, the test every engineering team already has language for. If those tickets form a dependency chain, where one has to close before the next can open, it's a supervisor candidate. That translation matters because it turns an architectural decision into a planning decision teams are already equipped to make.
What isolated environments reveal about architecture choice
Architecture choice does not operate independently of the environment agents run in. The quality of that environment determines whether parallel execution is safe, and swarm's entire parallelism advantage is conditional on isolation quality rather than guaranteed by the architecture itself.
Swarm agents sharing a single environment can interfere with each other's filesystem state, installed packages, or running services in ways that look, from the outside, like a coordination failure in the agent logic. If two agents write to the same file path, or one agent's package installation breaks another agent's dependency resolution, the symptoms can look like a broken handoff protocol when the actual cause is environment collision. Isolated, per-task virtual machines remove this entire class of failure. Each agent run gets its own filesystem, its own dependency state, and its own process namespace, so two swarm agents working on different modules genuinely cannot step on each other. That isolation is the prerequisite for swarm's parallelism claim to hold up in practice rather than remaining a property true only on a whiteboard.
Replicas runs each agent task inside its own sandboxed VM, pre-loaded with a team's dependencies and tooling, so agents can install packages, run services, and verify their own work without touching any other concurrent agent run. That is the infrastructure condition that turns parallel swarm execution into something teams can trust rather than a setup prone to intermittent, hard-to-reproduce failures. The supervisor pattern is less exposed to this particular risk, since only one agent is writing to the environment at a time in a strictly sequential workflow, but even supervisor pipelines benefit from per-task isolation: a corrupted environment from one run should never be allowed to contaminate the next one. Platforms like Replicas sidestep some of these structural limits: they run each task in its own isolated VM with the team's full tooling pre-loaded, which removes the context-window squeeze and the sandboxing concerns that often push teams toward multi-agent architecture before they've actually hit a real ceiling. Once a single agent does hit that ceiling, though, the choice between swarm and supervisor becomes unavoidable, and no amount of isolation resolves it.
Why harness-agnosticism changes the architecture calculus
Architecture pattern and agent harness are separate decisions that happen to interact, and conflating them is a common source of unnecessary lock-in. A supervisor pattern does not require every worker underneath it to run the same harness, and a swarm does not require every peer agent to run the same underlying model. A supervisor coordinating a sequential security review, for instance, might use one model to plan the review and hand the actual review step to a specialized code analysis agent running on different tooling.
The deployment layer adds another dimension to this same point. Swarm and supervisor systems don't just coordinate differently inside; they also integrate with a team's existing workflows differently. A supervisor running as a single cloud agent process can be triggered from Slack or from a GitHub event and return a pull request with minimal operational overhead. A swarm of peer agents communicating through a shared message bus introduces real coordination work of its own: someone has to orchestrate agent startup, manage state synchronization across the bus, and collect outputs from a population that may be growing or shrinking in real time. Understanding the shape of the task before choosing an architecture is what keeps that complexity from compounding later.
Locking into a single harness because it happens to integrate cleanly with a chosen architecture repeats the same mistake as locking into a single architecture because it happens to integrate cleanly with a chosen harness. Both decisions belong to task structure and to what a given model is actually capable of doing well, not to whichever integration was easiest to wire up first. A team that keeps those two choices, architecture and harness, genuinely independent gives itself room to match both to the work in front of it, rather than inheriting constraints from a decision that was never really about the work.


