Orchestrator-Worker
In this article
- Explain when a model should split a request into subtasks at run time instead of following a fixed list.
- Check a proposed subtask list in code for its size and for duplicate work before any worker runs.
- Decide which fields and tools each worker call receives, and which it must not see.
- Spot a malformed worker result and stop the merge before a reply is written.
- Terms defined here: orchestrator-worker, subtask.
Overview
A customer writes one message with two problems in it. Another writes one with a single problem, and a third writes something vague that could hide four. You cannot know how many pieces of work a message holds until something reads it, so a list of steps written in code ahead of time does not fit.
The fix is to let a model read the request and propose the pieces, then let code decide whether that proposal is safe to run. The example is made up: Brightline, a home-internet provider, runs a support assistant on its website that can look up an order, issue a refund of at most $50 within 14 days of the order and hand a conversation to a person. By the end you can design that split: a list of jobs proposed at run time and checked in code, one model call per job that sees only what it needs, and a final step that refuses to combine broken results.
Sign in to keep reading
The rest of this article opens with an account. An account also keeps your progress and quiz results on every device, and lets you follow news for up to five topics.
Still to read in this article
- When the list is unknown ahead
- What the orchestrator writes
- Checking the list before any worker runs
- What each worker sees
- A result schema and a merge that fails closed
- The whole shape
- Common mistakes
- In production
- Sources
- Check yourself, 13 questions