HomeChallengesRepsProblemsLeaderboardTake a challenge

Tool Use

Give a model a real function to call, then handle the round trip — including the case where it asks for something that does not exist.

Intermediate20 min on the clock6 graded checks · 100 pointsRAG and Model APIsPro
Graded by reading your code against the checklist below.

What you build

  • Declare a tool with a name, a description and an input_schema
  • Detect stop_reason === "tool_use" and pull out the tool_use blocks
  • Validate the arguments before executing anything
  • Send one tool_result per tool_use block, keyed by tool_use_id
  • Loop until the model stops asking, with a turn limit
  • Return is_error: true when the tool throws, rather than crashing

Done means

A question needing the tool comes back answered; a bad order id comes back as an apology, not a stack trace.

How it is graded

Published in full, before you start — every point is one of these and there is nothing else.

  1. Declare the tool with an input_schema+20Calling a model API
  2. Branch on stop_reason+20Calling a model API
  3. Return one tool_result per tool_use_id+20Calling a model API
  4. Validate the arguments before executing+15Failing in a shape callers can read
  5. Loop with a turn limit+15Rate limiting and cancellation
  6. Report a failing tool as is_error+10Error handling

What it teaches

The rest of RAG and Model APIs