Agentic Workflow Patterns

A visual guide to the five core patterns for building intelligent AI systems

Pattern 1

Prompt Chaining

Breaking complex tasks into sequential, dependent steps where each step's output feeds the next

Input Task
β†’
Step 1
Agent A
β†’
Step 2
Agent B
β†’
Step 3
Agent C
β†’
Final Output

How It Works

  • Decompose: Break complex task into smaller, manageable subtasks
  • Chain: Each step involves an LLM call with a focused prompt
  • Connect: Output of one step becomes input to the next
  • Validate: Check quality at intermediate points to prevent error propagation

Key Benefits

Enhanced Reasoning: Each step can focus deeply on a specific subtask without being overwhelmed by the full complexity.

Reduced Hallucinations: Focused attention on smaller problems leads to more accurate outputs.

Better Debuggability: Isolated steps make it easier to identify and fix issues.

⚠️ Critical Challenge: Error Propagation

Errors in early steps compound through the chain. Solution: Implement validation checkpoints between steps using programmatic checks, LLM-based evaluation, or rule-based validation.

When to Use

  • Task requires multiple sequential, dependent steps
  • Each step needs focused attention on a specific aspect
  • Complex problem can be decomposed linearly
  • Quality validation at each step is important
Real-World Example
Research Report Generation:
  1. Step 1: Extract key topics from source documents
  2. Step 2: Generate outline based on topics
  3. Step 3: Write detailed sections using outline
  4. Step 4: Create executive summary from sections
  5. Step 5: Format and polish final report
Pattern 2

Routing

Intelligently directing tasks to the most appropriate specialized agent based on classification

Incoming Task
↓
Router Agent
(Classifier)
↓
Agent A
(Type 1)
Agent B
(Type 2)
Agent C
(Type 3)

How It Works

Stage 1 - Classification: Router agent analyzes the incoming task to determine its type, category, intent, or complexity level.

Stage 2 - Dispatch: Based on classification, the task is directed to the specialized agent best suited to handle it.

Classification Methods

Rule-Based: Use keyword matching, regex patterns, or conditional logic for deterministic routing.

LLM-Based: Let an LLM understand context and categorize based on semantic meaning for more nuanced classification.

βœ… Key Benefits
  • Task Specialization: Each agent optimized for specific request types
  • Resource Optimization: Route simple tasks to fast/cheap models, complex to powerful ones
  • Scalability: Easily add new specialized agents without changing core logic

When to Use

  • Handling diverse types of requests that need different handling
  • Different tasks require specialized agents or approaches
  • Resource optimization is important (cost/speed tradeoffs)
  • System needs to scale with new capabilities over time
Real-World Example
Customer Support System: Router classifies incoming messages and directs to specialized teams:
  • Billing Agent: Handles payment, invoices, refunds
  • Technical Agent: Solves product bugs, integration issues
  • Sales Agent: Answers feature questions, upgrades
  • Escalation Agent: Routes complex/angry customers to humans
Pattern 3

Parallelization

Multiple agents working simultaneously on independent subtasks, then consolidating results

Input Task
↓
Scatter
↓
Agent 1
Subtask A
Agent 2
Subtask B
Agent 3
Subtask C
↓
Gather & Synthesize
↓
Final Output

How It Works

  • Scatter: Distribute workload to multiple agents that work concurrently
  • Process: Agents execute their independent subtasks simultaneously
  • Gather: Collect all results when agents complete their work
  • Synthesize: Consolidate outputs into coherent final result

Synthesis Methods

Consolidation: Merge all outputs into a unified document (e.g., combining research from different sources).

Voting: Agents "vote" on the best answer, with majority or consensus determining output.

Debate: Agents present different perspectives, then a final agent synthesizes the discussion.

βœ… Key Benefits
  • Speed: Dramatic reduction in total processing time
  • Multiple Perspectives: Different agents bring diverse approaches
  • Reliability: Consensus reduces individual agent errors

When to Use

  • Subtasks are independent and don't rely on each other
  • Speed improvement is valuable (latency reduction)
  • Multiple perspectives enhance quality or creativity
  • Consensus or voting improves reliability
