Orchestrator-Workers

Some requests are simply too big or too varied for one AI agent to handle well on its own. You want to divide the work across focused specialists — without turning yourself into a project manager who has to split every task, chase updates, and stitch mismatched answers back together.

Orchestrator-Workers gives a multi-part request a single point of ownership. One lead agent takes responsibility for the whole outcome, delegates bounded subtasks to worker agents in parallel, and makes sure the finished pieces actually agree before handing you one coherent result. Reach for it whenever a request naturally splits into specialized parts that still have to fit together at the end.

Group Work structure
Also known as Supervisor-Worker, Lead and Specialists
Core rule Never finish a split request until the pieces are verified together
Defines records Party, Request

Why splitting work alone isn't enough

When a single agent session runs out of context or tries to juggle too many specialties at once — whether across engineering, research synthesis, report writing, data pipelines, or operations — dividing the request across parallel workers is an obvious move. Each worker gets a smaller, clearer brief and finishes faster.

The catch shows up when the pieces come back. Because each worker operates in isolation on only its own slice, every worker can faithfully satisfy its own brief while the combined output still fails as a whole: pieces contradict each other, duplicate responsibility, leave gaps at the seam, or quietly rely on different assumptions. If an orchestrator merely fans out subtasks and relays each worker's completion back to the requester, nobody owns whether the pieces actually fit together.

Orchestrator-Workers treats putting the pieces together as first-class work, not an afterthought. It rests on three structural rules enforced by the system rather than left to prompt reminders:

  1. One Lead agent owns the whole request end to end and is the sole voice reporting back to the requester.
  2. Combining the pieces is planned upfront. When splitting the request into subtasks, the lead creates an explicit integration job at the same time — defining how the finished parts will be combined, reconciled, or verified together.
  3. The Hub enforces completion in code. The request cannot be reported finished until every subtask and the integration job are complete.

Why plan the integration job before workers even start? Naming how the pieces will be combined or checked at split time — while the full picture is still in one head — forces shared assumptions (which pricing tier, which field name, which interface) into the open before isolated workers have a chance to diverge.

Naive fan-out Requester submits complex request Split directly across isolated workers Worker 1 Subtask 1 done Worker 2 Subtask 2 done Workers report done in isolation No one owns the seam between pieces Combined result breaks at the seam Pieces conflict, overlap, or leave gaps Orchestrator-Workers Lead splits request upfront Subtasks + one integration job Worker 1 Subtask 1 Worker 2 Subtask 2 Integration checks combined result Hub blocks finish until this succeeds Repair if needed, then one finish Requester gets one verified result
Isolated workers only see their own subtask, so local completion cannot catch contradictions, overlap, or gaps across boundaries. Declaring an integration job at split time makes whole-request coherence a blocking hub requirement before the requester is notified.

Architecture and participants

You do not need exotic infrastructure to run this pattern. Think of the Hub as a durable state store and rule checker — like a small state machine sitting between agents — and each Job as a tracked task ticket with one owner. Exactly one Lead agent owns the Request for the Requester; workers never answer the requester directly, and the hub enforces completion rules in code so a lead cannot wave past an open integration job.

Requester Defines goal & criteria Hub Enforces invariants Lead agent Sole request owner Hub durable records Request 1 lead, 1 integration job Subtask jobs Subtask 1, Subtask 2, ... Integration job Combines & verifies all Worker 1 Subtask 1 (isolated) Worker 2 Subtask 2 (isolated) Checker (optional) Or run by Lead agent
The requester interacts with one owner through the hub. The lead decomposes the request into bounded subtask jobs plus one upfront integration job, which the lead may run directly or delegate to an independent checker.
Requester
States the goal and acceptance criteria, then steps away. Receives one verified result rather than a stream of partial worker updates.
Hub
Durable coordination store that persists Party, Request, and Job records and rejects any state transition that violates ownership or integration invariants.
Lead agent
Owns decomposition, shared assumptions and interfaces between subtasks, running (or delegating) the integration job, assigning targeted repairs when pieces clash, and delivering the final result.
Workers (Worker 1, Worker 2, ...)
Execute one bounded subtask each against a narrow brief in isolation. Report completion with evidence back to the hub, never directly to the requester.
Checker (optional)
An independent agent or automated harness that the lead may assign the integration job to, so the party that produced the pieces is not the sole judge of whether they fit together.

