← Table of Contents · Page 450 of 868
ORCHESTRATION PATTERNS
Part 2 of 11
THE SUPERVISOR PATTERN
The Supervisor pattern is a design in which one central coordinating agent receives the request, breaks it into smaller subtasks, delegates each subtask to a specialist agent, and then collects and combines their results into one final answer.
The central agent is called the supervisor, and the specialists it directs are often called workers or subagents.
Imagine a project manager at a construction company.
A customer says, "I want a new kitchen."
The project manager does not install the plumbing personally.
She breaks the job into parts: demolition, plumbing, electrical, cabinets, and painting.
She assigns each part to the right specialist, checks their work, and reports back to the customer with one finished kitchen.
The customer only ever talks to the project manager.
A Supervisor-pattern harness works the same way.
The user talks to the supervisor.
The supervisor decides what needs doing, calls the right workers, reads their results, and writes the final response.
The strengths of this pattern are clarity and control.
There is one place where decisions are made, one place to log what happened, and one place to apply rules like budgets and safety checks.
It is also easy to explain to others and to debug, because you can follow the supervisor's decisions step by step.
The weaknesses are that the supervisor can become a bottleneck, since everything flows through it, and that it is a single point of failure.
If the supervisor misunderstands the request or splits the work badly, the whole system suffers.
Also, the supervisor itself needs to be a strong, capable agent, and its context can grow large because it sees every result.
Supervisor designs are often the best starting point for beginners, because they are the closest cousin to the single-agent design you already know.
Advertisement
Read Aloud:
0:00 / 0:00