|
| 1 | +--- |
| 2 | +title: Multi-agent orchestration |
| 3 | +description: >- |
| 4 | + Coordinate parent and child agents across local and cloud runs. Spawn, |
| 5 | + message, and subscribe to lifecycle events to build supervisor/worker, |
| 6 | + fan-out, critic, DAG, and swarm patterns. |
| 7 | +sidebar: |
| 8 | + label: "Orchestration" |
| 9 | +--- |
| 10 | + |
| 11 | +Multi-agent orchestration lets one agent spawn and coordinate other agents to parallelize work, delegate specialized tasks, or check each other's output. Every primitive — spawning a child, sending a message, subscribing to lifecycle events — is exposed as a public REST endpoint on the [Oz Platform](/agent-platform/cloud-agents/platform/), so the same patterns work from the Warp app, the [Oz CLI](/reference/cli/), and any system that can call the [Oz API](/reference/api-and-sdk/). |
| 12 | + |
| 13 | +This page covers the orchestration model and the patterns it supports. For how to start an orchestrated run, see [Running orchestrated agents](/agent-platform/cloud-agents/orchestration/multi-agent-runs/). |
| 14 | + |
| 15 | +## The parent/child model |
| 16 | + |
| 17 | +An orchestrated workflow always has one **parent agent** and one or more **child agents**. |
| 18 | + |
| 19 | +* **Parent agent** - the agent that decides what work needs to be done, spawns child agents, and (optionally) merges their results. The parent is just an Oz agent; any Oz agent can become a parent the first time it spawns a child. |
| 20 | +* **Child agent** - an Oz agent spawned by a parent with its own prompt, environment, and (optionally) a different model or harness. A child can spawn its own children, so orchestrations are arbitrarily deep. |
| 21 | + |
| 22 | +The parent and child each have an independent **run** with its own lifecycle, transcript, and credit usage. The child run records its parent in `parent_run_id` so the management view, API, and web app can render the hierarchy. |
| 23 | + |
| 24 | +### Where each side can run |
| 25 | + |
| 26 | +The parent and child don't have to run in the same place. Orchestration supports four combinations: |
| 27 | + |
| 28 | +* **Local → local** - A [Warp Agent](/agent-platform/local-agents/overview/) conversation in the desktop app spawns child Warp Agent conversations on the same machine. Useful for dogfooding orchestration patterns without spinning up cloud infrastructure. |
| 29 | +* **Local → cloud** - A local parent spawns one or more cloud children that run in [environments](/agent-platform/cloud-agents/environments/) on Warp-hosted or self-hosted infrastructure. The parent can keep working while children execute in parallel. |
| 30 | +* **Cloud → cloud** - A cloud parent spawns cloud children. This is the canonical pattern for review swarms, large fan-outs, and any orchestration triggered from Slack, Linear, a schedule, or the API. |
| 31 | +* **Cloud → local** - Less common, but supported when a cloud parent needs to hand off a task to a local Warp Agent for human-in-the-loop review. |
| 32 | + |
| 33 | +Children can also use a different [harness](/agent-platform/cli-agents/overview/) than the parent. A parent Warp Agent can spawn Claude Code or Codex children, and vice versa. |
| 34 | + |
| 35 | +## Lifecycle events |
| 36 | + |
| 37 | +Each run emits lifecycle events that the parent (or any subscriber) can react to. The server records every event in an append-only log; the parent receives events in real time over SSE and can also poll the event log for catch-up. |
| 38 | + |
| 39 | +The supported event types are: |
| 40 | + |
| 41 | +* **`run_in_progress`** - the run started executing (or restarted after being paused or blocked). |
| 42 | +* **`run_succeeded`** - the run completed successfully. |
| 43 | +* **`run_failed`** - the run hit a terminal failure. |
| 44 | +* **`run_errored`** - the run encountered an error during startup or execution. Includes a `stage` (`startup` or `runtime`) and an error reason on the event payload. |
| 45 | +* **`run_blocked`** - the run is waiting on a user action (for example, command approval, permission request, or `ask_user_question`). |
| 46 | +* **`run_cancelled`** - the run was cancelled before reaching a terminal state. |
| 47 | + |
| 48 | +The parent's harness sees these events as inputs and decides what to do next: keep waiting, send a follow-up message, spawn a replacement, or finish. |
| 49 | + |
| 50 | +:::note |
| 51 | +Lifecycle subscription is opt-in per child. When the parent calls the spawn tool, it passes an optional `lifecycle_subscription` list that filters which event types the parent wants to receive. Omit it to subscribe to all event types. |
| 52 | +::: |
| 53 | + |
| 54 | +## Messaging between agents |
| 55 | + |
| 56 | +The parent and children communicate through a per-run inbox. Messages have a sender run, one or more recipient runs, a subject, and a body. |
| 57 | + |
| 58 | +* The sender writes to `POST /agent/messages` with `to`, `subject`, `body`, and `sender_run_id`. |
| 59 | +* The recipient sees the message in its inbox; the parent receives a `MessagesReceivedFromAgents` input the next time it runs. |
| 60 | +* Messages are durable. A child that wakes up after the parent sent a message still receives the inbox contents. |
| 61 | + |
| 62 | +Messages are intentionally lightweight — they are not streamed transcripts. Use them for handoffs, status updates, and final results, not for piping a full conversation back to the parent. |
| 63 | + |
| 64 | +## Common patterns |
| 65 | + |
| 66 | +Orchestration primitives are general-purpose. Teams typically compose them into a handful of recurring patterns. |
| 67 | + |
| 68 | +### Supervisor / worker |
| 69 | + |
| 70 | +A parent supervisor agent breaks the task into a queue of work items, spawns worker children to claim and complete each item, and writes a summary when the queue is empty. Use this when the task is naturally divisible and you want a single agent to own coordination. |
| 71 | + |
| 72 | +### Fan-out / fan-in |
| 73 | + |
| 74 | +The parent spawns N children in parallel, each with a sharded prompt (one module, one file set, one test target, one model), then waits for all of them to complete and merges their results. Use this for large refactors, repo-wide migrations, or running the same task across multiple targets. |
| 75 | + |
| 76 | +### Critic / verifier |
| 77 | + |
| 78 | +The parent (the "writer") proposes a solution, then spawns a critic child to review it. The critic returns notes; the writer revises; the cycle repeats until the critic approves or a budget is exhausted. Useful when correctness matters more than throughput. |
| 79 | + |
| 80 | +### Review swarm (cloud → cloud) |
| 81 | + |
| 82 | +A scheduled or webhook-triggered parent spawns one cloud child per open pull request to run reviews in parallel. Each child posts its findings as a comment and exits. The parent fans in the results and posts a summary back to the triggering system. |
| 83 | + |
| 84 | +### DAG |
| 85 | + |
| 86 | +The parent encodes a directed acyclic graph of subtasks where some nodes depend on the outputs of others. It spawns ready nodes, waits on their lifecycle events, and spawns dependents as upstream nodes complete. Use this when the workflow has explicit ordering constraints (build → test → deploy, for example). |
| 87 | + |
| 88 | +### Swarm |
| 89 | + |
| 90 | +A flat group of peer agents discover each other through the messaging API and coordinate without a strict hierarchy. The parent acts more like a coordinator than a supervisor. Use sparingly — swarms are powerful but harder to debug than hierarchical patterns. |
| 91 | + |
| 92 | +## Approval mode |
| 93 | + |
| 94 | +When an agent runs in `orchestrate` mode (set by the `/orchestrate` slash command or the API's `mode: orchestrate` field), the agent **proposes** an orchestration plan and waits for approval before spawning any children. This gives you a chance to review the breakdown — number of children, prompts, environments, parallelism — before paying for it. Once you approve, the parent starts spawning children. |
| 95 | + |
| 96 | +`orchestrate` mode is distinct from `plan` mode. A plan-mode agent produces a written plan for *itself* to execute. An orchestrate-mode agent produces a plan for itself plus a fleet of children. |
| 97 | + |
| 98 | +## Observability |
| 99 | + |
| 100 | +Because every parent and child is a normal Oz run, all existing observability surfaces work without changes: |
| 101 | + |
| 102 | +* **[Managing cloud agents](/agent-platform/cloud-agents/managing-cloud-agents/)** - parent and child rows appear in the management view with the parent rendered above its children. |
| 103 | +* **[Oz web app](/agent-platform/cloud-agents/oz-web-app/)** - the Runs page renders the hierarchy and lets you open any run's transcript. |
| 104 | +* **[Oz API](/reference/api-and-sdk/)** - `GET /agent/runs?parent_run_id=...` lists a parent's children; `GET /agent/runs/{runId}` returns `parent_run_id` on each run. |
| 105 | +* **[Agent notifications](/agent-platform/capabilities/agent-notifications/)** - lifecycle and message events from children show up in the parent's notification mailbox. |
| 106 | + |
| 107 | +## Related pages |
| 108 | + |
| 109 | +* [Running orchestrated agents](/agent-platform/cloud-agents/orchestration/multi-agent-runs/) - how to start an orchestrated run from the CLI, slash command, web app, or API |
| 110 | +* [Oz API and SDK](/reference/api-and-sdk/) - REST endpoints for messages, events, and runs |
| 111 | +* [Cloud agents overview](/agent-platform/cloud-agents/overview/) - what a cloud agent run is and how it fits into the Oz Platform |
| 112 | +* [Deployment patterns](/agent-platform/cloud-agents/deployment-patterns/) - higher-level deployment models that orchestration composes with |
0 commit comments