Agentic Engineering from First Principles All chaptersLecturesLabDownload the book
Part II · Giving Agents Abilities

Chapter 5: Tools

Central questionHow does a model gain reliable access to capabilities it does not possess internally?

Lecture

Chapter principle

Models choose actions; software executes them.

Key takeaways

Experiments

Every experiment in the book is small, runnable and printed with its real output. In the Lab you can replay a recorded real run of each one, with no programming, and watch what the model and the agent do.

Experiment 8: One tool

How does a model's proposal turn into a real action?

The program describes one tool to the model, a calculator, and asks “What is 27611 times 2033?”. The model cannot run anything. It can only reply with a proposal: a tool name and its arguments. Software looks the name up in its registry, the list of tools it is willing to run, and runs the real function. This is a recorded run of a real model. A new run may differ: the model also decides whether to use the tool at all.

Experiment 9: Choosing between tools

How does a model choose between two similar tools?

The model gets two search tools: one over the company’s own documents and one over the public web. It must pick one for each of six questions. Three belong to each tool. No search actually runs: the experiment measures only the choice. Then the same two tools are offered again, with vague names and identical descriptions. This is a recorded run of a real model. A new run may pick differently.

Experiment 10: When a tool fails

What should the model be told when a tool fails?

The model asks for the weather in Pretoria, and the weather service times out. The same failure is handled twice. First, a wrapper hides it and passes on only “None”. Then a second wrapper reports it in a fixed format: what went wrong, and whether trying again could help. Each time, the model is then asked to answer the user. This is a recorded run of a real model. Its wording will differ in a new run.

All the code for this chapter: github.com/agentic-engineering-book/code

This is Chapter 5 of Agentic Engineering from First Principles: thirty chapters, a case study and fifty-nine executable experiments, from a single model call to controlled, self-improving agents.
Download the bookBrowse all chapters
← Chapter 4: Workflows vs AgentsChapter 6: Context Engineering →