Function calling and tool calling
Words made simple
A few useful meanings before you read the explanation.
- Tool calling
- The model proposes using a named function and supplies its inputs. Application code checks permissions and runs the function.
- API
- A way for one piece of software to ask another for data or an action. A claims API might return the current status of a claim.
- Schema
- A description of the fields and value types that data should contain. It helps check that an answer has the expected shape.
More words from this lesson
- Agent
- An application that uses a model to choose its next action within defined limits. It can use tools and continue through several steps.
- Idempotency
- Making a repeated request have the same intended business effect as one request. It helps avoid duplicate submissions or payments.
- Authorization
- Checking what that identity is allowed to read or do. Being logged in does not grant access to every record.
- HTTP
- The request-and-response protocol used on the web. HTTPS adds encryption to protect information in transit.
Overview
- Function calling lets a model propose a named function and structured arguments.
- Tool calling is the broader pattern that includes functions and capabilities such as search or code execution.
- A proposed tool call is an untrusted request that your application chooses whether and how to execute.
Why this matters
Models need current facts and access to approved actions outside their learned knowledge.
An everyday example
A support employee asks the claims team for status rather than making it up.
A technical example
Model proposes getClaimStatus({claimId: "C42"}); application validates arguments, authorizes C42, and returns a minimal result.
How it works
- Register tool schemas
- Receive call
- Check tool allowlist
- Parse arguments
- Authorize
- Execute with deadline
- Return result with matching call ID
- Ask model for the answer.
Architecture and flow
User → model → proposed tool → validation/authorization → service → observation → model → answer.
The insurance assistant example
A claim-status tool exposes read-only status. Creating a claim is a separate tool with approval and idempotency protections.
When to use it
For fresh account data, search, or explicit business actions.
When to avoid it
Do not expose raw SQL execution, arbitrary HTTP destinations, or unrestricted shell commands to a customer-facing agent.
Interview answer
“The model selects a tool and arguments; my backend validates and authorizes the call, executes business logic, and returns a result for the model to explain.”
Benefits, trade-offs, and production considerations
- Handle multiple calls, malformed arguments, timeouts, duplicates, and unknown tools.
- Tool-result text is also untrusted.
- Built-in provider tools and application functions can have different execution responsibilities.
- Official OpenAI function calling guide.
Can you explain it without the notes?
Function calling and tool calling
Use your own words. Explain an example and one limitation before checking the explanation.
Check your explanation
Function calling lets a model propose a named function and structured arguments. Tool calling is the broader pattern that includes functions and capabilities such as search or code execution. A proposed tool call is an untrusted request that your application…
Turn this concept into a clear answer.
Practice this conceptAdapted from 13_AI.MD · “Function calling and tool calling”. Examples are study fragments; framework behavior can depend on your version.