Agent Design Patterns

Five Workflow Patterns

Five proven Workflow orchestration patterns — from simple to complex, each solving a specific type of problem. The goal is not the most complex pattern, but the most appropriate one.

Pattern 1
1
Prompt Chaining
Prompt Chain
Break a large task into multiple sequential steps, where each step's output becomes the next step's input. Each step is an independent LLM call focused on doing one thing well. Quality gates (programmatic checks) can be inserted between steps — only passing results move forward.
Input
LLM Step 1
Gate
LLM Step 2
Output
When to Use
The task naturally decomposes into fixed sequential steps; quality checks are needed at intermediate stages; accuracy is worth the added latency.
Real example: Generate marketing copy (Step 1) → Translate to target language (Step 2) → Format for specific platform (Step 3). Gate: verify Step 1 output contains required brand keywords.
Pattern 2
2
Routing
Router
First classify the input, then route it to a specialized processing branch. Each branch can have its own Prompt, model, or tool configuration. Core value: separation of concerns — each branch handles only one type of input.
Input
Classifier
Branch A
Branch B
Branch C
When to Use
Inputs vary widely and require entirely different processing logic by type; cost optimization is needed (cheap models for simple queries, powerful models for complex ones).
Real example: Customer service system: simple FAQs use Haiku (fast and cheap), refund issues use Sonnet + order tools, technical faults use Sonnet + log queries. One classifier picks the route, achieving the optimal cost/quality balance.
Pattern 3
3
Parallelization
Parallelism
Run multiple LLM calls simultaneously and aggregate results. Two sub-modes:
Sectioning: Split a task into independent subtasks, process in parallel, then merge.
Voting: Run the same task with the same Prompt multiple times, take the majority/best result.
Input
LLM A
LLM B
LLM C
Aggregate
Output
When to Use
Subtasks have no dependencies; speed improvement is needed (parallel beats sequential); confidence needs boosting (repeated voting reduces randomness).
Real example – Sectioning: In code review, one LLM checks security vulnerabilities, one checks performance, one checks style; results are merged.
Real example – Voting: In content moderation, the same text is sent to 3 LLMs to judge whether it violates policy; the majority vote is the final decision.
Pattern 4
4
Orchestrator-Workers
Orchestrator–Workers
A central LLM (the orchestrator) dynamically decomposes tasks and assigns them to multiple worker LLMs. Unlike Parallelization, subtasks are determined at runtime by the orchestrator — nothing is predefined in code. This is the Workflow pattern closest to an Agent.
Input
Orchestrator LLM
Worker 1
Worker 2
Worker N...
Merge
When to Use
Subtasks cannot be predicted in advance (must be decided dynamically based on input); involves parallel operations on multiple files or resources.
Real example: Code change request "add i18n support to the project." The orchestrator analyzes the codebase and dynamically decides: Worker 1 updates Button component, Worker 2 updates Header, Worker 3 creates language files. Different requests produce different numbers and types of Workers.
Pattern 5
5
Evaluator-Optimizer
Evaluator–Optimizer
One LLM is responsible for generating, another for evaluating. They form an iterative loop: the generator refines its output based on the evaluator's feedback until the evaluator is satisfied or the iteration limit is reached.
Input
Generator LLM
Evaluator LLM
Output
Dashed box = iterative loop until criteria are met
When to Use
Clear quality evaluation criteria exist; iterative improvement significantly raises output quality; a single generation rarely meets the bar.
Real example: Literary translation: the generator produces an initial draft; the evaluator checks faithfulness, fluency, and style consistency, giving specific revision notes; the generator improves. After 2–3 iterations, the final translation is output. Quality improves with every iteration.
Try It: Scheduler Simulator
Click the buttons above to see data-flow animations for each pattern
Summary
All Five Patterns at a Glance
Pattern Core Idea Typical Use Case Complexity
Prompt Chaining Sequential chaining, step by step Copywriting pipeline Low
Routing Classification-based routing, specialized handling Intelligent customer service routing Low
Parallelization Parallel processing, aggregated results Multi-dimensional code review Medium
Orchestrator-Workers Dynamic decomposition, distributed execution Cross-file code modifications Medium-High
Evaluator-Optimizer Generate-evaluate, iterative refinement High-quality translation Medium
"Start with simple prompts, optimize them with comprehensive evaluation, and add multi-step agentic systems only when simpler solutions fall short."
Don't chase the most complex pattern — chase the most appropriate one. Start with the simplest Prompt Chaining, and only upgrade to a more complex pattern when you've confirmed the simpler approach isn't enough. For every layer of complexity you add, ask yourself: is the benefit worth the added latency, cost, and debugging overhead?