Home · Articles


AX

December 1, 2026

As agents take on bigger goals, the work stops fitting inside a single process. One goal turns into many tasks running in parallel in isolated environments, with something in the middle breaking the work down, handing it out, tracking progress, and merging the results. If you have spent any time on distributed systems, this should look familiar. Tasks lose time to coordination that should go to real work. They compete for the same limited resources. They disagree about shared state. They fail independently of each other.

Adding an agent is a lot like adding a service. You get more capacity, but you also get more coordination, more waiting, and more chances to step on someone else’s work. At some point the cost of keeping everyone in sync is bigger than what another agent contributes.

We’ve been working on a runtime for this, called AX. This post walks through how it’s put together, but mostly it’s about the question it made us think about the most: who should decide what the swarm looks like?

Agents are made from the same parts

The word “agent” covers a lot of things: chat assistants, long-running autonomous agents, and swarms where a coordinator hands subtasks to parallel workers. They look different from the outside, but they’re built from the same pieces. There’s a model that decides what to do next, a control loop that carries out its decisions, an environment where actions take effect, state that persists across steps, and a security boundary that governs contact with the outside world. What changes is how many of each piece there are, how long they live, and how they’re wired together.

Class Control loops Environment State
Chat assistant 1 Short-lived Conversation history
Autonomous agent 1 Persistent, populated from data sources Workspace and history
Swarm 1 coordinator and N workers One per worker, from shared initial state Shared log and per-worker state

So instead of prescribing one architecture, AX exposes each of these concerns as its own object and leaves the composition to the agent. The same objects run a simple agent or a swarm of a thousand. Moving from one shape to another shouldn’t require a different system.

The AX object model

The task is the unit

Everything interesting about the runtime comes down to what a Task guarantees. Each one has its own filesystem and process tree, and no network access beyond what its Gateway grants. It can’t see other tasks, the host, or the control plane. Its permissions are scoped to that one execution, and raw credentials never enter it.

Tasks are stateful. Edited files, installed dependencies, build artifacts, and running processes carry forward across steps. A task starts suspended, runs, may suspend again to wait for input, and ends either completed or failed. Suspending checkpoints the sandbox and releases its compute, so a parked task costs storage, not CPU.

A task receives a goal and configuration, suspends and resumes across preserved state, and produces outputs

Every task also carries limits on CPU, memory, runtime, turns, and tokens. When it runs out, it stops on its own without draining the rest of the agent. And a task doesn’t have to involve a model at all. It can run a coding agent, a deterministic test runner, or a rollout script, and the orchestrator drives all of them the same way.

apiVersion: ax.io/v1alpha1
kind: Task
metadata:
  name: fix-flaky-test
spec:
  workspace: { name: payments }
  gateway:   { name: github-and-model-access }
  sessionId: "7c9e6679-7425-40de-944b-e07fc1f90ae7"
  goal:
    text: "Fix the flaky checkout test."

Running a swarm is the easy part

With those pieces, running a swarm is mostly mechanical. Deciding what it should look like isn’t. How many agents should run? Should they work independently or in teams? How big should each team be? When should they share what they found, and when should they stop?

Today, these questions are answered in one of two ways. Either a model is asked at every turn with no real constraints, or a person writes a fixed workflow up front: these five agents, these roles, this hand-off order, these stop rules. The first is unbounded. The second is brittle, because the right answers change from task to task. A badly chosen swarm can do worse than a simple agent, and a simple agent can do worse than a well-chosen swarm. There is no shape that wins everywhere.

Three ways to run agents

Swarms only pay off in a few ways. Agents can split a job into pieces that don’t depend on each other and finish them in parallel. They can try different approaches to the same problem and keep the best one. They can build on each other’s findings so every attempt starts from a better place. Or a swarm can mix models, giving the hard steps to a large model and the routine ones to cheaper ones. None of these is guaranteed, and how much each one helps depends on the task.

Swarms help with Swarms struggle with
Large solution spaces Strict sequential dependencies
A lot of available parallelism A shared context that keeps changing
Reliable, cheap verification No reliable verifier
Discoveries that can be reused Work that’s already easy for one capable model
High-value results under fixed deadlines Cases where token efficiency matters most
A mix of deterministic and open-ended steps Every step being open-ended and hard to check

Splitting the responsibility

The split we ended up with is simple to say:

Users own trade-offs, models own topology, the runtime owns enforcement.

The user brings a goal, a budget, a deadline, a way to verify the result, and limits. They don’t pick a team size or write a coordination script. The model decides whether to swarm at all, and if so, how to organize the work. The runtime enforces the limits from outside the sandbox, without trusting the model to behave.

