Skip to content

Summary: Six effective-agent patterns

The canonical shapes the L8 loop takes for common jobs. Five workflows plus one agent, from the Anthropic engineering post Building Effective AI Agents (Erik S. + Barry Zhang, 2024-12-19), in order of increasing model autonomy. (1) Prompt chaining (verbatim): decomposes a task into a sequence of steps, where each LLM call processes the output of the previous one. Trade-off (verbatim): trade off latency for higher accuracy. Use when subtasks are knowable; add programmatic gates between steps. (2) Routing (verbatim): classifies an input and directs it to a specialized followup task. Benefit: separation of concerns + specialized prompts. Cost-optimization angle: route easy queries to Haiku 4.5 and hard ones to Sonnet 4.5 (lesson 3’s effort dial applied here). (3) Parallelization (verbatim): LLMs can sometimes work simultaneously on a task and have their outputs aggregated programmatically. Two sub-types: sectioning (independent subtasks run in parallel) and voting (same task run N times, results aggregated). Principle (verbatim): for complex tasks with multiple considerations, LLMs generally perform better when each consideration is handled by a separate LLM call. (4) Orchestrator-workers (verbatim): a central LLM dynamically breaks down tasks, delegates them to worker LLMs, and synthesizes their results. Key distinction from parallelization (verbatim): subtasks aren’t pre-defined, but determined by the orchestrator based on the specific input. (5) Evaluator-optimizer (verbatim): one LLM call generates a response while another provides evaluation and feedback in a loop. Two success indicators to check first: feedback measurably improves output AND the LLM can give useful feedback. Cap at three to four rounds. (6) Autonomous agent (verbatim): agents begin their work with either a command from, or interactive discussion with, the human user. Once the task is clear, agents plan and operate independently. Use for open-ended problems where steps cannot be hardcoded; sandboxed testing + guardrails + thoughtfully-designed tools are non-negotiable. Cross-pattern principle (the post’s summary thesis, verbatim): Success in the LLM space isn’t about building the most sophisticated system. It’s about building the right system for your needs. Four-question decision tree: steps knowable? → chaining. Distinct categories? → routing. Splits into pieces? → parallelization. Subtasks shape-dependent on input? → orchestrator-workers. Iterative refinement helps and feedback works? → evaluator-optimizer. None of the above? → autonomous agent. Most production stacks compose 2-3 patterns. L10 (next) adds Agent Skills + Claude Code; L11 adds Subagents + Managed Agents; L12 ships the result.

  • The taxonomy: five workflow patterns (1-5) plus the autonomous agent (6). Workflows = your code drives the path; agent = the model drives the path.
  • (1) Prompt chaining: decompose into a fixed sequence; trade latency for accuracy; programmatic gates between steps. Use when subtasks are knowable in advance.
  • (2) Routing: classify and dispatch to a specialized followup. Benefit: separation of concerns + specialized prompts. Cost-optimization angle: send easy queries to a smaller model (Haiku 4.5), hard ones to Sonnet 4.5. The cleanest place to apply lesson 3’s effort-and-model dial.
  • (3) Parallelization (two sub-types): sectioning for independent subtasks (different slice per subtask); voting for diverse outputs on the same task (same prompt N times, aggregate). Principle: one model on one consideration beats one model on ten. Cache the shared prefix so fan-out does not re-pay it N times.
  • (4) Orchestrator-workers: central LLM picks subtasks at runtime. Key distinction from parallelization: subtasks are not pre-defined; the orchestrator decides per input. Use when subtask shape depends on the input.
  • (5) Evaluator-optimizer: generate-and-critique loop. Two success indicators to check: feedback measurably improves output AND the LLM can give the feedback. Cap at three to four rounds; subjective criteria can oscillate.
  • (6) Autonomous agent: the L8 loop scaled up. tool_choice set to auto throughout; larger tool inventory; higher max_iterations cap (50 to 200); tool result clearing enabled; sandboxed dangerous tools; clear environmental feedback per step. Costs more; sandbox + guardrails + careful toolset documentation are required.
  • Cross-pattern principle: Success in the LLM space isn’t about building the most sophisticated system. It’s about building the right system for your needs.
  • Three implications: start simpler (single call > workflow > agent in cost and reliability); make ground truth available (every step has clear environmental feedback); cap and observe (max_iterations and usage telemetry).
  • Composition: most production stacks combine patterns. Route into chains; chain into orchestrated workers; vote at the end. No single pattern covers a whole product.
  • Where this fits: L8 substrate + this catalog. L10 (next) adds Agent Skills + Claude Code; L11 adds Subagents + Claude Managed Agents (how patterns 4 and 6 spawn focused inner loops); L12 ships.

Before this lesson, the temptation when reaching for an agentic feature is to build a full autonomous loop. After this lesson, the four-question decision tree pushes you toward the simpler pattern that fits the task’s actual shape. The single highest-leverage move this week: take whatever multi-step thing your application is doing today and run it through the decision tree; you will almost certainly find that one of patterns 1-3 covers it cleaner and cheaper than a full agent. The second-highest: routing is the most underused pattern in early production stacks; sending easy queries to Haiku 4.5 and reserving Sonnet 4.5 (or Opus) for the hard branch is often a 5-10x cost reduction with no quality loss on the easy side. The third-highest: when you do graduate to orchestrator-workers or the autonomous agent, the disciplines from lesson 8 (hard max_iterations cap, tool inventory as the surface area, L7 cost-and-staleness levers stay engaged, explicit stop_reason dispatch) carry over unchanged; the patterns add structure, not new failure modes. Lesson 10 next adds Agent Skills (durable instructions the loop can lean on per pattern) and Claude Code (a worked agent reading them).