Stage 2 · Lesson 2 of 7
The tool call and result round trip
When the model wants a tool, it replies with a instead of text: an id, the tool name and the arguments as . With Anthropic's API the reply has stop_reason set to tool_use and contains tool_use blocks. Your code runs the tool, then sends a new request that includes the model's reply unchanged plus a tool result that quotes the same id.
With OpenAI's the pieces are called function_call and function_call_output, matched by call_id. The id matters because one reply can contain several calls, and the model must know which result belongs to which request. The model never runs anything itself: your code decides what actually executes.
Common trapdropping the model's tool call message before adding the results, which the API rejects or the model misreads.
A question to check yourself, an AI practice session and 1 cheat sheet entry come with the full roadmap. Unlock
Resources for this stage
Start with· follow one of these
- GuideFreeClaude Tool Use Documentation
Anthropic · Intermediate
Read Overview, Define tools and Handle tool calls, then follow the tutorial that grows one call into a full loop
- GuideFreeOpenAI Function Calling Guide
OpenAI · Intermediate
The same loop on the Responses API: read it after your first provider to see what is universal