Every pattern is the same think→act→observe loop, wrapped differently — drawn
twice: the numbered flow and the sequence diagram. Companion to
lesson 08 — which also covers
pattern zero: no agent at all 🙅.
1 🧍 The solo doer — one loop, one belt
Our agent.py: goal in, loop runs, reads flow, the write gates, outcome + log out.
The flow, numbered:
The sequence, message by message:
💡 When it pays for itself: almost always — start here and only add structure when the task proves it needs it.
2 🗺️ Planner + executor — structure beats heroics
Decompose first, then work the checklist; the plan survives any single item failing.
The flow, numbered:
The sequence, message by message:
💡 When it pays for itself: long or multi-part tasks where a raw loop drifts (L06 #4) or overflows the desk (L04).
3 🧑🏫 The critic loop — generate, grade, fix
A writer drafts; a merciless grader (best: actual tests) bounces it back until green.
The flow, numbered:
The sequence, message by message:
💡 When it pays for itself: quality-critical output with a checkable definition of good — code, citations, structured data.