Orchestrator-workers: one agent splits the goal, each worker takes a piece
An orchestrator reads the objective, breaks it into tasks, and sends each one to a specialist agent with its own tools. This pattern fits any workflow where no single agent should hold every tool or every step.
Read the orchestration guidesHow the orchestrator assigns tasks to workers
An orchestrator agent takes one goal and has to turn it into a set of tasks before any worker starts anything. It works out how many tasks the goal needs, what each task depends on, and which worker is placed to run it. That decomposition happens once, at the start.
Matching a task to a worker
Each worker carries a fixed tool list as part of its role assignment. The orchestrator checks a task against that list: a task needing a web search goes to the worker holding the search tool, a task needing a write to a database goes to the worker holding that access. Where more than one worker could technically handle a task, the orchestrator favours the worker scoped most narrowly to that kind of work, so a task doesn't end up with a generalist when a specialist is already defined for it.
Setting the handoff and the trigger condition
Every task the orchestrator creates carries a trigger condition, the state that has to be true before that task starts. A validation task might wait until an extraction task has returned output in the expected format. Setting this at the point the task is created is what fixes the handoff order.
This is a different problem from a loop that checks and revises its own output, which is what an evaluator-optimiser arrangement is for. An orchestrator is deciding where work goes first; it isn't judging whether the work that came back is good enough.
Where you change the assignment
Drawing the orchestrator's task list and worker assignments as a role map lets you see the decomposition before any of it runs. From there you can move a task to a different worker, tighten a trigger condition, or split a task the orchestrator grouped too broadly.
Worked example: a 1,500-row batch with a bounded retry between transformation and validation
This example is invented to show the pattern. Its objective reads: "extract records from incoming CSV files, transform the fields to match the target schema, and validate rows before loading, retrying failed transformations once before logging them as rejected." The input folder holds three CSV files, 500 rows each, 1,500 rows total. The orchestrator creates three workers and adds one rule to the transformation agent's handoff: a failed batch can return to it exactly once.
Role assignment
| Worker | Tools | Trigger condition | Hands off to |
|---|---|---|---|
| Extraction agent | file reader, CSV parser | new file detected in input folder | Transformation agent |
| Transformation agent | field mapper, type converter | extraction task marked complete, or one retry batch returned | Validation agent |
| Validation agent | schema checker, error logger | transformed batch received | Orchestrator |
Running the batch
- The extraction agent parses all three files: 500 + 500 + 500 = 1,500 records.
- The transformation agent converts all 1,500 on its first pass. 1,440 convert cleanly; 60 fail — a date field in the wrong format — and are held.
- Those 60 go back to the transformation agent for its one allowed retry. 38 convert successfully the second time; 22 still fail and are passed to validation marked as permanent failures, since a second retry is not allowed.
- The validation agent receives 1,440 + 38 = 1,478 converted records plus the 22 marked failures. It logs the 22 immediately with the error logger and checks the remaining 1,478 against the schema with the schema checker. Thirty-three fail — a required field left blank — and are logged. 1,478 − 33 = 1,445 pass.
- The validation agent returns 1,445 passed rows and a rejection log of 55 rows (22 permanent conversion failures, 33 schema failures) to the orchestrator, which closes the task.
1,445 of the 1,500 input rows load into the target database: 1,445 + 55 = 1,500. The retry cap fires once, on the 60 records that failed conversion, and does not fire again on the 22 that still failed afterward — they move straight to the rejection log. The orchestrator's record of the run shows which rows passed on the first transformation attempt, which passed on the retry, and which never passed at all.
What happens when a worker exceeds its turn limit
A worker agent assigned to validate a batch of records can run past its turn limit before it finishes, especially once the data turns out messier than expected. An orchestrator with no plan for this either stalls the pipeline or passes an incomplete result downstream as though it were final.
What the orchestrator does with an unfinished worker
When a worker hits its turn limit, the orchestrator treats this as a distinct outcome. It can send the worker's partial output to another worker for completion, restart the task with a narrower scope, or stop the pipeline and flag the task for the person running it. Which of these fits depends on the task itself: a validation pass that is half done might still be worth keeping, where a half-finished data transform usually is not.
Mapping the failure path
Give each worker role a trigger condition for its normal handoff and a separate one for running past the turn limit. Each one points at a different target. You decide what that failure target is: the same role again, a different worker, or the orchestrator itself. On a diagram of the plan, the failure path is a second arrow out of the role, next to the success path.
Setting the turn limit
The turn limit is a value you set per worker role. Set it too low and workers get cut off on tasks that would have finished; set it too high and a worker stuck repeating itself burns turns before anyone notices.