Standard LLMs output text. Function calling lets LLMs output structured commands that trigger real actions — and then incorporate the results into their response.
**The flow:**
1. You define a set of functions (tools) with names, descriptions, and parameter schemas
2. You send a user message along with the tool definitions
3. The model decides whether to call a function, and if so, which one with what arguments
4. You execute the function in your code and send back the result
5. The model incorporates the result and generates a final response
**Example**: A user asks 'What's the weather in Tokyo?'
- The model returns: `{"function": "get_weather", "arguments": {"city": "Tokyo"}}`
- Your code calls the weather API
- You return the result to the model
- The model says 'It's currently 22°C and sunny in Tokyo'
Function calling is what makes AI agents possible. Without it, AI can only *describe* actions. With it, AI can *take* actions.
**Parallel function calling**: Modern models (GPT-4, Claude) can call multiple functions simultaneously. Ask 'Compare the weather in Tokyo and Paris' → two parallel weather calls.
**Structured outputs**: A related feature where models are constrained to output valid JSON matching a schema. This makes function calling reliable — no parsing errors, guaranteed structure.
The OpenAI function calling spec has become the de facto standard. Most major LLMs (Claude, Gemini, Mistral) support compatible tool-use APIs.
**Key takeaway:** Function calling turns LLMs from text generators into action-takers — the foundation of every AI agent.