Tool calling (function calling)
Tool calling is when a language model writes a structured request to use an outside tool, such as a search, calculator or calendar, and the software around it runs the tool and returns the result.
The model never runs anything itself. Instead of an answer, it writes a message in a fixed format naming the tool and its inputs. The app runs the tool and pastes the result back into the conversation, and the model continues from there.
Tools fill a model's gaps: a calculator for exact maths, search for news after its training cutoff, a calendar or email app for real actions. Repeating this plan, act and observe loop lets a model work through multi-step tasks as an agent.
Tools also bring risk. Text a tool returns, such as a web page, can hide instructions that try to take over the model, so careful apps limit what tools can do and ask the user before important actions.
Learn it in a 6-minute lessonTools and agentsSearch, code and actions in the world