The Tool Interface — Why Agents Need Structured I/O
A language model produces tokens. A program takes actions. The gap between those two is the tool interface: a contract that lets the model request an action and the host execute it. Every 2026 stack — function calling on OpenAI, Anthropic, and Gemini; MCP's tools/call; A2A's task parts — is a different encoding of the same four-step loop. This lesson names the loop and shows the minimum machinery to run it. Explain why an LLM that can only generate text cannot, on its own, take actions against the real world. Draw the four-step tool-call loop (describe → decide → execute → observe) and name who owns each step. Write a tool description as three parts: name, JSON Schema input, and a deterministic executor function. Distinguish pure and side-effecting tools and state why the split matters for safety. An LLM emits a probability distribution over the next token. That is the entire output surface. If you ask a chat model "what is the weather in Bengaluru right now," it can write a plausible sentence, but it cannot dial into a weather API. The sentence might be right by coincidence or three days stale. Closing that gap is the purpose of the tool interface. The host program — your agent runtime, Claude Desktop, ChatGPT, Cursor, or a custom script — advertises a…
The Tool Interface — Why Agents Need Structured I/O: A language model produces tokens. A program takes actions. The gap between those two is the tool…
This free lesson is part of the AI Engineering from Scratch curriculum. Read the full explanation, run the lesson code, and verify the result in the interactive reader or from the repository source.
Browse the complete course catalog or open this lesson on GitHub.