Lesson 1: The agent loop, written by hand
30 min read·13 Oct 2026
Module 5 · Lesson 1 · About 60 minutes · Needs: Module 3 (make_failure_safe_tools,call) and Module 2's output contract (OUTCOME: <label>)
The situation
It is Monday 11 May 2026, week 5. The eight tools are served over MCP, and Priya asks: "So who calls them?" So far you have run one model turn at a time. The first unattended run of the test queue is on Wednesday 20 May, and it needs a loop: code that asks the model what to do, does it, shows it the result, and asks again.
Marta adds a condition: "Every run stops. I want to know why, and what it cost." You trace R-1004 all lesson: Mei Tanaka cancelling order 8204, the SoundPod headphones, $79.00, still processing.