5 min
Tool calls and the loop: one more step, I promise
Learn how an agent asks for a tool, what happens to the result, and what makes it stop.
By the end of this lesson you can
- Explain how an agent asks for a tool
- Walk through one loop: think, act, look
- Say what makes an agent stop
From earlier lessons
What makes something an agent, rather than a chatbot that just replies?
Pick one answer.
POV: you ask for Friday dinner. Behind the scenes, the model's reply isn't a sentence for you. It's closer to a filled-in form: tool "search_restaurants", area "downtown", party size 6. Nobody types that. So how does a text predictor know that form exists?
Take a guess
How does the model know which tools it can use?
No pressure. Guess now, and the lesson will show you if you were right.

so the model just goes on the internet
no. the app gives it a menu: each tool's name, what it does, and what inputs it needs
and it orders off the menu
yep. it writes a structured request: the tool name plus the inputs. that's a tool call. some people call it function calling
then the restaurant list just pops into its head
the app runs the tool and adds the result to the conversation. next time, the model reads it like any other text
so think, act, look, repeat
exactly. read what it has, ask for a tool, read the result, decide again 🔁

So when does it stop? Usually when the model decides it has enough and writes a final answer instead of another tool call. Apps add guardrails too: a maximum number of steps, a time limit or a spending cap. Some also pause and ask you before certain actions. Stop too early and the job is half done. Stop too late and it burns time and money.
Predict, then reveal
Plot twist time. Everyone assumes the agent remembers what the search found because it "saw" it. Where is that result actually kept?

What is a tool call?
Pick one answer.
The agent has every fact it needs for your answer. What should happen next?
Pick one answer.
FlashcardsIndex cardsFlashcards ⚡
Card 1 of 5Worth keeping
- The app tells the model which tools exist. The model knows them only by name and description.
- A tool call is a structured request. The app runs it and adds the result to the conversation.
- Each loop is another model call, so long tasks cost more time and money.
- An agent stops on a final answer, or when it hits a limit the app set.
One loop, a few steps, a tidy answer. Now give it a task with twenty steps. If each step is right most of the time, how often is the whole task right?