This matters because each party is good at something different. Users know what a result is worth to them and how much they’re willing to spend. Models are increasingly good at reading a problem and deciding how to break it down. And runtimes are good at the boring, reliable part: counting tokens, rejecting the 51st task when the cap is 50, and stopping a runaway process. A model that misjudges how far to scale should run out of budget, not overload the platform.

Goal-based orchestration

Orchestration as a sequence of decisions

Once the topology is the model’s responsibility, orchestration stops being a plan fixed at the start. It becomes a sequence of decisions that get revisited as verifier scores come in, as the ledger fills up, and as the budget shrinks. Five of them carry most of the weight:

  1. Whether to swarm. How decomposable is the task? How many sequential dependencies does it have? How strong is the verifier? How tight is the deadline? Often the right answer is “don’t.”
  2. How to spend the budget. Let one agent think longer, run N independent agents and keep the best, form one team, split into k teams of m so that teams explore and members exploit, or run a coordinator with workers it adds and removes as it goes, maybe with intermediate leads.
  3. Which model does what. A strong model for the coordinator and the hard branches, cheaper ones for routine work, a strong one again for verification.
  4. What to share and with whom. This is the one I find most interesting. Sharing too much makes large teams converge on the same idea too early. Sharing too little and every lane rediscovers the same dead ends.
  5. When to stop. The verifier is satisfied, returns have flattened, or the budget is running out. Along the way, it also decides when to move from grabbing easy wins to deeper, riskier lanes.

These are heuristics today. The longer-term point is that a model, and eventually a trained policy, learns these decisions instead of having them hard-coded by whoever wrote the workflow.

The verifier is part of the goal

The more we worked on this, the more the verifier looked like the most important input. Search only pays off when you can tell good results from bad ones cheaply. A test suite plus a benchmark, or a proof checker, makes wide exploration worthwhile: try twenty ideas, keep the ones that pass. A weak verifier, like “does this report look right,” pushes you toward a simple agent or a small team with a human reviewing the result.

So the verifier isn’t an afterthought. It’s part of the goal the user brings, and it shapes how far the model should be willing to scale. AX runs it as a fresh, isolated task for every candidate, so it never shares state with the work it’s judging. It decides whether a result is accepted and gives the coordinator a score to compare results by.

What the runtime has to make cheap

Letting the model change its mind is only practical if changing its mind is cheap and a bad call is easy to recover from. If spawning a worker takes minutes, the coordinator is pushed back toward a fixed team chosen up front.

Warm fan-out. Every worker starts from the same prepared Workspace snapshot. The expensive setup, cloning repositories, installing dependencies, fetching data, happens once instead of once per worker, and new tasks can do useful work within seconds. A hundred workers can start from the same baseline without sharing a mutable filesystem. A side benefit is that differences between results come from the work, not from drift between environments, which makes the verifier’s scores easier to trust.

Suspend, resume, and reallocate. Parking a task checkpoints its files, build artifacts, and running processes, then releases its CPU and memory. An unpromising lane can be parked, its compute given to a deeper lane, and brought back later if new findings make it relevant again. Tasks waiting on a person, an external build, or a staged rollout can stay parked for hours at little cost. A parked task’s remaining budget is frozen, not lost.

Hierarchical budgets. The agent has a total budget for tokens, spend, and time. The coordinator splits it across teams or branches, which split it again across tasks. A child can never exceed its parent. Limits are enforced in three places: admission control rejects a new task that would break a cap, the Gateway meters model calls for tokens and rate, and the sandbox stops a task that runs away on CPU, memory, or time. None of these depend on the model behaving well. When a budget runs out, only that piece stops, and the coordinator gets an event it can act on: move budget from a weaker lane, stop the branch, or ask the user whether to spend more.

The Session as a ledger. In a swarm, the Session holds a shared ledger of plans, findings, dead ends, lessons, hand-offs, and merges into the current best result. Workers write to it as they go. They don’t read the whole thing, though. The coordinator decides what goes into each worker’s context. That’s where sharing gets tuned: a small team on the same idea might see everything the others publish, while separate teams see only summaries, which keeps a large swarm from collapsing onto one idea too early. Because the Session records everything, the ledger survives workers being parked or replaced, and a person can read the run afterwards and see which lane found what and why the winner won.

Least privilege that doesn’t widen. Every worker runs behind the narrowest Gateway for its role. Exploration workers might reach only the model API and package registries, reviewers might also reach the code host, and only rollout tasks can reach production. Credentials are attached to requests after they leave the sandbox, so untrusted code inside a worker can’t read or leak them. Each task also has its own identity, tied to its agent, its session, and the user it acts for, so every model call and outbound request can be traced back to who caused it. Adding the thousandth worker adds capacity, not new ways to reach sensitive systems.

Example: fixing a bug end to end

