AI Agents: LLMs That Use Tools and Take Steps
An AI agent is an LLM given tools and a goal — it plans, calls a tool, reads the result, and loops until the job is done.
What you will learn
- Define a modern LLM agent and tool calling
- Trace the think–act–observe loop
- Tell modern agents apart from classical agents
From a chatbot to an agent
A plain LLM can only produce text. An AI agent is an LLM given a goal and a set of tools it can use — so it can actually do things: search the web, run a calculation, query a database, or send an email. The LLM becomes the “brain” that decides which tool to use and when.
This is the classical agent model from Unit 2 returning in modern form — sense, decide, act — but now the decider is an LLM and the actions are tool calls.
Tool calling, simply
Tool calling means the LLM, instead of answering directly, outputs a request like “call the calculator with 23 × 47”. Your program runs that tool, gets the result, and feeds it back to the LLM, which uses it to continue. Tools are what let an LLM reach beyond its training — to do live, exact or real-world actions.
The agent loop: think → act → observe
An agent repeats a simple loop until the goal is met:
- Think: the LLM reasons about the goal and decides the next step.
- Act: it calls a tool (search, calculator, code-runner, etc.).
- Observe: it reads the tool’s result.
- Repeat: it thinks again with the new information — looping until it can give a final answer.
# An agent answering: "What is the population of France times 2?"
# It cannot know live facts or do exact maths alone, so it uses tools:
THINK : I need France's population. -> ACT: search("population of France")
OBSERVE: 68 million
THINK : Now multiply by 2. -> ACT: calculator("68000000 * 2")
OBSERVE: 136000000
THINK : I have the answer. -> FINAL: "About 136 million."Note: Output: About 136 million. The LLM did not “know” the population or do the multiplication itself — it used a search tool and a calculator tool, observed each result, and combined them. That tool use is what makes it an agent rather than a chatbot.
Classical agent vs modern LLM agent
| Classical agent (Unit 2) | Modern LLM agent | |
|---|---|---|
| The “brain” | Hand-written rules / search | A large language model |
| Actions | Fixed moves (turn, suck) | Tool calls (search, code, email) |
| Plans by | A coded algorithm | Reasoning in natural language |
| Example | Vacuum robot, maze solver | A research assistant that books a trip |
Watch out: Agents are powerful but riskier than a single answer: a wrong step early can snowball, and giving an agent real tools (sending emails, spending money) means mistakes have real consequences. Production agents need guardrails, limits on what tools they can use, and a human in the loop for important actions.
Tip: The whole course connects here: a modern agent is the agent loop (Unit 2) with a machine-learned brain (Unit 4), driven by an LLM (this unit), often grounded with RAG — classic and modern AI working together.
Q. What mainly separates a modern AI agent from a plain chatbot?
✍️ Practice
- Write the think–act–observe steps an agent would take to answer “What is today’s weather in Delhi in Fahrenheit?”
- List two tools you would give a “travel planner” agent and one guardrail you would add.
🏠 Homework
- Describe a task you would trust an AI agent to do for you, the tools it would need, and one safety limit you would set.