Chapter 1: What's an Agent, Really?
Why This Matters
By the end of this chapter, you'll be able to explain — to anyone, without hand-waving — what an AI agent is, how it's different from the chatbot you've already been using, and what the agent loop is. That loop is the heartbeat of every agent you'll ever build, and once you see it, you can't unsee it. Every chapter after this one is just filling in the pieces of that loop.
Chatbot vs. Agent: The "Hands" Question
Here's the simplest way to draw the line. A chatbot takes text in and gives text out. That's it. It can be funny, helpful, even brilliant — but it lives entirely inside the conversation window. It can't reach outside.
An agent takes text in, thinks about what to do, takes an action in the real world, and then looks at what happened. Then it thinks again. The action is the whole point. An agent doesn't just talk about booking the flight — it books the flight.
The Agent Loop: The Heartbeat
Every agent — every single one, from a toy script to a production system — runs the same four-step loop. Burn this into your brain:
Let's walk through it with Maya's trip:
Notice what just happened. Nobody told the agent to search for flights first. Nobody told it to check the budget after. It figured out the order on its own, looked at each result, and decided when it was finished. That's autonomy. That's what makes it an agent.
Before you read on, grab a piece of paper (or just think it through). Imagine an agent that helps you manage your email inbox. Trace one full pass through the loop for this task: "Find any unread emails from my boss and draft a reply to each."
Write down what happens at each step — PERCEIVE, THINK, ACT, OBSERVE. What tool might it call? What does it observe? When does it stop?
Why This Is a New Way to Build Software
Here's the part that takes a minute to click. For your whole career — or your whole life as a person who uses computers — software has worked one way: you decide what to do, and the software does exactly that. You click a button, it runs the code behind that button. Every branch, every if-statement, every path was written by a human who imagined it in advance.
An agent flips that. You give it a goal, and it decides the steps. The code doesn't say "if the user asks for flights, call the flight API." The code says: "here are some tools, here's a goal — figure it out." The LLM, in the THINK step, is choosing which tool to call and with what arguments, on the fly.
Where People Come Unstuck
Almost everyone new to agents trips on the same two things. Let's name them now so you can spot them later.
Mistake #1: "The LLM is the agent"
No. The LLM is the brain. The agent is the whole system — the brain plus the loop, the tools, the memory, the guardrails. When you say "I'm building an agent," you're not fine-tuning a model. You're wiring a brain into a body. We'll spend this whole book building that body.
Mistake #2: "Agents are just chatbots with a fancy name"
We addressed this, but it's worth a second hit because it's the one that sticks. The difference isn't the name. The difference is the loop and the autonomy. A chatbot responds. An agent decides, acts, observes, and decides again. If you take one thing from this chapter, take that.
Think about a task you do regularly that's annoying and repetitive — maybe sorting through job applications, summarising meeting notes, or checking whether your team's docs are up to date.
Now ask yourself: could an agent do this? What would it need to perceive (what info does it start with)? What tools would it need to act? How would it know when it's done? You don't need answers yet — just start thinking in the loop's shape. That's the habit this book builds.
Chapter Summary
- A chatbot takes text in and gives text out. It lives inside the conversation and can't reach outside it.
- An agent takes text in, thinks, takes an action in the world, and observes the result — then loops back and thinks again.
- The agent loop is four steps: perceive → think → act → observe. It repeats until the task is done. This is the heartbeat of every agent.
- The key difference is autonomy: an agent decides which steps to take, not you. You give it a goal and tools; it figures out the path.
- This is a new way to build software: instead of writing every if/else path, you give a brain a goal and a set of tools, and let it choose.
- The LLM is the brain. The agent is the whole system — brain, loop, tools, memory, and guardrails. You build everything around the brain.
The Agent Spotter. Below are four software products. For each one, decide: is it a chatbot or an agent? If it's an agent, trace one pass through the loop — what does it perceive, think, act, and observe?
1. A customer support widget that answers FAQs from a knowledge base.
2. A coding assistant that reads your codebase, finds a bug, writes a fix, and opens a pull request.
3. A recipe app where you type ingredients and it suggests dishes.
4. A "research analyst" that reads today's news, picks the three most relevant stories for your industry, and emails you a summary with sources.
Hint: the question is always the same — does it just answer, or does it act, observe, and decide what's next?