Execution flow

Toggle between the normal flow — where finished subtasks fit together on the first integration pass — and the repair loop — where the hub blocks premature completion and forces a targeted fix before the requester is ever interrupted.

Requester Hub Lead agent Workers 1. Submit request 2. Assign lead agent as sole owner 3. Split into subtasks + integration job 4. Dispatch bounded subtasks in parallel 5. Report each subtask complete 6. All subtasks done; ready for integration 7. Run integration job Combine & verify all pieces together 8. Close integration job & report finished 9. Deliver one complete result

The lead declares the integration job at split time before dispatching workers. Once every subtask finishes and the integration job combines and verifies the whole output, the hub accepts completion and delivers one result to the requester.

Optional Checker: In either flow, the Lead agent may run the integration job directly (shown above) or delegate it to an independent Checker — the hub enforces the exact same completion gate either way.

Concrete examples

The pattern itself does not depend on code, repositories, or unit tests. Any multi-part request where isolated subtasks can succeed locally while contradicting or colliding across boundaries follows the exact same structure.

Example 1 — Cloud database research brief

No code or unit tests
Request
Compare two cloud databases in a one-page brief.
Split
Subtask 1 (pricing research → Worker 1), Subtask 2 (limits & performance research → Worker 2), and Integration job (combine and reconcile both sections into one brief → Lead agent).
Seam failure
Both workers write accurate sections on their own, but Worker 1 covered the Enterprise tier while Worker 2 covered the Free tier. Put together as-is, the brief contradicts itself on pricing, throughput, and limits.
Resolution
The integration job catches the tier mismatch before the requester ever sees the draft, dispatches a quick follow-up subtask to align both sections on the same tier, re-combines the brief, and delivers one coherent report.

Example 2 — Account settings timezone field

Simple API + UI
Request
Add a timezone selector to account settings.
Split
Subtask 1 (backend API endpoint → Worker 1), Subtask 2 (frontend settings form → Worker 2), and Integration job (save a timezone through the UI and read it back from the API → Lead agent or optional Checker).
Seam failure
Both pieces look clean in isolation, yet the API expects time_zone ("America/Los_Angeles") while the form sends timezone ("-08:00"). Wired together, saving silently drops the user's choice.
Resolution
The integration job catches the field name and format mismatch, keeps the request open, dispatches a targeted repair subtask to align the form with the API contract, re-runs the save-and-read check, and delivers one working feature.

What this pattern is NOT — Independent batch checks

Negative example
Request
Run the same lint check across 20 unrelated files, or fix a small copy typo in one document.
Why skip it
In the 20-file batch, every file is completely independent — there is no shared seam to reconcile, so plain parallel workers finish faster with less coordination tax. And for a small single-session edit, one focused agent finishes cleanly without splitting at all.

When to use and when to skip

Use Orchestrator-Workers when

  • The request spans two or more subsystems, research tracks, documents, or repositories with a shared seam or assumption boundary between them.
  • Specialists benefit from isolated context windows so neither worker gets drowned in the other's details.
  • The requester wants one accountable summary and proof that the combined output holds together.
  • Parallelism meaningfully cuts wall-clock time while a lead coordinates shared contracts.

Skip it when

  • One focused agent can complete and verify the entire request in a single context window without handoff overhead.
  • The subtasks are genuinely independent items with no shared assumptions, state, or integration boundary (file separate requests instead).
  • The work is an open-ended exploration spike where you do not yet know the right decomposition.
  • Coordination latency exceeds the time saved by running subtasks in parallel.

Data model and hub invariants

Orchestrator-Workers introduces two durable tables — parties and requests — and references jobs (defined in detail by Durable Job). Keeping integration_job_id as a nullable foreign key on requests allows single-subtask requests to stay lightweight while making multi-subtask integration structurally enforceable.

