Learning map / Task 1 / Lesson
Spot the bug
Five minutes. The loop below is sound: it answers the desk's question in three round trips (requests to the model, each re-reading the whole conversation), and most of what it re-reads comes from the cache (the API's stored copy of a prompt prefix that has not changed, which makes the next request cheaper). Five of its lines are ones novices write differently, and each costs something: more round trips, a cache that never hits, or a 400 (an error status: the API rejects the request). Find them. Press a line to write it the novice way and watch the run under the code. Marks stay: a wrong press is information too.
spot-the-bug-runs.json, written by make cases). A dashed box is a rejected request. The bar is the input you are billed for, from zero; the thin line marks the sound loop's bill.
Then
Open tasks/t01_fewer_tool_calls/worked/v0_naive.py and find which of these it has. It has two. The rest are yours to never write .