← Table of Contents · Page 454 of 868
ORCHESTRATION PATTERNS
Part 6 of 11
CHOOSING THE RIGHT PATTERN FOR A PROBLEM
Choosing a pattern is like choosing a vehicle.
You pick based on the trip.
Here are the questions to ask, in order.
First, are the steps strictly ordered, and are they the same every time?
If yes, a Pipeline is probably best.
It is the simplest and most predictable shape.
Second, does the task need a central point of control, for example because of budgets, approvals, or the need to synthesize multiple results into one answer?
If yes, a Supervisor is probably best.
Third, do the agents need to react to a shared body of changing information, with no way to predict which expert is needed next?
If yes, consider a Blackboard.
Fourth, is the workload highly dynamic, with many different kinds of requests, where routing decisions are best made locally by the agents who know their own strengths?
If yes, consider a Swarm.
A few more guidelines help.
Prefer the simplest pattern that works.
A pipeline is simpler than a supervisor, which is simpler than a blackboard or a swarm.
Patterns can be combined.
For example, a supervisor might delegate one of its subtasks to a small pipeline.
Finally, match the pattern to your need for observability.
If you must be able to explain every decision to an auditor, favor patterns with a central point of record, such as the Supervisor.
Here is a summary comparison in words.
The Supervisor is best for complex requests that need breaking down and synthesizing, and its main risk is the bottleneck.
The Pipeline is best for fixed, repeatable workflows, and its main risk is rigidity and passing errors along.
The Blackboard is best for collaborative problem solving with unpredictable contributions, and its main risk is unpredictability and conflicting edits.
The Swarm is best for dynamic routing among peers, and its main risk is loss of central control and circular routing.
Advertisement
Read Aloud:
0:00 / 0:00