Forward-deployed / Learning zone
Agentic AIa standalone module
Lesson 02

Tools & function calling

TL;DR

Tools are how a model stops being a text generator and starts being an actor. The mechanics are simple. You describe functions to the model: name, purpose, typed parameters. The model replies "call this one, with these arguments." Your code executes the call and feeds the result back. Then the model continues. The model never runs anything itself — which means the harness that owns execution is where safety, permissions, and reliability actually live. The craft is mostly tool design (a few well-described, right-altitude tools beat a hundred thin API wrappers), integration (MCP made tools portable across apps and vendors), and containment (sandboxes and scoped credentials, because a tool call is real-world action).

🎯 For the AI PM

Why it matters — The tool list is the product surface of an agent. It defines everything the agent can do, everything that can go wrong, and most of what it costs. Two agents on the same model with different toolboxes are different products.

What it changes in your decisions — Review the toolbox like you review a permissions screen: what can this agent read, write, spend, and delete? Which of those actions are reversible, and which require a human's approval? Treat "add a tool" with the gravity of "add a capability," not "add a config line."

Ask yourself — "For each tool: what's the worst realistic thing the agent could do with it, and would we survive that on a bad day?"

Risk if ignored — An over-provisioned agent meets a manipulated input (prompt injection) or its own confusion. It then uses a legitimate tool to do something catastrophic — politely, and at machine speed.

The mechanics

Tools & function calling

The model only ever requests — the harness executes and can refuse

Every control — allowlists, approval, rate limits, logging — attaches at the harness step.

User
Harness (your code)
Model
Tool
1User → Harness: "Find our three biggest churn drivers"
2Harness → Model: prompt + tool definitions
3Model → Harness: tool_call: query_warehouse(sql=…)
4Harness validates & checks permissions
5Harness → Tool: execute the call
6Tool → Harness: result (rows / error)
7Harness → Model: tool result appended to context — loop to step 3, or…
8Model → Harness → User: final answer, with findings
Two arrows worth staring at: the model only ever requests a call, and the harness executes and can refuse. A model with tools is exactly as dangerous as the harness lets it be.

Two arrows are worth staring at: the model only ever requests a call, and the harness executes and can refuse. Every control you'll ever want — allowlists, approval prompts, rate limits, spend caps, logging — attaches at that harness step. A model with tools is exactly as dangerous as the harness lets it be.

One taxonomy is worth knowing, because platform docs and eng teams use it. It comes from Google's Agents whitepaper: tools split by where the call executes. Extensions run agent-side — the agent's runtime calls the API directly. This suits pre-built integrations and multi-hop chains where the next call depends on the last result. Function calling runs client-side — the model only outputs the function name and arguments, and your application executes (or refuses) the call, exactly as in the diagram above. Data stores are the retrieval path: documents vector-indexed so the agent can query them at runtime (context & memory). The whitepaper gives three canonical reasons to keep execution client-side, and this lesson defaults to it for the same reasons: security and auth restrictions mean the agent shouldn't hold API credentials; timing and order-of-operations constraints (batch jobs, human-in-the-loop review before anything fires) require a checkpoint; and some APIs simply aren't reachable from the agent's infrastructure. Choosing agent-side execution means choosing convenience over a control point — make that trade knowingly.

Two late-2025 developments upgraded the mechanics. Code execution as tool-glue: the model can write a short program that calls many MCP tools directly and returns only the final result, instead of emitting one tool call per turn with each result round-tripping through the context. This collapses token cost and latency on multi-tool workflows, and makes the code sandbox the orchestration surface. Skills: packaged procedural knowledge — a folder with instructions, scripts, and resources the agent loads when relevant — is now a third primitive alongside tools and prompts. Tools give the agent capabilities; skills give it know-how about when and how to use them. Both matter to the PM the same way: the toolbox review now covers what code the agent can run and what procedures it has been handed, not just which APIs it can call.

What counts as a tool spans a wide range: retrieval and web search; code execution (the universal power tool — a Python sandbox turns "things the model can describe" into "things the model can do"); file and document operations; business APIs (CRM, calendar, payments); and computer/browser use, where the model drives real UIs by looking at the screen. Computer use is powerful, slower, and the most fragile of the family.

Tool design is UX design (for a model)

Models use tools well when the toolbox is designed for a reader, not a machine:

Integration and containment

MCP (Model Context Protocol) standardized the boring, valuable part. Instead of every app hand-wiring every integration, a tool provider ships one MCP server exposing tools with schemas, and any MCP-capable agent can use it. Think "USB for tools." It's real, widely adopted, and the piece of the much-hyped protocol landscape most worth knowing (the honest protocol map comes in lesson 5). An ecosystem note that becomes a product note: an MCP server someone else wrote is third-party code your agent trusts — its tool results enter your context. Vet servers like dependencies, not like plugins.

Containment is the other half of integration. The working defaults:

Failure modes

Practitioner checklist