← All posts
ESSAY

What Burning 100B Tokens on Agent Swarms Taught Us

Why large-scale multi-agent swarms break past hour one — and why AnySwarm separates a minimal sandbox runtime from user-space Harnesses, unified Service plugins, and Coding-Agent observability.

AnySwarm — What Burning 100B Tokens on Agent Swarms Taught Us

1. Lessons from Burning 100B Tokens

Shortly after the formalization of Fermat’s Last Theorem was completed, our team tried to push the frontier further with large-scale agent swarms. The intuition felt obvious: single coding and theorem-proving agents had gotten remarkably strong, so throwing dozens of parallel agents at a hard repository or formalization project ought to crack problems a single session couldn’t finish in days.

We hit wall after wall. By the time we pulled the plug, we had burned through 100 billion tokens—and failed.

What killed those runs wasn’t that an individual model couldn’t write a Lean tactic or patch a module. Each verification cycle—compiling a proof tree or running a heavy test suite—took minutes, and once dozens of agents ran concurrently past the first hour, everything broke between them. We would check on a six-hour run and find five agents had independently spent forty minutes proving the exact same helper lemma under slightly different names while nobody touched the actual blocking subgoal. Another agent would tweak an upstream definition to make its local file compile, silently breaking six downstream modules its peers were actively editing. Workers that hit wall-clock timeouts mid-build were killed before their partial progress was ever copied out of the container.

Iterating on our own setup was even worse. Every time we wanted to test a different way of organizing the team—say, moving from a flat pool of open sorry goals to a lead decomposer paired with leaf provers and a verifier—we ended up spending days ripping apart Docker wrapper scripts, bind mounts, ad-hoc JSON state files, and prompt glue instead of testing the idea itself. And when throughput flatlined at hour three, we were left staring at gigabytes of raw interleaved logs where grep couldn’t answer the simplest question: Did progress stall because the problem decomposition was wrong, because a slow container was holding a lock, or because twenty agents were burning millions of tokens repeating a dead end?

Looking across open source over the past year, it became clear this wasn’t just our pain. Single-agent design has largely converged—projects like Pi (with its minimal read / write / edit / bash core) and DeepSeek Harness (with its plugin microkernel) proved you don’t need a bloated framework to run one capable coding agent. Yet the moment you step up to multi-agent swarms, the ecosystem fractures completely, and every team goes right back to hand-rolling fragile distributed plumbing from scratch.

Like early programs written before operating systems—when every application had to manage its own memory, disk I/O, and scheduling—today’s multi-agent projects keep rebuilding execution infrastructure just to try a new coordination idea.

We built AnySwarm out of those scars. Instead of proposing yet another opinionated orchestration graph, AnySwarm separates how you isolate and run a fleet of coding agents (the Runtime) from how you equip and organize them to collaborate (the Harness).


2. Zero Hardcoded Graphs: Looking Beneath Today’s Multi-Agent Systems

Why hasn’t the community converged on one multi-agent template—and how can a minimal foundation support systems that look nothing alike? Instead of comparing marketing diagrams, look at what recent multi-agent systems actually do under the hood.

Take three striking open designs from the past year: SwarmChat, ScaleMAS, and DeepSeek’s Super-agent.

On the surface, they share almost nothing. SwarmChat gives agents a Slack-like workspace with channels, threads, and mentions. ScaleMAS (from FAIR and Harvard) drops chat and central coordinators entirely: 128 asynchronous agents never talk to one another, coordinating solely through a shared citation store. DeepSeek’s Super-agent pairs a lightweight persistent Router session facing GitHub and IM events with isolated background Workers executing tickets in parallel.

Strip away those surface metaphors, however, and all three systems split cleanly into the same two layers.

At the bottom sits the exact same execution unit: an isolated, stateful coding-agent session with local shell and file tools. Every one of these systems needs to spawn sessions on demand, keep context alive across turns without burning tokens while idle (why SwarmChat built its blocking swarmchat wait command), steer or interrupt a single runaway agent mid-turn, proxy model calls without leaking API keys into containers, and collect files cleanly at shutdown.

Everything that makes the three systems behave differently lives in a thin policy layer above:

Existing projects keep reinventing the wheel because they fuse that thin coordination policy together with heavy container, bridging, and logging infrastructure.

AnySwarm cuts right along that seam. Homogeneous infrastructure—sandbox lifecycles, non-blocking session control (spawn, send, interrupt, stop), credential-free model routing, and artifact export—moves into the Runtime. Expressive policy—what shared tools exist, which roles can call them, and when the team stops—stays in your code as a lightweight TypeScript Harness.

A quick note on terminology: In single-agent literature and tools, an agent harness usually means the inner tool loop wrapping a single model (read / edit / bash plus context compaction). AnySwarm keeps single-agent executors like Pi and Codex intact inside each container and lifts the word one level up: here, a multi-agent Harness is the outer program that wires shared Services and coordination rules across many isolated agent sessions.

