Agents · L2 · 20 min
Tools and schemas
Learn in five minutes
- A tool is a function with a name, a schema, and a side effect you understand.
- The model proposes arguments. Your code validates them.
- Toolformer is a paper about models learning to call tools. It is not a product you must buy.
- Lab 02 returns math from a tool, not from a fluent guess.
- A tool that can send a message needs a human check in this lab's examples.
The tool get_sum(2, 2) returns 4 because the code adds. The model is not the calculator. The trace should show the tool result.
Visual
Run the tool lab
- Run python3 labs/02-tool-call.py.
- Open the artifact.
- Find the number that came from the tool.
- Write one line: the model did not invent that number.
Quiz
Ecosystem
- Tool
- A function the loop may call, with a schema and a known effect.
Sisters: Workflows, State machines, Function calling.
The same loop can sit behind chat or a voice turn. The channel does not remove the cap.
MCP is one way to plug tools into that loop. It is the next track.
Config
- Write the goal in one sentence.
- Name the input and the allowed output.
- Save the trace next to the result.
Troubleshooting
- The answer looks fluent and is wrong. Check whether a source passage actually contains the claim.
- The loop never stops. Set a step cap and stop when the tool result repeats.
Sources and go deeper
- Schick and co-authors, Toolformer: Language Models Can Teach Themselves to Use Tools, 2023 paper last checked 2026-10
- Anthropic, Building effective agents vendor last checked 2026-10
- Large language model — Wikipedia wikipedia last checked 2026-10