Lesson 02.11 · Phase 02 · Tool Use & Function Calling

Testing tools in isolation

A tool is a function with a contract. Test the function without a model (examples, contract, fuzzing, a fake backend), then use the model for the one thing only it can tell you: does it pick the tool and fill it in right?

Learning objectives

  • Write five kinds of tool test: examples, contract checks, seeded fuzzing, a fake HTTP backend, and a model-in-the-loop selection eval.
  • Use fuzzing to find crashes a model will eventually trigger, and require that a tool either returns a valid result or raises a typed error.
  • Test network failure modes (500s, bad JSON, impossible values, timeouts) against a real local server, with no internet.
  • Judge a model's arguments by running them through the real tool, not by matching text.

Tools get tested the way the rest of the agent does: by running the agent and seeing whether it works. That's slow, costs tokens, varies between runs (Phase 1 · Lesson 3), and when it fails you don't know whether the tool, the description, or the model was at fault.

Loading the full lesson…