Design Patterns
Master the core design patterns that power production AI agents — from ReAct loops to multi-agent orchestration architectures.
Shipping Your First Pattern
Before any theory, run one pattern end-to-end. Five minutes from clone to first output — it's what makes every concept below land in muscle memory.
cd content/learn/v1/starters/agent-loop
npm install && cp .env.example .env
# add your ANTHROPIC_API_KEY to .env
npm run dev -- "List the three largest TypeScript files under src/ and explain why they're large."You'll see assistant messages, tool_use_summary actions, then a final
result. That alternation — reason → act → observe → adapt — is the ReAct
pattern, the simplest of the five we'll cover and the default for most real workflows.
Every other pattern is a deviation from ReAct
Reflection adds a critique loop. Plan-Execute adds a planning stage. Multi-Agent splits the thinker into specialists. Task Systems persist the plan to disk. As you read each pattern below, ask: what does this add to ReAct, and what does that addition cost? That's the design lens agent engineers actually use.
Pattern Decision Tree
Single answer fits in one tool call? ──YES──→ ReAct (default)
│
NO
│
Need a plan reviewed before any writes? ──YES──→ Plan-Execute
│
NO
│
Output quality improves with self-review? ──YES──→ Reflection
│
NO
│
Multiple specialists with different tool sets? ──YES──→ Multi-Agent
│
NO
│
Long-running work, must survive compaction? ──YES──→ Task SystemsPick by where you want extra control or specialization, not by what's most impressive on a slide. The pattern comparison table below is the same decision in tabular form, with SDK primitives mapped to each branch.