Agent Design Patterns
Composable primitives for building reliable, debuggable agent workflows in production.
The Recipe Model
Every agent run is a recipe — a deterministic DAG of steps. Each step declares its inputs, outputs, retry policy, and timeout. The runtime materializes the graph, resolves dependencies, and streams progress. No hidden state, no black-box reasoning loops.
recipe:
name: classify-and-route
steps:
- id: classify
tool: llm.classify
input: $trigger.text
retry: { max: 2, backoff: exponential }
- id: route
tool: router.dispatch
input: $classify.intent
depends_on: [classify]Guardrails & Circuit Breakers
Every tool call is wrapped in a guardrail that validates output shape, enforces a token budget, and opens a circuit breaker after N consecutive failures. The breaker half-opens after a configurable cooldown, sending a probe request before allowing full traffic.
- Per-step timeout with deadline propagation
- Token-bucket rate limiter on LLM calls
- Output schema validation before dependent steps execute
Observability
Every step emits structured spans with input hashes, output hashes, wall-clock duration, and token counts. The trace is idempotent — replay the same recipe with the same inputs and you get the same trace shape. Diff two traces to find exactly where a prompt change altered behavior.
Human-in-the-Loop
Any step can yield with a requires_approval signal. The runtime suspends the DAG, persists the checkpoint, and notifies the configured channel. The human approves or rejects; the recipe resumes from the checkpoint with the decision injected as input.
Next step
Read the quickstart guide to build your first recipe agent in under five minutes.