Tool & Function Calling
Tools
Part of: AI Agents & Tool Use
The breakthrough that made agents practical sounds almost boring: teach the model to fill out a form. Instead of the model running code, it returns a small structured object that says "call the function get weather with city=Tokyo." Your code reads that object and runs the real function. This pattern is called function calling (or tool use ), and it is the plumbing under every agent. What it is A tool is just a function you make available to the model, a calculator, a web search, a database query. To use it, you describe the tool to the model: its name , what it does, and the parameters it takes. When the model decides the tool is needed, it does not run it. It emits a structured request naming the tool and its arguments, usually as JSON . The model's only new skill is deciding when to call a tool and filling in the arguments correctly . The actual execution is plain code you control. How it works The cycle has four clear stages: 1. Describe the tools to the model (a schema: name, description, parameters). 2. The model requests a tool by returning a structured call, not prose. 3. Your code executes the real function with those arguments. 4. You return the result back to the model s
Challenge: The Tool Router