On this page
- When orchestration becomes necessary#
- Three things people mean by agent orchestration#
- A production architecture and one task’s lifecycle#
- State, claims, retries, and idempotency#
- Isolation, secrets, and verification#
- Budgets and observability#
- What the fleet measurements tell me to budget#
- Failure modes that changed the design#
- Choosing a control tool#
- Source and deeper field notes#
curl -s https://jedarden.com/guides/agent-orchestration.md AI agent orchestration is the control system around an agent’s work. It decides which task can start, gives that task to one worker, limits what the worker can reach and spend, checks the result, and decides what happens next. The model does the uncertain part; the surrounding system keeps that uncertainty from turning into lost work, duplicate work, or an unattended retry loop.
I learned the distinction by running about twenty headless coding agents at once. The incidents in my fleet failure taxonomy happened in the queue, host, deploy path, and test environment more often than in the agent itself. This guide is the architecture I use to reason about those seams. It is a report from one coding-agent fleet, not a benchmark of every agent framework.
When orchestration becomes necessary#
A single, supervised session can rely on a person to notice a stalled task, choose the next one, and decide whether the answer is good. The moment work continues without that person, those decisions need an owner and a durable record. A multi-agent architecture adds a second problem: two workers can see the same ready task or edit the same file at the same time.
My first move was to make each worker replaceable: it reconstructs its context from the task, repository, and standing instructions, then can be restarted without recovering a precious chat session. That changed which work was safe to dispatch and exposed the missing control loop. The experience and its tradeoffs are in Pet agents vs. cattle agents; the artifact handoff is documented in the workflow manual.
Use orchestration when you need unattended continuation, more than one worker, or an auditable answer to “why did this task run?” A person driving one agent through an exploratory problem may only need a task list and an independent check of the result.
Three things people mean by agent orchestration#
The term covers different control problems. This distinction comes from building a deterministic state machine around my own agents, alongside my workflow-engine CI implementation:
| Setting | Unit being coordinated | What must survive an interruption |
|---|---|---|
| Conversational collaboration | Turns, tool calls, and handoffs within a session | The useful decisions and context from that conversation |
| Workflow engine | Predetermined steps and their inputs and outputs | Step state, artifacts, and retry history |
| Coding-agent fleet | Replaceable workers taking repository tasks | Claims, task intent, work on disk, verification, and outcome history |
These are design lenses, not a vendor ranking. I use a workflow engine for known CI steps and a task queue plus outcome handlers for coding work whose path cannot be scripted in advance. A conversation is useful for discovery; before unattended dispatch I put its decisions into task and repository artifacts. The plan is the prompt shows what must be written down for a fresh worker to start well.
A production architecture and one task’s lifecycle#
Here is the smallest useful diagram of the fleet I run. It omits provider and deployment details deliberately; NEEDLE’s source and the state-machine account show the implementation and the outcome table behind it.
plan + acceptance checks
|
v
dependency-aware queue --atomic claim--> worker + bounded context
^ |
| v
retry / defer / stop <-- outcome handler <-- independent verification
| |
+----------- durable record <-----+
Illustrative state machine. These paths explain a control policy; they are not measured runs, timings, or outcome frequencies. Ready → atomic claim → worker → independent verification → outcome handler → durable record. A lost claim returns to the queue before work starts. A timeout or a human decision can interrupt before verification.
| Observed outcome | Durable next state | Handler |
|---|---|---|
| Checks pass | Closed with evidence | Record the artifact and successful checks, close the task, and release the claim. |
| Checks fail | Open for diagnosis | Record the failing check. Retry only when there is a concrete correction and budget remains. |
| Gate cannot run | Waiting on verification | Record the broken verification dependency and repair it before judging the artifact. |
| Worker times out | Reconcile before retry | Inspect durable writes, reconcile the claim, and retry only within the remaining budget. |
| Another worker wins claim | Select other ready work | Do not start this task. Return to the ready queue without changing the winning claim. |
| Human decision required | Waiting on a decision | Record the exact decision and stop dependent work until it arrives. |
With JavaScript, choose an outcome and replay the corresponding path. Only passing independent verification permits closure.
In one pass, the controller selects ready work, claims it once, constructs a bounded task context, dispatches an agent, then classifies the result. The classification matters more than the launch: a lost claim race, an agent failure, a broken verification gate, a provider outage, and verified completion need different handlers. My original six-row table grew when those cases proved different in operation; the later outcome additions are recorded in the state-machine note.
The queue carries dependencies as well as assignments. Cutting tasks so that parallel workers do not touch the same function is a planning decision, not something an atomic claim can solve. The manual’s decomposition section walks through that second concurrency boundary.
State, claims, retries, and idempotency#
I keep task state outside the agent session. A claim must be atomic, because “list ready tasks, then mark one mine” lets two workers begin the same task. The queue must also know whether the claimant is still alive: an abandoned claim is work that is neither done nor available. The atomic-claims walkthrough and the leaked-claim incident are the evidence for both rules.
Retries need a boundary. A timeout or temporary provider error may justify a new attempt; a task with contradictory acceptance checks will burn the same budget repeatedly. I record the failure class and cap attempts, then send structural failures to review. The death-loop incident is why the stop rule exists.
An idempotent action can be repeated without adding another effect. Before retrying interrupted repository work, I reconcile durable evidence such as the commit, task closure, and verification result. Reconciliation tells me which effects already landed and which work remains. “The process exited” alone cannot tell me whether its last write landed. The attempt-resolution design records why a process exit is only an observation, while the queue repair incident shows why I identify the authoritative state before rebuilding from a checkpoint.
Isolation, secrets, and verification#
I bound a worker’s filesystem and credential access to the work it owns, and I separate test state from live task state. A fleet test once wrote synthetic claims into real work queues across many repositories; the test-pollution incident explains why a test needs its own discovery scope and store.
Instructions alone cannot protect a secret available to the process. In my setup, the agent’s environment and credential access are constrained before dispatch; the credential-boundary note describes the failure that led there. The broader rule is to grant the smallest capability a task needs and make a sensitive action reversible or independently reviewable, as in the trust model.
Verification must be independent of the worker’s claim that it succeeded. Tests and acceptance checks run against the produced artifact, and a gate that could not run is a different outcome from a gate that ran and failed. Don’t let the agent grade its own homework shows the original lesson; the gate-error outcome shows how it changed the control loop.
Budgets and observability#
Unattended workers remove the person who used to notice a runaway session. I bound an attempt by time and work, govern the number of concurrent workers, and measure spend against verified completed tasks. Token totals alone hide whether the fleet delivered anything. The unit-economics note records the cost model and where it still falls short.
For operations, I watch the ready queue, claim age, outcome mix, completion rate, and spend rate. An alert saying “starved” is only a hypothesis until I check the queue from the right workspace; I have seen parsing and directory errors create false starvation. The operator’s-day section gives the actual signals I use. The twenty-agent incidents show why host health and worker launch also belong in the picture.
What the fleet measurements tell me to budget#
The Codex and Claude Code field comparison measured my fleet through October 31, 2026. These three views use the adapter that actually ran each attempt, rather than the worker name. The attempt traces cover September 12–October 31: 49 days within the report’s nominal 60-day window. Four executed groups are shown; 50 unassigned or legacy attempts are omitted. The task mix was not randomized, and the Anthropic sample is only 91 attempts. These observations help size a control loop; they do not rank model capability.
| Executed harness | Attempts |
|---|---|
| Codex CLI | 9,708 |
| Claude Code · Anthropic | 91 |
| Claude Code · GLM | 8,302 |
| Other (OpenCode / ZCode) | 190 |
| Executed harness | Verified / attempts | Yield | Yield excluding splits |
|---|---|---|---|
| Codex CLI | 4,843 / 9,708 | 49.9% | 60.7% |
| Claude Code · Anthropic | 20 / 91 | 22.0% | 23.5% |
| Claude Code · GLM | 3,303 / 8,302 | 39.8% | 42.5% |
| Other (OpenCode / ZCode) | 102 / 190 | 53.7% | 57.0% |
Yield is verified attempts divided by attempts. Split-decompositions schedule child tasks instead of delivering the parent, so the final column removes them from the denominator.
| Executed harness | Median attempt |
|---|---|
| Codex CLI | 5.9 min |
| Claude Code · Anthropic | 6.6 min |
| Claude Code · GLM | 28.2 min |
| Other (OpenCode / ZCode) | 5.8 min |
Process wall-clock includes verification gates. It does not measure active thinking time or time to a completed task.
The counts tell me where most of the retry and verification traffic came from. Yield tells me to budget for attempts that do not deliver, including useful task splits. Duration tells me to measure a timeout against the actual workload: a short median for one adapter does not justify the same budget for another. None of these numbers establishes a safe retry cap or a current vendor limit.
Failure modes that changed the design#
The fleet incident log is the source for this short list; each linked case includes the symptom, cause, and rule I took from it.
| What I saw | Control-plane change |
|---|---|
| Workers died during simultaneous launch | Stagger creation and count workers that actually started. |
| The same impossible task retried all night | Cap attempts and escalate structural failure. |
| A deploy stranded live workers | Drain and reconcile claims before changing the live launch path. |
| Claims outlived their workers | Use leases and reconcile liveness before releasing work. |
The common failure was an unmodeled seam. Naming each outcome and deciding who owns its recovery made the fleet easier to operate than adding another prompt instruction would have.
Choosing a control tool#
This is a decision table, not a head-to-head performance test. I evaluate a tool against four requirements: durable task state, exclusive claims, an explicit failure handler, and independent verification. The rows reflect only approaches I have operated: a person-operated task loop, NEEDLE, and Argo Workflows for CI. Argo exposes retry policies and limits; I still have to decide which failures my workload should retry.
| Approach I have used | Good fit in that use | Work I still have to supply |
|---|---|---|
| Person-operated task tracker | Learning the task partition and handoffs with a person present | The person handles stalled work, budgets, and outcome routing. |
| Task queue plus a coding-agent controller | Unattended repository tasks with replaceable workers | Task design, claim recovery, verification gates, and spend policy. |
| Workflow engine for fixed CI stages | A known sequence of build and test steps | A separate contract to classify an agent’s open-ended work before deciding what to retry. |
Start with the least machinery that can satisfy those four requirements for your actual workload. A framework name does not supply the missing task contract. I would test an unfamiliar product with one task that fails, one that times out, and two workers racing for the same claim before trusting its happy-path demo.
Source and deeper field notes#
The design here is inspectable: NEEDLE’s public repository contains the controller; a timeout configuration fixture shows concrete attempt and worker bounds; and the outcome-handling investigation records how a completed attempt left its task claimed after a worker died. The workflow manual shows the planning and queue protocol; the state-machine note records outcome evolution; and the twenty-agent failure taxonomy is the incident index. For specific boundaries, see credential isolation, independent verification, and cost per closed task.
Linear scale: 0–10,000 attempts
The Anthropic group has only 91 attempts. These are observed workloads with different task mixes, not randomized trials.
The numbers
| Executed harness | Attempts |
|---|---|
| Codex CLI | 9,708 |
| Claude Code · Anthropic | 91 |
| Claude Code · GLM | 8,302 |
| Other (OpenCode / ZCode) | 190 |
Linear scale: 0–100% verified · Filled: all attempts · Outlined: excluding splits
Yield is verified attempts divided by all attempts. The outlined bars exclude split-decompositions, which schedule children instead of delivering the task.
The numbers
| Executed harness | Yield | Verified / attempts | Excluding splits |
|---|---|---|---|
| Codex CLI | 49.9% | 4,843 / 9,708 | 60.7% |
| Claude Code · Anthropic | 22.0% | 20 / 91 | 23.5% |
| Claude Code · GLM | 39.8% | 3,303 / 8,302 | 42.5% |
| Other (OpenCode / ZCode) | 53.7% | 102 / 190 | 57.0% |
Linear scale: 0–30 minutes
Median process wall-clock per attempt, including verification gates. This is neither active thinking time nor time to a finished task.
The numbers
| Executed harness | Median attempt |
|---|---|
| Codex CLI | 5.9 min |
| Claude Code · Anthropic | 6.6 min |
| Claude Code · GLM | 28.2 min |
| Other (OpenCode / ZCode) | 5.8 min |
- ReadyDependencies and acceptance checks make this task eligible.
- Atomic claimOne worker owns the claim; a competing worker must move on.
- Worker runsThe worker receives bounded context, authority, and a time budget.
- Independent verificationThe gate checks the produced artifact against acceptance checks.
- CloseChecks passed against the artifact; record the evidence before closure.
- Durable recordClosure and evidence survive replacement of the worker.
Closed with evidence
Record the artifact and successful checks, close the task, and release the claim.
Choose an outcome, then replay its path. The full path stays readable while the highlight moves. A failed check and a check that could not run have separate handlers; only verified completion reaches closure.