Some workloads refuse to be planned in advance. You cannot know whether a request needs three subtasks or thirty until you are inside it.

That is what the orchestrator-worker pattern is for. The orchestrator reads the request, invents the subtasks at runtime, and dispatches each to whichever qualified worker is free. The same architecture handles ten documents today and three hundred tomorrow.

Dispatching is the easy half

The engineering lives in the bookkeeping, and this is where implementations quietly fail:

  • Orphaned tasks. A worker dies mid-task and nothing notices. Every dispatched task needs an owner of record and a lease (a timeout the worker renews with a heartbeat), or work simply evaporates and the orchestrator waits forever for a result that is never coming.
  • Duplicate execution. Retries, and leases that expire on workers that were merely slow, make execution at-least-once. At-least-once plus non-idempotent tasks equals the email sent twice, the refund issued twice. Design tasks to be safely re-runnable, with an idempotency key on every side-effecting call, before you scale the fan-out.
  • Reconciliation. Results arrive out of order, partially failed, occasionally contradicting each other. Integrating that into one coherent outcome is the orchestrator's actual job, and it is where the real engineering time goes.
  • Spec drift. Dynamically generated task descriptions degrade under unusual inputs in ways static pipelines never do. Sample them and read them periodically. A task spec that made sense for the last thousand requests can be nonsense for the next one.

Make routing explainable

The failure that hurts most in production is the unexplainable dispatch. Nobody can say why worker C was chosen, so nobody can fix it when C was the wrong choice.

Log the routing decision and the signal behind it alongside the outcome. "Routed to the SQL worker because the query mentioned an order ID" is debuggable. "Routed to the SQL worker" is a black box that will cost you an afternoon every time it misroutes.

Choose it deliberately

As a rule of thumb, if you can enumerate the stages on a whiteboard, build a pipeline. Static structure is easier to trace, cheaper to run, and far easier to reason about.

Reach for dynamic dispatch when the work genuinely refuses enumeration, as with variable-size batches, unpredictable subtask types, or load that fluctuates enough that fixed workers are either idle or overwhelmed.

Kill a worker on purpose

Runtime dispatch arrives bundled with distributed-systems problems a fixed pipeline does not have, so test for them directly. In staging, kill one worker mid-task and stall another past its lease, then check whether both tasks finished and whether any side effect fired twice. An unfinished task is an orphan; a refund issued twice means your retries are not idempotent.

Terms in this piece

About this explainer

Format
Explainer
Level
Practitioner
Read
2 min read
Published
Jul 5, 2026

Short mental models: one idea, why it matters, what to do about it.

Deep dive · · 7 min read

Most agent controls do not actually control anything

Six days of notes on supervising autonomous systems, and the same failure shape kept turning up: the control exists, it is documented, and nothing in the running system is bound by it.