Tool use
tool-use
Tool use is the pattern where the model can decide to call an external function (search, code execution, calculator, API) instead of (or alongside) generating prose. The model emits a structured "tool call" block; the application executes the call and returns the result; the model continues with that result in context.
A model on its own is a function from text to text. Tool use turns it into a function from text + tool-results to text. That changes what the model can reliably do.
The mechanics: the application gives the model a list of available tools, each described with a name, description, and input schema (typically JSON Schema). The model, while generating its response, can choose to emit a tool-call block instead of regular text. The application sees that block, executes the corresponding tool with the model's specified arguments, and returns the result as the next message in the conversation. The model then continues, now with the tool's output as context.
This is how a model "checks the weather," "reads a file," "queries a database," or "runs Python." The model itself does not have weather, files, databases, or a Python interpreter. The application provides those tools and the model decides when to use them.
Tool use is what makes systems agentic. A single tool call is usually called function calling; chaining multiple calls in a loop ("call search, read result, decide next action, call code interpreter, etc.") is the agentic pattern. Each step is the model deciding what to do next based on what came back from the previous step.
The failure modes are real. Models are imperfect at deciding when to call a tool: they sometimes call when they should have answered from memory, or skip the call when they should have searched. They are imperfect at what to call: they sometimes pass the wrong arguments. Most production tool-use systems include validation, retry logic, and explicit prompts about when each tool is appropriate.
Tool use is not RAG, though they are related. RAG retrieves before generation; tool use lets the model retrieve during generation. Practically, modern apps blend both.