Vol. XXV · Tools and Agents Plate 1 of 9tool use, function calling, tool schema, calculator, demonstrations, fine-tuning, agentsLE

Calling Tools.

The model does not run the tool. It writes a request; something else runs it and writes back.

A language model can only produce text. Tool use turns some of that text into actions: the model is given descriptions of functions — a name, parameters and their types, usually as a JSON schema — and is trained to emit, when useful, a call in a fixed format. The serving software watches for that format, parses the call, runs the function and inserts the result into the context as a new message; generation continues with the result in view. Function calling in commercial APIs, code execution and web search all work this way, often with special tokens marking where a call starts and ends.

The tool world of this part: the character model of Vol. XVII, pre-trained only on single-digit worksheets, is fine-tuned in the page to call a calculator — it writes “B23+45|”, the environment appends the result “68|”, and the model answers “68|”. Two-digit sums are beyond the model: it has only ever seen single digits added. The workshop fine-tunes it on demonstrations that call the calculator, or on demonstrations that answer directly, and measures both on 30 held-out sums.

Below: held-out transcripts from the model fine-tuned to call the calculator; the bars compare held-out success with the tool and when trained to answer directly.

What you will learn
Workshop
The character model (d = 32, two layers, 32-character context) from its pre-trained weights; fine-tuned with AdamW (learning rate 0.002, batches of 16) on the chosen number of demonstrations from 70 training sums of two numbers between 10 and 49, loss on the model’s own characters only. Success: the final answer equals the sum, on 30 held-out sums, greedy decoding.

Copy the operands, not compute the sum

Trained on 70 demonstrations for 400 steps, the model writes a well-formed call and copies the answer back on 100% of held-out sums; trained on the same sums to answer directly, it gets 10% of them — it memorises its 63% of training answers and has no way to compute new ones. The tool did not make the model better at arithmetic; it changed the task into one the model can do, copying two numbers into a format. With 30 demonstrations it reaches 7%, and with only 100 steps 7%: even copying needs data.

Every real tool-using system has the same division of labour. The model writes the request; the harness validates it against the schema, executes it with whatever permissions it has (plate XXV.8), and returns the result as text the model reads. A malformed call is an error the harness must handle — here 0% of episodes — and production systems constrain the call’s syntax with the grammar-masking of plate XXII.5. What the model must learn is when to call, what to put in the call, and how to use what comes back.

Toolformer (2023) taught a model to insert API calls into ordinary text by keeping only the calls whose results lowered the loss on the following tokens — a self-supervised signal for when a tool helps.

Terms

Tool call
Structured text the model writes for a program to execute.
Schema
The declared name, parameters and types of a tool.
Harness
The software that parses calls, runs tools and returns results.
Function calling
API support for declaring tools and receiving structured calls.
A tool call is text the model writes and a program executes; it lets a model do what it cannot compute itself, if it learns the format.

Sources

  1. Schick et al., “Toolformer: Language Models Can Teach Themselves to Use Tools”, NeurIPS 2023.
  2. Parisi, Zhao and Fiedel, “TALM: Tool Augmented Language Models”, arXiv:2205.12255, 2022.
  3. OpenAI, “Function calling” and Anthropic, “Tool use” API documentation (accessed October 2026).