Real-World Example
Market Research Report:
  • Agent 1: Analyzes competitor pricing strategies
  • Agent 2: Summarizes customer reviews and sentiment
  • Agent 3: Identifies industry trends and forecasts
  • Synthesis Agent: Combines findings into comprehensive report with cross-referenced insights
Pattern 4

Evaluator-Optimizer

Iterative refinement through evaluate-critique-improve loops until quality standards are met

Input Task
↓
Generator Agent
Creates Output
↓
Evaluator Agent
Assesses Quality
↓
Quality Check
βœ“ Pass
Final Output
βœ— Fail
Refine & Retry ↑

How It Works

  • Generate: Generator agent creates initial output
  • Evaluate: Evaluator agent assesses quality against criteria
  • Decide: Check if output meets standards
  • Refine: If not, provide feedback and regenerate
  • Loop: Repeat until quality threshold met or max iterations reached

Evaluation Criteria Types

Task-Specific: Accuracy, completeness, relevance to requirements

Quality Attributes: Clarity, grammar, tone, formatting

Constraints: Length limits, keyword inclusion, structural requirements

⚠️ Critical: Define Stopping Conditions

Always set maximum iterations (e.g., 3-5 attempts) to prevent infinite loops. Balance quality improvement against computational cost.

When to Use

  • High-quality output is critical and worth iteration
  • Complex requirements must be satisfied
  • Iterative refinement demonstrably adds value
  • Self-correction capability improves reliability
Real-World Example
Blog Post Creation:
  1. Generator: Creates draft blog post on specified topic
  2. Evaluator: Checks for: SEO keywords, readability score, structure, tone consistency, factual accuracy
  3. Feedback Loop: "Missing keyword 'automation' in first 100 words. Intro lacks hook. Technical jargon too dense for target audience."
  4. Refinement: Generator revises based on specific critiques
  5. Iteration: Process repeats until all quality criteria satisfied
Pattern 5

Orchestrator-Workers

Central planning agent dynamically coordinates specialized worker agents to solve complex, unpredictable problems

Complex Task
↓
Orchestrator Agent
(Planning & Coordination)
↓
Dynamic Task Assignment
Worker A
Worker B
Worker C
Worker D
Results & Feedback ↑↓
Orchestrator
Adapts Plan
↓
Final Solution

How It Works

  • Analyze: Orchestrator assesses the complex problem
  • Plan: Creates strategy and breaks down into subtasks
  • Delegate: Assigns subtasks to appropriate specialist workers
  • Monitor: Tracks progress and worker outputs
  • Adapt: Adjusts plan based on results and new information
  • Iterate: Continues until problem is solved or goals achieved

Key Characteristics

Dynamic Planning: Unlike fixed workflows, the orchestrator can change its approach mid-execution based on intermediate results.

Adaptive Coordination: The orchestrator decides which workers to use, when, and in what orderβ€”adapting to the problem's evolving state.

Maximum Autonomy: This is the most "agentic" pattern, with the orchestrator making high-level strategic decisions independently.

βœ… Maximum Flexibility

This pattern handles problems where you don't know the solution path in advance. The orchestrator figures it out dynamically, making it ideal for open-ended, exploratory, or highly variable tasks.

When to Use

  • Task is complex and solution path isn't known in advance
  • Problem requires dynamic planning and adaptation
  • Multiple specialized capabilities needed in unpredictable order
  • Maximum flexibility and autonomous decision-making required
Real-World Example
Business Strategy Consultant:
  • Orchestrator: Senior consultant agent analyzes "Help us enter Asian markets"
  • Initial Plan: Research β†’ Analysis β†’ Recommendations
  • Worker 1 (Research): Gathers market data for Asian regions
  • Orchestrator Adapts: Sees high regulatory complexity in China, assigns Worker 2 (Legal) to investigate
  • Worker 3 (Financial): Analyzes investment requirements based on legal findings
  • Orchestrator Pivots: Regulatory burden too high, shifts focus to Southeast Asia
  • Worker 4 (Competitive): Analyzes competitors in Thailand, Vietnam, Singapore
  • Final Synthesis: Orchestrator compiles strategic recommendation with adaptive insights
↑