Study Guide · Chapter 2: Tool Calls · 5 min read

Tool Calls, Explained Simply

A language model on its own can only write text. It cannot check your calendar, query a database, or issue a refund. Tool calls give the model hands — but only if those hands are governed by strict rules.

The model proposes, the system executes

When an agent needs to act, it does not run your code directly. Instead it writes out what it wants to do as a structured request: 'call get_order_status with order_id 12345'. Your application validates that request and executes the real operation.

It is like a doctor writing a prescription rather than dispensing the medicine personally. The pharmacist — your code — checks the dose, checks for interactions, and only then fills it.

Why strict contracts matter

Models generate probabilistic text, which means occasionally they will format things oddly, invent a field name, or guess a value. Production APIs do not tolerate that kind of creativity.

So every tool is defined with a schema — an exact description of which fields exist, what types they have, and which values are allowed. Anything that does not match is rejected before it ever runs.

The payoff

With schemas in place, agent behavior becomes testable and repeatable. You can simulate thousands of tool calls and know precisely how the system responds to each one.

You also gain freedom to evolve: swap the underlying API version, change vendors, or add retries behind the gateway without retraining or re-prompting anything.

Key Points

  • Tool calls turn a text generator into a system that can act safely in the world.
  • The model proposes a structured payload; validated code does the actual work.
  • Schemas catch malformed requests before execution instead of after the outage.
  • Deterministic contracts make agent behavior testable, versionable, and auditable.


All study guides for this chapter: Tool Calls, Explained Simply · How Tool Calling Works Under the Hood · Tool Calls in the Real World