Consider a bug where a retry path in a payments service sometimes charges a customer twice under load. The user’s goal is to fix it and roll it out safely. They point to the test suite as the verifier and require human approval before the change goes past a canary.

A swarm agent takes a bug fix from investigation to a staged production rollout

  1. Investigate. The agent starts three hypothesis tasks from the payments Workspace, behind a Gateway that can reach only the model API, the code host, and package registries. One reproduces the double charge with a failing test and produces a patch. The other two rule their hypotheses out and are parked, then deleted.
  2. Verify. A fresh verifier task on a stronger model runs the new test a hundred times next to the full suite. A reviewer task opens a pull request. Everything stays parked while a person reviews the code.
  3. Roll out. The agent creates one task per stage: staging, a canary on 1% of traffic, a single region, then everywhere. These run behind the only Gateway that can reach production. Each stage bakes the release and checks metrics before the next one resumes. Going past the canary needs human approval, and a regression triggers a rollback task.

The shape of the work changes with the stage. Investigation runs wide, because the cause is uncertain and a cheap reproduction test can judge each hypothesis. Verification and review are narrow. Rollout is strictly sequential, because parallelism there would only add risk. Deterministic tasks run the tests and the deploys, model-driven tasks diagnose the bug and write the patch, and people approve the review and the promotion. Nobody scripted those shapes. They follow from the goal, the verifier, and the stage. The Session ties every task into one record, from bug report to production.

Example: search and optimization

A different family of work has no single right answer, only better and worse ones. Kernel optimization is the classic case: make code faster without changing its results. The same pattern shows up in tuning queries, speeding up a slow service, shrinking a build, or proving theorems in a formal language.

These are a good fit for a swarm for three reasons. The search space is large, so many ideas are worth trying at once. A cheap, reliable verifier exists, a test suite plus a benchmark or a proof checker. And findings carry over, because a lesson from one lane, like where the time actually goes, usually helps the others.

The user brings the goal, the verifier, a budget, and a cap on how many agents can run. The coordinator starts with a few broad lanes, say profiling, reducing data movement, cutting startup overhead, and trying a new design. Workers publish what they learn to the ledger, and the coordinator passes on only what each lane needs. Every candidate goes to the verifier in a fresh run, and only the ones that pass are merged into the best result so far. As the easy wins run out, the coordinator changes shape. It parks lanes that have stalled, gives more budget to the few deep lanes that still look promising, and stops when the score flattens or the budget runs low.

Example: deep research

A research agent turns an open question into a report backed by sources. The coordinator first decides whether the question needs a swarm at all, then splits broad questions into sub-questions and runs a reader task for each, behind a Gateway that allows only search, approved sites, and the model API. Readers log sources and claims to the ledger. The coordinator drops dead ends, follows promising leads, and stops widening the search when new sources stop adding new claims. A writer drafts the report, and a verifier on a stronger model checks that every claim matches its source. Because that check is weaker than a test suite, the coordinator keeps the team small, and the report can be held for human review.

Same runtime, three very different shapes.

Learning to scale

Every scaling decision, spawn, park, regroup, model choice, what was shared, when to stop, is recorded in the task’s trajectory alongside prompts, responses, and tool calls. Because a Workspace is a reproducible starting point, the same goal can be replayed under different topologies or models, and differences in outcome come from the change rather than the environment. That makes it possible to compare a simple agent, N independent agents, one team, k teams, and a coordinator on the same goal and the same budget.

Those trajectories are also training data. Successful runs become examples. Best-of-N and competing teams naturally produce paired attempts for preference tuning. Bad scaling outcomes, like over-spawning, converging too early, or wasting a deadline, become regression tests. Steps that reliably succeed on small models get routed to them. And coordinator runs scored by a verifier are a reward signal for training orchestrators that know when to work alone and when to swarm.

Fixed workflows may still be relevant

Goal-based scaling is a default, not a requirement. Teams that already know the right shape for their work should be able to encode it, and get the same isolation, budgets, and records as everyone else. That matters right now, because working well in a large team is still a developing model capability. A well-chosen fixed team can still beat the model’s own choices.

There are plenty of open questions. Too much sharing makes large teams collapse onto one idea, and I don’t yet know how a runtime should expose sharing controls without prescribing a topology. Speedup is sublinear and depends on the task, so it’s not clear a coordinator can give trustworthy cost and time estimates up front. And the one I think we’re missing most: there’s no standard way yet to tell whether one orchestration choice beats another, and public agent benchmarks rarely test swarms.

We’re building AX in the open at github.com/google/ax so we can have these conversations in public. It also helps us significantly to open a layer like this because we want to build portable agentic applications and swarms on top of this runtime.

It’s fairly simple to build custom agentic orchestrators on a layer like AX. Just ask your coding agent to put together a swarm, and tell us what you built.


Home · Articles