← Table of Contents · Page 451 of 868

ORCHESTRATION PATTERNS

Part 3 of 11

THE PIPELINE PATTERN The Pipeline pattern is a design in which work flows through a fixed, linear chain of stages, where each stage transforms its input and passes the output directly and only to the next stage. Think of a car wash. The car goes through a soaping station, then a scrubbing station, then a rinsing station, then a drying station, always in that order. No station can skip ahead, and no station talks to a distant station. Each station does one thing to what it receives and hands it along. In a pipeline of agents, each stage might be an agent, or even just a plain program step, that does one transformation. For example, a document-processing system might extract text from a file, then translate it, then summarize it, then format the summary for email. The output of "extract text" feeds directly into "translate," and so on, in a fixed order. The strengths of a pipeline are predictability and simplicity. You know exactly what runs and in what order, which makes it easy to test each stage separately. You can measure how long each stage takes and replace one stage without touching the others. The weaknesses are rigidity and error propagation. If an early stage makes a mistake, every later stage inherits it, much like a smudge on the first page of a printed stack soaking through to the rest. Also, a pipeline cannot easily adapt when a situation needs a different order, a loop back, or a skipped step. Pipelines are a great fit when the workflow is truly the same every time.
Advertisement
Read Aloud:
0:00 / 0:00