The Model Asks for a Tool
reading a tool use block
Part of: Tool-Using Agent
You sent the model a calculator tool and asked "what's 847 293?" The model doesn't answer with a number. It answers with a request: run the calculator tool with this expression. This lesson is about reading that request. What comes back isn't plain text When the model decides to use a tool, its reply has stop reason == "tool use", and its content list holds one or more blocks of type "tool use" next to any "text" blocks it also wrote: Three fields matter on a tool use block. id tags this specific request so you can match your answer back to it later. name tells you which tool it wants. input is a dict matching the input schema you defined, already parsed into real Python types, with no JSON string for you to decode. Why stop reason matters stop reason is how you tell a final answer apart from a request for a tool run. If it is "end turn", print resp.content[0].text like a normal chatbot reply. If it is "tool use", the model isn't done. It is paused, waiting on you. Checking stop reason before you touch the content is the first branch of every agent loop you'll write from here on. The model can talk and call in the same turn Sometimes the model writes a sentence like "Let me calcula
Challenge: First Tool Call Wins