Party PK id kind display_name created_at Request PK id FK requester_id FK lead_id FK integration_job_id? status goal finished_at? Job PK id FK request_id FK assignee_id? role status evidence_ref? 1 n 1 n 1 1+ 1? 1 1? assignee_id (worker, lead agent, or optional checker) n
Request holds one requester, one lead, and an optional pointer to its integration Job. Cardinality markers follow the catalog convention (1, 1?, 1+, n).

Table: parties

Column Postgres type Nullability Notes
id uuid NOT NULL, PK Stable identifier referenced across all hub records.
kind text NOT NULL CHECK (kind IN ('human', 'agent', 'system')).
display_name text NOT NULL Human-readable name shown in status views and audit trails.
created_at timestamptz NOT NULL Defaults to now().

Table: requests

Column Postgres type Nullability Notes
id uuid NOT NULL, PK Unique request identifier.
requester_id uuid NOT NULL, FK References parties(id); human or upstream owner.
lead_id uuid NOT NULL, FK References parties(id); single accountable orchestrator.
integration_job_id uuid NULLABLE, FK References jobs(id); required once split into multiple subtasks.
status text NOT NULL CHECK (status IN ('open', 'finished', 'canceled')).
goal text NOT NULL Concise goal statement anchored to the requester's intent.
finished_at timestamptz NULLABLE Set atomically when status transitions to finished.

