PIXELBANKv8.2.1
Menu
Back to Agent Engineering Study Plan
Week 7-8

Chapter 7: Workflow Patterns & LangGraph Stateful Graphs

Anthropic's canonical workflow taxonomy — chaining, routing, parallelization, orchestrator-worker — and LangGraph's stateful-graph runtime that operationalizes them at scale, complete with checkpointing, human-in-the-loop, and resumable execution.

Chapter Overview

Most production LLM systems are workflows, not agents. Anthropic's Building Effective Agents essay (Dec 2024) catalogued the four patterns nearly all LLM apps reduce to. LangGraph (LangChain Inc., 2024) is the leading runtime for these patterns — a stateful graph engine with first-class support for checkpointing, conditional edges, and human-in-the-loop pauses.

This chapter is split: half is taxonomy (which workflow when), half is the practical runtime (how LangGraph implements them).

This chapter covers:

  • Anthropic workflow patterns — the canonical taxonomy
  • Prompt chaining — sequential decomposition with explicit gates
  • Routing & parallelization — fan-out/fan-in patterns
  • Orchestrator-worker — planner emits a fixed-shape plan; workers execute
  • LangGraph stateful graphs — typed state, conditional edges, the runtime
  • Checkpointing & resuming — durable execution and human-in-the-loop pauses

Chapter Roadmap

Click any topic to jump in

1
The 4 Patterns

Anthropic's taxonomy: chaining, routing, parallelization, orchestrator-worker.

The Four PatternsWorkflows vs Agents — the Anthropic Heuristic
Three of the four patterns expand here

From the taxonomy to the implementations

2
Prompt Chaining

Sequential decomposition with programmatic gates between steps.

When Chaining Wins Over a Single CallGates Between Steps
3
Routing & Parallel

One classifier picks the path, or many handlers run concurrently.

Routing — One LLM Picks the PathParallelization — Sectioning vs Voting
Two ways to express larger compositions
4
Orchestrator-Worker

Planner emits a fixed-shape plan; stateless workers execute in parallel.

When Orchestrator-Worker Pays OffOrchestrator-Worker vs Multi-Agent
5
LangGraph

The runtime: typed state, conditional edges, durable execution.

The Graph Mental ModelWhy a Graph Beats Hand-Rolled Chains
What ties everything together for production
6
Checkpoints & HITL

Durable execution and human-in-the-loop pauses for sensitive operations.

What to CheckpointHuman-in-the-Loop via Interrupts

The Anthropic Building Effective Agents essay introduced a 4-pattern taxonomy that has become the lingua franca for designing LLM systems. The contribution wasn't novel patterns; it was the insistence that 90% of teams reach for an agent loop when a workflow would do.

In this topic

1The Four Patterns
2Workflows vs Agents — the Anthropic Heuristic
1 of 2
The Four Patterns

1. Prompt chaining. Decompose a task into a sequence of LLM calls, each operating on the previous one's output. Optionally insert programmatic gates between steps (e.g., a regex check, a length validator). Use when the steps are crisp and benefit from being decomposed.

2. Routing. One LLM classifies the input and dispatches to one of several specialized handlers. Use when the input space splits into qualitatively different cases that need different prompts.

3. Parallelization. Run multiple LLM calls concurrently — either sectioning (split a task into independent subtasks) or voting (run the same task multiple times, take majority/best). Use when the work decomposes cleanly or you need an aggregated answer.

4. Orchestrator-worker. A planner LLM emits a fixed-shape plan (often a list of subtasks); worker LLMs execute each subtask, often in parallel; an aggregator combines. Use when the plan structure is known but each subtask requires reasoning.

A fifth pattern, evaluator-optimizer, runs a generator → evaluator loop and is essentially Self-Refine in workflow clothing.

2 of 2
Workflows vs Agents — the Anthropic Heuristic

Anthropic's heuristic is blunt: 'Find the simplest solution that works, and only increase complexity when needed.'

Decision tree:

  • Can a single LLM call do it? → single call.
  • Are the steps fixed and known? → workflow (one of the four patterns).
  • Are the steps unbounded and the model needs to choose them dynamically? → agent.

The traffic per layer is also different: high-volume traffic should land on workflows; agent loops are for the long tail. Most production systems are a single agent on top of many workflows.

Example:

A team has built a customer-support assistant as a single ReAct agent with 8 tools. P99 latency is 12 seconds, success rate is 78%. They want to fix it. Apply Anthropic's heuristic.