Definition: Function calling is the API feature that lets a large language model emit a structured JSON object naming a function and its arguments, instead of — or alongside — a plain-text reply. It is the wire format underneath tool use, the concrete mechanism that turns a chat model into an agent. When a model function-calls, the host runtime parses the JSON, executes the real function, and feeds the result back into the conversation for the next reasoning step.
OpenAI shipped the first production function-calling API in June 2023. Anthropic's tool-use API, Google's Gemini function-calling, and the Model Context Protocol tool spec all converged on the same idea: the model does not execute anything — it produces an instruction that the developer's code executes.
Why Function Calling Changed Everything
Before function calling, LLMs could only talk. Every production attempt to connect a model to external systems relied on flimsy string parsing: the developer would prompt the model to output text like ACTION: search("quantum computing"), then regex-match the string out of the response, then pray the model did not wrap it in a code fence or paraphrase the format.
Function calling replaced that brittleness with a contract. The developer declares tools using JSON Schema — the same schema standard used by OpenAPI, YAML, and most typed APIs. The model is fine-tuned to respect that schema. When it decides to invoke a function, the output is already parsed, typed, and validated. No regex, no paraphrasing, no silent drift.
The downstream effect was seismic. Every agent framework — LangChain, CrewAI, LangGraph, Anthropic's SDK, OpenAI's Agents API, Taskade's AI Agents v2 — is built on function calling. The ReAct pattern, agentic RAG, multi-agent orchestration, and every Taskade Genesis app that reads a calendar or sends a Slack message — all of it runs through a function call under the hood.
The Function Calling Contract
How Function Calling Works
A single round of function calling has five moves:
1. Tool registration. The developer sends a tools array with the request. Each tool entry has a name, a description, and a JSON Schema for the parameters:
{
"name": "create_calendar_event",
"description": "Create an event on the user's primary Google Calendar.",
"parameters": {
"type": "object",
"properties": {
"title": { "type": "string" },
"start": { "type": "string", "format": "date-time" },
"duration_minutes": { "type": "integer", "default": 30 }
},
"required": ["title", "start"]
}
}
2. Model inference. The model reads the user message and the tool catalog. Because it is fine-tuned on function-calling data, it can choose to emit a tool_call object instead of text. The tool_call has three fields: an ID (for correlation), the function name, and the arguments as a JSON string.
3. Runtime dispatch. The host application parses the tool_call, validates arguments against the schema, and runs the underlying implementation. This step is ordinary application code — HTTP clients, database drivers, SDKs.
4. Result injection. The runtime appends a tool_result message referencing the original tool_call ID and containing the function's return value.
5. Continuation. The model reads the tool result and produces the next turn — another tool call, a question for the user, or a final answer.
The elegance is that steps 1 and 2 are vendor-specific, but steps 3, 4, and 5 are plain software engineering. Function calling is the seam between probabilistic reasoning and deterministic execution.
JSON Schema: The Contract
Good function calling depends almost entirely on good schemas. Three properties matter:
Specificity. parameters: { type: "object", additionalProperties: true } tells the model nothing. Concrete types, enums, and descriptions are what the model uses to decide when and how to call a tool. status: { enum: ["open", "in_progress", "done"] } is ten times more useful than status: { type: "string" }.
Required vs optional. The required array tells the model which fields it must produce. Forgetting to mark critical fields means the model will occasionally omit them. Over-marking fields means the model will hallucinate values rather than leave them out.
Descriptions on every field. The model reads descriptions at the field level. "channel": { "type": "string", "description": "Slack channel ID, starts with C or D. Use list_channels first if unknown." } is what turns a plausible tool into a reliable one.
Taskade's agent platform exposes the same JSON Schema contract for custom tools — if you can write the schema, you can register the tool.
Parallel and Sequential Calls
Modern function-calling models support two execution shapes:
| Shape | Example | When to Use |
|---|---|---|
| Sequential | Search → read top result → summarize | Each call depends on the previous result |
| Parallel | Fetch weather for 5 cities at once | Independent calls that fan out cleanly |
Parallel tool calling — introduced by OpenAI in late 2023 and now standard across vendors — lets the model emit multiple tool_calls in a single response. The runtime executes them concurrently and returns all results together. This is the difference between a ten-second agent and a one-second agent for any multi-step task with independent subtasks.
Structured Outputs vs Function Calling
The two are easy to confuse. Structured outputs force the model to emit a JSON payload that matches a schema, with no tool execution implied. Function calling also emits JSON against a schema, but the payload is interpreted as a call-to-action — the host runs code based on it.
In practice, most modern APIs unify the two: structured outputs are "I want the model's answer in this shape," function calling is "I want the model to tell me what tool to run next." Under the hood, both use the same constrained-decoding machinery.
Reliability Patterns
Function calling fails in ways that plain chat does not. Three patterns catch most production bugs:
1. Schema versioning. When you change a tool's parameters, old agents in long-running conversations may still emit the old shape. Keep a schema version field and migrate gracefully.
2. Idempotency keys. If the runtime crashes between steps 3 and 4, retrying may double-execute. Give every state-changing tool an idempotency_key parameter and enforce it in the implementation. Taskade's durable execution layer enforces this automatically.
3. Tool budgets. An agent can loop: call tool, get disappointing result, call the same tool with a slight tweak, repeat. Cap total tool calls per conversation and raise a clean error when exceeded.
Function Calling in Taskade
Every AI agent in Taskade speaks function calling natively. The built-in agent toolkit exposes 22+ tools — project management, task CRUD, database queries, web fetch, send message, trigger automation — each with a versioned JSON schema. Developers can register custom tools by providing a schema and an HTTP endpoint.
Genesis agents also participate in function calling on both sides of the Model Context Protocol:
- As an MCP client, a Genesis agent can discover and call tools exposed by external servers (Notion, Linear, GitHub, your internal APIs).
- As an MCP server, Taskade exposes its own tool catalog to external clients (Claude Desktop, Cursor, VS Code) so those agents can function-call into your workspace.
The function-calling contract is what lets the same agent reach both outward and inward through one standard interface.
Related Concepts
- Tool Use — The behavior function calling enables
- Structured Outputs — JSON mode without tool execution
- Model Context Protocol — The cross-vendor standard that builds on function calling
- Agentic AI — Why function calling is foundational
- ReAct Pattern — The reasoning loop that consumes tool results
- Prompt Engineering — Writing good tool descriptions is prompt engineering
- Multi-Agent Systems — When agents function-call each other
Frequently Asked Questions About Function Calling
What is function calling in LLMs?
Function calling is the feature that lets a large language model emit a structured JSON object naming a function and its arguments, instead of plain text. The host runtime parses the JSON and executes the real function — turning the model from a text generator into an operator.
Is function calling the same as tool use?
Function calling is the specific API mechanism (JSON Schema + structured tool_call output). Tool use is the broader agent behavior of choosing and invoking tools during reasoning. Function calling is the wire format; tool use is what happens on top of it.
Do I need fine-tuning to use function calling?
No. Modern frontier models from OpenAI, Anthropic, and Google are fine-tuned for function calling out of the box. You supply a JSON Schema for each tool and the model respects it. Fine-tuning helps only if you have thousands of domain-specific examples where the default model underperforms.
Can a model call multiple functions at once?
Yes. Parallel function calling lets the model emit several tool_calls in one response, which the runtime executes concurrently. This is standard across OpenAI, Anthropic, and Google APIs as of 2024 and cuts agent latency dramatically on independent subtasks.
How does function calling work with Taskade?
Taskade's AI agents use function calling for every action: reading your projects, querying databases, triggering automations, sending Slack messages. The 22+ built-in tools are JSON-schema-typed, and you can add custom tools by supplying your own schema and endpoint.
Further Reading
- AI Agent 26 Tools: The Right Number — Why tool count matters more than tool quality
- What Are AI Agents? — How agents actually work
- Multi-Agent Collaboration: Production Lessons — Real-world patterns
- AI Agents v2 Capabilities — The Taskade agent platform
