Recipe: the safe tool runner
Only tools on the allow-list can run. Every failure is returned to the model as text.
Every recipe from the course, one per phase, with the topic where you built it, a symptom lookup, and four runnable recipes that are used together most often: typed calls, resilient calls, a safe tool runner and an evaluation gate.
Change the code and press Run (Ctrl+Enter). Predict what will happen first, then break it on purpose and read what changes. Your edits are saved and match the lesson page.
Ready for more? This phase has 5 hands-on exercises with automatic checks.
Practice questions
Write the code in the editor, run it, then open the model answer to compare.
Write pick_label(raw, allowed) that returns the one allowed label found (ignoring case) in the model's raw reply, or other when none or more than one is found. Print results for Billing, I think shipping or billing and no idea with the allowed labels billing and shipping.
Write tally(events) that counts outcomes such as ok, retry and fallback in a list, and print the counts sorted by name.
Explain it without notes
If you had one day to make a prototype production-ready, which recipes would you add first, and in what order?
How do you decide whether a new recipe or guard is worth adding?
A quality drop is reported a week after a prompt change. Which recipes would have caught it, and how?
Expected output
step 1: get_weather({"city": "Pune"}) -> 28 C in Pune
step 2: delete_everything({}) -> error: unknown tool delete_everything
step 3: get_weather({"city": 5}) -> error: city must be a string
step 4: get_weather({"city": "Mars"}) -> error: no data for Mars
final: Pune is 28 C. I have no data for Mars.