Lesson 45
How tools work
Build an LLM From Scratch, 53 lessons
Lesson 45: How tools work
Build an LLM From Scratch, Lesson 45 of 53

A tool call is only text the model writes. Step one edit call through two lanes, change it and break it, and watch what the program does with the text and what goes back to the model.
The question for this lesson: how can a model that only writes text use a tool?
On lap 3 of the coding agent in lesson 44, the model wrote a line of text, edit_file(grade.py, mark > 40, mark >= 40). The loop ran it, grade.py really changed, and the tests passed. We said “the loop runs it” and moved on.
This lesson opens that step. The model only ever writes tokens, one after another, as lesson 38 showed. So what turns a line of text into a changed file?
The rest of this lesson is in Premium
Premium includes every lesson, with its notes, practice and progress.