Phase 10 · Agentic AI/
Lesson 10.5core2 h 30 min

Agentic workflow patterns

Chaining, routing, parallelization, orchestrator–workers, evaluator–optimizer

Most successful "agents" in production are compositions of five workflow patterns that keep control flow in your code and use the model for judgment. Knowing the patterns lets you reach for the simplest structure that solves a problem, estimate its cost, and name its failure modes before you build it. They are also the vocabulary you will use to read framework documentation (9.10 Frameworks and SDKs) and multi-agent designs (10.6 Multi-agent systems).

You'll be able to

  • Implement prompt chaining, routing, parallelization, orchestrator–workers and evaluator–optimizer in plain Python
  • Choose a pattern from task structure (fixed vs dynamic decomposition, independence, verifiability) and estimate its cost multiplier
  • Name each pattern's characteristic failure mode and the guardrail that addresses it
  • Compose patterns and apply the 'start simple, add complexity only when measured' rule

Key ideas

  1. Every pattern is wiring between augmented-LLM calls; the difference is who owns control flow and whether decomposition is known in advance.
  2. Prompt chaining: fixed sequence with programmatic gates — accurate per step, but errors propagate.
  3. Routing: classify then dispatch to specialized prompts/models — enables cost tiering; guard against misrouting with a default route and measured accuracy.
Show 4 more key ideas
  1. Parallelization: sectioning (independent subtasks) or voting (confidence) — N× tokens at 1× latency; needs a reconciliation step.
  2. Orchestrator–workers: a model decomposes dynamically and delegates; expensive (10–15×) and sensitive to vague task specs.
  3. Evaluator–optimizer: generate/evaluate loops pay off only with clear criteria, ideally deterministic checkers; cap rounds.
  4. Start with one prompt plus retrieval; add a pattern only when an eval shows the simpler system fails.

Suggested path through this lesson