Function Calling (Tool Use)
The ability of an LLM to call external functions and tools - the foundation of AI agents and chatbots that take real actions.
What is function calling?
Function calling (sometimes called tool use) is a capability of modern LLMs in which the model does not stop at a text reply but instead generates a structured request to invoke a specific function - for example, "look up shipment 12345" or "create a calendar event." The application executes the function and returns the result to the model, which then produces the final answer for the user.
How function calling works
- Via a prompt or the model's API you pass function definitions (name, description, parameters as a JSON schema).
- In its response the model decides whether it needs a function - if so, it returns a structured output with the function name and arguments.
- Your application calls the function (e.g., an HTTP request to an internal API) and sends the result back to the model.
- The model incorporates the result and produces a final natural-language answer.