Lesson 02.05 · Phase 02 · Tool Use & Function Calling
Tool errors as observations
When a tool fails, the error message is the only thing the model learns from. Write it for the model: what went wrong, whether retrying helps, and, if you can work it out, the exact value to send instead.
Learning objectives
- Raise typed tool errors (not found, invalid input, rate limited) with a hint and optional details.
- Render the same error four ways (traceback, terse, rule, exact) and compare what each tells the model.
- Measure how often a real model's next call recovers from each style.
- Know when a better error message isn't enough, and the tool should handle the input itself.
Phase 3 made sure tool failures never crash the loop: they become observations. But an observation can be useless. Compare what the model receives when an order lookup fails:
Loading the full lesson…