Lesson 1 / 25
What an Agent Is
Define an agent as a model plus tools plus a loop and tell it apart from a chatbot.
Model, tools, loop
A chatbot answers from what it already knows. An agent can also take actions: it is a language model given tools (functions it may request) and run in a loop until it decides the task is finished. The model never runs a tool itself; it asks, and your program does the work.
Think, act, observe, repeat
An agent is a model in a loop: it chooses an action, your code runs it, and the result goes back to the model.
A manager and a clerk
The model is a manager who says "fetch me order 42". The clerk (your code) fetches it and hands back the file. The manager reads it and decides the next instruction.
Not every task needs an agent
If the steps are fixed, a plain function or a short chain is cheaper and more predictable. Use an agent loop when the path depends on what the tools return.
Quick check: Who actually executes a tool call?
- The language model itself
- Your application code
- The user's browser
- The GPU
Answer
Your application code — The model only requests a call; your program runs the function and returns the result.