Switching from a chat-driven team to a citation swarm no longer means building a new distributed system; it means swapping a few dozen lines of TypeScript.

Figure 1. Subagents delegates work from a lead to children, TaskPool grants one worker an exclusive lease, and Substrate lets peers build on cited findings. Each run uses one of these coordination policies with the same Runtime interface for isolated sessions.

Figure 1. Subagents delegates work from a lead to children, TaskPool grants one worker an exclusive lease, and Substrate lets peers build on cited findings. Each run uses one of these coordination policies with the same Runtime interface for isolated sessions.


3. Apps Built for Agents: Why Unified Services Beat Raw A2A Tools

Once agents run in separate sandboxes, how should they interact?

The most common reflex is to hand every agent a raw Agent-to-Agent (A2A) tool—something like send_to_agent(peer_id, message) wired straight into another agent’s session—and let them figure the rest out.

To be clear, our objection isn’t to agents talking in natural language. You can build direct DMs, group channels, or debate rooms on AnySwarm in minutes—as a Message Service. What turns real systems into a maintenance nightmare is wiring point-to-point agent tools directly across sessions without a structured service layer underneath.

In practice, raw A2A tool wiring hurts most on infrastructure management, debugging, and iteration:

  1. Fragile lifecycle coupling. When Agent A holds a direct handle to Agent B, every crash, timeout, or worker replacement leaks into agent logic. Who buffers messages while B restarts? What happens when one role scales from one worker to ten?
  2. Opaque debugging and zero replayability. Point-to-point chatter scatters critical state transitions across dozens of private transcripts. When a four-hour run produces a broken patch, there is no single ledger showing what was claimed, what was reviewed, or why the team converged on a bad branch—and no way to snapshot shared state and resume from hour two.
  3. Painful iteration. Every time you want to add a rate limit, require a test pass before handoff, or switch from 1-to-1 handoffs to a shared queue, you have to rewrite agent prompts and rewire tool definitions across profiles.

This led us to a core design conviction: in the future, most software we build will be apps written for agents.

Software like GitHub, Jira, and Slack was built with humans clicking buttons in the inner loop. As agents take over execution, humans move to the outer loop—setting objectives, budgets, and evaluators—while hundreds of concurrent agents become the primary 24/7 users reading state, claiming work, and submitting artifacts. The UI disappears, but classical software engineering fundamentals matter more than ever: atomic leases so peers don’t overwrite each other, bounded queries so shared state doesn’t flood context windows, role-based access control, and objective verification gates.

That is why AnySwarm replaces ad-hoc A2A wiring with a single unified Service plugin interface. Core registers only the agent lifecycle service by default; everything else—a task board, a citation store, a benchmark leaderboard, or a chat room—is registered in your Harness via services.register(name, definition):

An agent cannot spoof a teammate’s ID, write to a board from a read-only reviewer profile, or mark a task “done” without passing whatever compiler or evaluator check the Service enforces. Even chat becomes just another clean, observable, replayable Service plugin.


4. Sandboxed Bash at Scale: Compute, Workspaces, and Pluggable Services

Giving every coding agent full bash and filesystem access unlocks dramatically more capability than restricting models to narrow function calls—an agent can run compilers, profile binaries, inspect git history, and execute test suites on its own. On a single session, running bash locally is fine; across dozens or thousands of concurrent agents, sharing one host filesystem guarantees collisions, leaked credentials, and lost work.

Scaling multi-agent runs cleanly requires decoupling compute, workspace state, and service backends so each can grow independently.

Compute on OpenSandbox

Rather than maintaining brittle Docker shell scripts, AnySwarm builds its sandbox backend on OpenSandbox, which cleanly separates the Lifecycle Control Plane (provisioning, pausing, destroying environments) from the Data Plane (execd)—a lightweight Go daemon inside each sandbox that handles command streaming and file I/O directly so the host controller never becomes a bottleneck. You can develop locally with Docker on macOS or Linux, and point the exact same Harness at a remote OpenSandbox cluster (including Kubernetes with gVisor or MicroVM isolation and strict egress rules) while keeping model API keys strictly outside agent containers.

Explicit Workspace Lifecycles

Cloning multi-gigabyte repositories from scratch for every exploratory reader—or letting twenty writers mutate one directory—breaks down fast. Inside each sandbox, AnySwarm pairs a lightweight supervisor (Worker) with the unprivileged Agent process:

True Extensibility: Plug In Any In-Process, HTTP, or MCP Service

Crucially, shared Services aren’t limited to toy in-memory objects. Because ServiceRegistry decouples how agents call a Service from where that Service runs, any in-process module, existing HTTP service, or MCP server can plug straight into your agent system:

