Agent patterns

Turn a model into an agent. These loops handle planning, self-correction, and staying coherent across long runs. Part of the Cookbook.

Basic agent loop Wire up the core perceive-decide-act loop.
Interleaved reasoning and tool use Interleave reasoning with tool calls in a single turn.
Multi-turn context management Keep context under control across a long agent run.
Search-and-replace edits Make exact-match file edits that stay reviewable.
Alert fatigue copilot Pull grounded patterns from noisy alerts, then probe, chat, and self-assess with strict JSON.