AI Orchestration Patterns

Production-tested patterns for building reliable AI agent workflows. Each pattern includes a problem statement, diagram, and code examples in TypeScript and Python.

Fan-out / Fan-in

Deep Research

Decompose a task into parallel subtasks, then aggregate results into a single output.

View pattern →

Adversarial Verification

Codebase Review

Spawn independent skeptic agents to attempt to refute each finding before it's accepted.

View pattern →

Loop Until Dry

Codebase Review

Keep spawning discovery agents until N consecutive rounds return nothing new.

View pattern →

Human-in-the-Loop Checkpoint

Repo Migration

Pause execution at a named gate and wait for a human to approve before continuing.

View pattern →

Model Fallback Chain

Cross-cutting

Define a primary model and one or more fallbacks. Automatically route when the primary is unavailable or over budget.

View pattern →

Cost-Bounded Research

Deep Research

Set a hard USD ceiling on a task. Execution halts gracefully when the budget is exhausted.

View pattern →