Six hub invariants

  1. 01
    Every request has exactly one lead Database constraint

    requests.lead_id is NOT NULL with a foreign key to parties(id), preventing unowned requests or diffuse multi-lead ambiguity.

  2. 02
    Integration job belongs to the same request Database constraint

    A composite foreign key (id, integration_job_id) referencing jobs(request_id, id) guarantees a lead cannot satisfy a request by pointing at a completed job from an unrelated request.

  3. 03
    Finished timestamp matches finished status Database constraint

    A CHECK constraint enforces (status = 'finished') = (finished_at IS NOT NULL) so derived boards and SLA metrics never see half-closed rows.

  4. 04
    Only the lead may split or close a request Hub guard

    Both split and report_finished check actor_id == request.lead_id. Workers finish their assigned subtasks but cannot prematurely declare the parent request done.

  5. 05
    Every job finish requires evidence from its assignee Hub guard

    finish_job verifies that the caller matches job.assignee_id and supplies a non-empty evidence reference (synthesized report, replay output, diff, or verification artifact — whatever proves the job's outcome) before marking the job passed.

  6. 06
    Multi-subtask completion requires completed subtasks and integration Hub guard

    When a request has more than one subtask job, report_finished rejects closure with integration_job_not_done unless the linked integration job is present and in state passed.

Reference implementation

The same minimal hub state machine in Lean, TypeScript, Python, and Elixir. Notice how little code is required once the invariants live in hub transitions instead of prompt wording.

-- Hub guards for Orchestrator-Workers (enforced in code, never in prompts)
import Std.Data.HashMap
open Std (HashMap)

inductive JobRole where
  | subtask | integration
  deriving Repr, BEq

inductive JobStatus where
  | pending | passed | failed
  deriving Repr, BEq

inductive RequestStatus where
  | «open» | finished  -- «» lets a keyword like `open` be used as a name
  deriving Repr, BEq

structure Request where
  id : String
  requesterId : String
  leadId : String
  status : RequestStatus := .open
  integrationJobId : Option String := none
  deriving Repr

structure Job where
  id : String
  requestId : String
  assigneeId : String
  role : JobRole
  status : JobStatus := .pending
  evidenceRef : Option String := none
  deriving Repr

inductive HubError where
  | unknownRequest | unknownJob
  | onlyLeadMaySplit | atLeastOneSubtaskRequired
  | onlyLeadMayAddRepairJob | requestNotOpen
  | onlyAssigneeMayFinishJob | evidenceRequired
  | onlyLeadMayReportFinished | subtaskJobsIncomplete | integrationJobNotDone
  deriving Repr, BEq

-- The hub is plain data; every guard returns a new hub or an error.
structure Hub where
  requests : HashMap String Request := {}
  jobs : HashMap String Job := {}

namespace Hub

def mustGetRequest (hub : Hub) (id : String) : Except HubError Request :=
  match hub.requests.get? id with
  | some req => pure req
  | none => throw .unknownRequest

-- `subtasks` and `integration` are (jobId, assigneeId) pairs.
def split (hub : Hub) (requestId actorId : String)
    (subtasks : List (String × String)) (integration : String × String) :
    Except HubError Hub := do
  let req ← hub.mustGetRequest requestId
  unless req.leadId == actorId do throw .onlyLeadMaySplit
  if subtasks.isEmpty then throw .atLeastOneSubtaskRequired

  let jobs := subtasks.foldl (init := hub.jobs) fun jobs (id, assigneeId) =>
    jobs.insert id { id, requestId, assigneeId, role := .subtask }
  let (intId, intAssignee) := integration
  let jobs := jobs.insert intId
    { id := intId, requestId, assigneeId := intAssignee, role := .integration }
  let req := { req with integrationJobId := some intId }
  pure { hub with requests := hub.requests.insert requestId req, jobs }

def addRepairJob (hub : Hub) (requestId actorId jobId assigneeId : String) :
    Except HubError Hub := do
  let req ← hub.mustGetRequest requestId
  unless req.leadId == actorId do throw .onlyLeadMayAddRepairJob
  unless req.status == .open do throw .requestNotOpen

  let jobs := hub.jobs.insert jobId { id := jobId, requestId, assigneeId, role := .subtask }
  -- A repair invalidates the integration check: it must run again.
  let jobs := match req.integrationJobId with
    | some intId => jobs.modify intId fun check =>
        { check with status := .pending, evidenceRef := none }
    | none => jobs
  pure { hub with jobs }

def finishJob (hub : Hub) (jobId actorId : String) (passed : Bool) (evidenceRef : String) :
    Except HubError Hub := do
  let some job := hub.jobs.get? jobId | throw .unknownJob
  unless job.assigneeId == actorId do throw .onlyAssigneeMayFinishJob
  if evidenceRef.trimAscii.isEmpty then throw .evidenceRequired

  let status := if passed then JobStatus.passed else .failed
  let job := { job with status, evidenceRef := some evidenceRef }
  pure { hub with jobs := hub.jobs.insert jobId job }

def reportFinished (hub : Hub) (requestId actorId : String) :
    Except HubError (Request × Hub) := do
  let req ← hub.mustGetRequest requestId
  unless req.leadId == actorId do throw .onlyLeadMayReportFinished

  -- `(·.requestId == requestId)` is shorthand for `fun j => j.requestId == requestId`.
  let allJobs := hub.jobs.values.filter (·.requestId == requestId)
  let subtaskJobs := allJobs.filter (·.role == .subtask)

  if subtaskJobs.any (·.status != .passed) then throw .subtaskJobsIncomplete
  if subtaskJobs.length > 1 then
    -- `>>=` chains the two lookups: no integration id, or no such job, gives `none`.
    match req.integrationJobId >>= hub.jobs.get? with
    | some check => unless check.status == .passed do throw .integrationJobNotDone
    | none => throw .integrationJobNotDone

  let req := { req with status := .finished }
  pure (req, { hub with requests := hub.requests.insert requestId req })

end Hub

-- Invariant: a lead can never finish a request that the hub doesn't know.
theorem reportFinished_unknown (id actor : String) :
    ({} : Hub).reportFinished id actor = throw .unknownRequest := by
  simp [Hub.reportFinished, Hub.mustGetRequest]; rfl

Failure and repair trace

Walking Example 2 (account settings timezone field) through these guards shows the exact moment the hub blocks premature completion with integration_job_not_done and forces the repair loop:

Execution trace: Example 2 (account settings timezone field)
1. hub.split(req_1, lead_1,
     subtasks: [job_settings_api -> worker_1, job_settings_ui -> worker_2],
     integration: job_combined_check -> checker_1)
   -> ok (subtasks created; request.integration_job_id = job_combined_check)

2. hub.finishJob(job_settings_api, worker_1, passed: true, evidence: "api.diff")
   hub.finishJob(job_settings_ui, worker_2, passed: true, evidence: "ui.diff")
   -> ok (both subtask jobs passed; job_combined_check still pending)

3. hub.reportFinished(req_1, lead_1)
   -> error: integration_job_not_done (job_combined_check is still "pending")

4. hub.finishJob(job_combined_check, checker_1, passed: false,
     evidence: "UI sends timezone=-08:00; API expects time_zone=America/Los_Angeles")
   -> recorded failure (req_1 stays open; requester is not interrupted)

5. hub.addRepairJob(req_1, lead_1, job_ui_align_field, worker_2)
   hub.finishJob(job_ui_align_field, worker_2, passed: true, evidence: "fix.diff")
   hub.finishJob(job_combined_check, checker_1, passed: true,
     evidence: "saved America/Los_Angeles in UI and read it back from API")
   -> ok (all subtasks and integration job passed)

6. hub.reportFinished(req_1, lead_1)
   -> ok (req_1 marked finished; one verified result delivered to requester)

Tradeoffs and practical guidance

Orchestrator-Workers trades a modest coordination tax for predictable whole-request quality. Before adopting it on a workflow, weigh three honest costs:

  • Lead bottleneck: every decomposition, shared assumption, and repair routes through one lead agent. Keep the lead's prompt and context lean so it orchestrates instead of doing heavy subtask execution itself.
  • Upfront specification effort: defining a concrete integration job at split time takes discipline. If the lead writes a vague check ("make sure everything looks fine"), the gate loses its teeth.
  • Extra token and latency budget: running subtask jobs plus an integration job costs more than a single-agent pass. Reserve it for work where seam risk is real.

Practical implementation notes

  • Define the integration criteria at split time: decide what proves the combined output holds together (such as aligned tier assumptions across a research brief, or saving a timezone in the UI and reading it back from the API) before workers start, while the full picture is still in the lead's head.
  • Use an independent checker for high-risk seams: assign the integration job to a fresh Checker party rather than reusing Worker 1 or Worker 2, avoiding shared blind spots.
  • Freeze shared assumptions and contracts upfront: when subtasks share a scope, definition, schema, or API boundary, put that contract in the split briefing (or sequence Subtask 2 after Subtask 1's checkpoint) instead of letting isolated workers guess.
  • Enforce in hub code, not prompts: telling a lead "always verify the combined result before finishing" fails under context pressure; rejecting report_finished with integration_job_not_done holds every time.
  • Bound recursion depth: cap delegation at two levels (lead to worker, or at most worker to read-only scout) so runaway fan-out cannot exhaust budgets or obscure accountability.

Known uses and related patterns

  • Anthropic Orchestrator-Workers & multi-agent research system: Anthropic's Building Effective Agents defines orchestrator-workers for tasks whose subtasks cannot be statically predicted, and their multi-agent research system uses a lead agent coordinating parallel search subagents before synthesizing one answer.
  • LangGraph Supervisor: models a central supervisor graph node routing state to specialized worker subgraphs and inspecting returned state before emitting a final response.
  • Claude Code subagents: delegates bounded exploration or implementation tasks to isolated subagent contexts while the primary session retains user communication and final verification.
  • Volgenic: coordinates multi-agent work with a lead agent dispatching isolated workers, backed by durable hub records and independent review checks before delivering a final result.
  • Contrast with Hohpe & Woolf's Scatter-Gather: classic enterprise messaging Scatter-Gather broadcasts one message to fixed recipients and aggregates replies mechanically. Orchestrator-Workers dynamically invents the decomposition, handles iterative repair when pieces clash, and gates completion on an explicit integration job.

Related patterns

  • Request Spec — defines the acceptance criteria the lead turns into subtask briefs and the integration job.
  • Durable Job — gives every subtask job and integration job attempts and checkpoints so worker crashes do not reset the request.
  • Context Handoff — packages the briefing each worker receives at start instead of forwarding raw lead transcripts.
  • Resource Lease — prevents parallel workers from editing overlapping files, branches, or shared resources concurrently.
  • Policy Gate & Evidence-Backed Completion — generalize the integration job into formal findings, claims, and transition gates.