You can evolve a 30-line in-process leaderboard into a distributed HTTP service without changing a single line of agent prompt or Runtime code.


5. Observability Built for Coding Agents (and Humans)

Almost every multi-agent tracing tool today shares one blind spot: it assumes a human is reading the logs.

In practice, as we iterated on swarms day after day, the primary engineer diagnosing stalled runs and tuning Harness rules wasn’t a human clicking through browser tabs—it was our Coding Agent.

Dumping a multi-hour swarm run into a single flat events.jsonl fails both humans and coding agents. Long runs easily generate gigabytes of interleaved model turns and bash outputs—handing that monolithic dump to a Coding Agent blows its context window immediately. Worse, the hardest swarm bugs aren’t static stack traces; they are dynamic systemic behaviors, like ten peers silently repeating the same dead end or starving behind a held lease.

AnySwarm structures every run directory (<outputDir>/<runtimeId>/) into two cross-linked layers:

  1. Per-Agent Partitioned Archives (<agentId>/ & model-trace/). Each agent’s native session history, tool calls, exported files, and model requests live in its own namespace alongside compact run-level summaries (runtime.json, evidence.jsonl). A Coding Agent can scan the high-level ledger first, spot an outlier worker, and open only that agent’s trajectory on demand.
  2. Independent, Replayable Service Records (service-calls.jsonl & service-state.*.json). Every cross-agent Service call—with caller identity, validated arguments, timing, and exported Service state snapshots—is recorded separately from agent chatter. You can audit collaboration bottlenecks directly or inspect exact state revisions across rounds.

With those two layers separated, a Coding Agent (or a 10-line script) can immediately answer structural questions across a run:

And whenever a human wants to see the dynamic picture visually, running anyswarm trace opens the exact same directory in a zero-dependency local browser Trace Viewer—rendering parallel sandbox swimlanes, Service calls, live steering events, and exported file diffs side by side.

Figure 2. Four peers worked on FrontierCS-2’s binary fuse filter for 60 minutes and 35 seconds.

Figure 2. Four peers worked on FrontierCS-2’s binary fuse filter for 60 minutes and 35 seconds. The orange Tools tracks show Peer 2 most active near the start and Peer 1 using tools again in the final third. Model requests continued across all four lanes.

Replay the full four-peer timeline →


6. Putting It Together in 3 Steps: Inside AutoResearch

How much code does it actually take to build a serious multi-agent system on @anyswarm/core? Every Harness follows the exact same three-step pattern:

  1. Define shared tools (Services): Register the shared state, boards, or evaluators your agents will interact through.
  2. Define team structure (Profiles): Declare agent roles, sandbox write permissions, and which Service operations each role may call.
  3. Run together: Spawn isolated sandboxes in parallel, steer or gate progress through your loop, and export verified results.

AutoResearch (examples/autoresearch) shows all three steps working together on open-ended code and algorithm optimization—where no predetermined plan exists and agents must discover improvements iteratively against an objective benchmark:

As a quick-to-try demo experiment, we ran four equal GPT-6.1 Sol peers for just 1 hour on the FrontierCS-2 (binary_fuse_filter) benchmark. The peers iterated autonomously across competing hypotheses, cross-peer reviews, and derived patches to reach 53.071242 / strict PASS on the independent final evaluation—with every candidate byte, review, and evaluator receipt preserved for inspection. This is a small workflow demo rather than a formal benchmark claim about any model’s capability:

Figure 3. Peer 1 built candidate-8 on Peer 4’s candidate-7.

Figure 3. Peer 1 built candidate-8 on Peer 4’s candidate-7. The research Service records the parent and the hash of each patch. Of eight candidates scored in training, candidate-8 advanced to the independent final evaluation and earned 53.071242 (strict PASS).

And because none of AutoResearch’s coordination rules are hardcoded into the Runtime, swapping just those three steps on the exact same @anyswarm/core foundation gives you completely different multi-agent architectures—available as editable starter exports (anyswarm eject subagents | first-harness | autoresearch) or built-in / repository reference implementations:


7. Open Questions & Getting Started

Separating the Runtime from the Harness doesn’t magically solve multi-agent reasoning—it clears away the infrastructure rubble so we can iterate on coordination ideas in hours instead of weeks.

Hard open questions remain in the Harness layer above: How should task topologies reshape themselves dynamically when one worker’s discovery invalidates an entire subtree of in-flight work? What abstractions best prevent subtle convergence collapse across hundreds of peers? We don’t pretend one fixed template answers those questions; our goal is to give both you and your Coding Agent a clean, observable runtime to test new answers fast.

As coding agents grow stronger, hand-writing boilerplate orchestration glue makes less and less sense: let your Coding Agent write and evolve the Harness—just don’t make it improvise the distributed runtime underneath.

AnySwarm (@anyswarm/core) is open-source under the MIT license: