Tools
Tell it what it can use
I'd love to use a calculator. But how would I know there is one?
The program puts a tool list at the top of the text, every time, before your question. The LLM reads it, so it knows which tools exist and how to ask for them.
the LLM can only use tools on the list
No list → a guess: 1,264,871. With the list → ACT: calculator(4817 * 263).
The list has several tools. How does the LLM pick one?
Which tool?
That's what the LLM does too: it matches the question to each tool's description, then writes the ACT: line.
“What's 9 × 6?” → calculator “works out math exactly” → ACT: calculator(9 * 6)
Try it on new numbers.
✏️ Practice 2.1
New numbers, same ideas.
Remember: the tool list goes at the top of the text, every time.
The LLM matches the question to each tool's description.
One ACT: line asks for one tool, once.
calculator, search, weather, add_reminder. “Will it rain in Goa tomorrow, and what's 15% of ₹600?” How many different tools does the LLM need?weather tool, one city at a time. How many ACT: lines does it write?Those descriptions were clear. What if they aren't?
Good descriptions
The LLM can only go by the words in the list. A good description says three things:
name + what it does + what to give itweather + “the weather right now in a city” + “the city name”.
Even a good tool can fail. Then what?
When a tool fails
The program doesn't stop when a tool fails. It writes the error on the LOOK: line, like any result. The LLM reads it, fixes its mistake and tries again.
errors go back on a LOOK: line too
The retry costs a round: 2 rounds here, so 2 + 1 = 3 LLM writes.
Try it on new numbers.
✏️ Practice 2.2
New numbers, same ideas.
Remember: a failed tool use still takes a round. The error comes back on a LOOK: line.
times the LLM writes = rounds + 1
The step limit is the most rounds the program allows. It stops there, even without an answer.
So far the tools only looked things up. Some do more.
Tools that change things
A tool that only looks changes nothing, so trying again is safe. A tool that changes something, like sending an email, can't always be undone. An agent needs more care with those: coming in Lesson 7.
Quick check: did it all make sense?
Lesson 2 test
5 questions, one for each idea in this lesson. Answer them all right to pass. A wrong answer tells you why, and which page to look at again.
calculator, search, weather, add_reminder. Which one for “What's 12% of 3,500?”tool_x: helps. What's wrong with it?You've seen every piece now.
Your turn to build
An LLM, a tool list, a program running the loop. You've watched an agent work, step by step.
I know what I can do now. Will you build me for real?