Patterns ← Home

The pattern library. Twelve shapes the loop can take.

Every major lab has converged on the same handful. Picking the wrong one is the most common reason production agents fail.

P·01 Foundation

ReAct

Reason → act → observe → repeat. The base pattern. An LLM interleaves natural-language reasoning with tool calls; each observation feeds the next reasoning step.

Best forGeneral agents
P·02 Foundation

Plan · Execute · Verify

Draft a plan up front, execute each step, verify the result against the goal. Separates strategy from tactics and gives a natural checkpoint before shipping.

Best forMulti-step tasks
P·03 Pattern

Reflection

The agent critiques its own output before moving on. A second pass catches obvious mistakes, but self-grading is weaker than an independent check.

Best forDraft → polish
P·04 Pattern

Evaluator–Optimizer

Two roles. A generator produces; a separate evaluator scores against fixed criteria and returns specific fixes. Cycle two to four times.

Best forDocs, code, prose
P·05 Pattern

Retry Loop

Re-run a step until it succeeds or a limit hits. Cheap and effective against transient failures — network hiccups, rate limits, non-deterministic parses.

Best forFlaky steps
P·06 Pattern

Ralph Loop

Run the same prompt on repeat, a fresh context each pass, letting every iteration nudge the work forward. Crude and surprisingly effective — state lives in the artifacts, not the chat.

Best forOvernight grinds
P·07 Advanced

Multi-Agent Supervisor

A controller dispatches work to specialist workers running in parallel, then merges results. Powerful, expensive, coordination-heavy.

Best forParallel research
P·08 Advanced

Debate

Multiple agents with different priors argue; a judge synthesizes. Reduces confidently-wrong single-agent outputs on high-stakes calls.

Best forHard judgement calls
P·09 Advanced

Best-of-N

Generate several candidates in parallel — different seeds, prompts, or angles — and let a judge pick the winner. Trades tokens for quality when one attempt won't do.

Best forWide solution spaces
P·10 Production

Circuit Breaker

Trip after N consecutive failures. Stop hammering a broken tool or spinning on an unsatisfiable goal. Cool off, then decide to retry.

Best forCost / blast-radius control
P·11 Production

Bounded Execution

Hard caps: max iterations, token budget, wallclock, dollar spend. Any breach ends the loop with a partial result rather than a runaway.

Best forEvery production loop
P·12 Production

Human-in-the-Loop

Pause and request human sign-off on irreversible or ambiguous steps. The escape hatch that makes autonomy safe to ship.

Best forIrreversible actions