← All lessons
0145

Tool Use

The agents lesson showed the think-act-observe loop; this is the mechanism inside the ACT step. A model cannot actually run anything — it only produces text. Tool use works because that text can be structured JSON naming a tool and its input, which YOUR code executes, feeding the result back as new context tokens.

Step through one complete call. Notice the division of labour: the model only writes and reads text; the application does the parsing, the running, and the returning. The model chose the calculator because its fine-tuning taught it when a tool beats guessing — this exact pattern, defined per-tool by a name, description, and input schema, is how search, code execution, and every agent framework works.

user
“What is 847 × 293?”
User asks

A question the model could guess at — but LLMs are unreliable at arithmetic. It has a calculator tool available.

Check yourself

During a tool call, what does the model actually execute — and what does that mean for who is responsible when a tool does something harmful?

Go deeper (free): Anthropic docs — Tool use

Next: MCP & Agent Protocols