What Is an AI Agent? A Gentle Introduction
What Is an AI Agent? A Gentle Introduction
The Word "Agent" Is Everywhere—And Nobody Agrees on What It Means
Scroll through any technology news site in 2025 and you will be buried under a blizzard of "AI agents." Microsoft sells them. OpenAI builds them. A new startup promises to launch one every week. Salesforce says agents are the future of work. A blog post on Hacker News declares that "agents" will replace SaaS dashboards. Meanwhile, your doctor asks Siri for the weather, your bank deploys a chatbot that loops back to the same menu after every reply, and your smart speaker ignores you when you ask it to do anything ambitious. Something is being called an agent that obviously is not one. And something that obviously behaves like an agent is being called a chatbot. The terminology has become so loose that it is almost meaningless.
This confusion is not just an academic problem. If you are a developer trying to build with large language models, a manager trying to decide which AI tool to buy, a writer trying to explain the technology to your audience, or simply a curious reader who wants to understand the next decade of computing, the word "agent" is the single most important term you will need to pin down. Get the definition right, and the rest of the field opens up like a well-organized library. Get it wrong, and every product demo, every conference talk, every LinkedIn post becomes a muddle.
So what is an agent, really? And—more importantly—how is it different from the AI tools you have already been using?
The shortest honest answer is this: an agent is a system that perceives its environment, reasons about what to do next, and acts to bring itself closer to a goal. That loop of perception, reasoning, and action runs continuously, often across many steps, without a human steering it step by step. That is the whole definition. Everything else in this book is a refinement of those words.
To be fair, this is not a new idea. The word "agent" has been used in artificial intelligence since at least the 1970s. Classical AI textbooks described an agent as "anything that can be viewed as perceiving its environment through sensors and acting upon that environment through actuators." A thermostat is an agent. A chess program is an agent. A robot vacuum cleaner is an agent. What is new, and what has caused the recent explosion of interest, is that large language models finally give us a way to build agents that can reason in natural language about messy, open-ended goals—goals like "plan my trip to Kyoto," "research this company," or "debug this codebase." Before LLMs, you could build an agent for a closed problem like chess, but the moment you asked the same system to handle an unpredictable real-world task, the reasoning component would collapse. LLMs changed that, and the entire industry is rushing to exploit the shift.
That is why this book exists. The goal of this chapter—and the chapters that follow—is to give you a vocabulary precise enough to see through the marketing, an intuition deep enough to imagine your own agent-based systems, and a working mental model that you can apply to any new product, paper, or pitch you encounter. We will move slowly at first, because the foundations matter.
The Classic Definition: A System That Perceives, Reasons, and Acts
The most influential textbook definition of an agent comes from Stuart Russell and Peter Norvig's *Artificial Intelligence: A Modern Approach*, which has shaped how generations of AI researchers think about the field. In their framing, an agent is anything that can be viewed as perceiving its environment through sensors and acting upon that environment through actuators. An agent function maps every possible percept sequence to an action. A rational agent is one that, for each possible percept sequence, selects the action expected to maximize its performance measure.
This definition is dry, almost bureaucratic, but it has three virtues. First, it is broad enough to cover everything from a bacterium to a chess engine to a self-driving car to the software you are about to learn to build. Second, it is precise enough to draw a sharp line between an agent and a non-agent. Third, it breaks the agent down into components—perception, reasoning, action—that we can study one at a time.
Let us walk through each of those components, because they will appear in every chapter of this book.
Perception is how the agent learns about the state of the world. For a robot vacuum, perception comes from bump sensors, cliff sensors, infrared range finders, and wheel encoders. For a chess program, perception is the current board position passed in as input. For a modern LLM-powered agent, perception can include the user's typed message, the contents of files on disk, the output of a database query, a screenshot of a webpage, the result of a previous tool call, or even a live video feed. The agent does not need to perceive everything; it only needs to perceive enough to decide what to do next. The word *enough* hides a hundred engineering decisions, and we will return to it again and again.
Reasoning is what the agent does with what it has perceived. In a thermostat, reasoning is trivial: if the temperature is below the threshold, turn the heater on; otherwise, turn it off. In a chess program, reasoning is a deep search through a tree of possible moves and counter-moves. In an LLM-powered agent, reasoning is the language model's attempt to combine the user's instructions, its own prior knowledge, and the latest observations into a plan of action. Modern language models can do something that older AI systems could not: they can reason in natural language, weigh trade-offs, recover from confusion, and explain their thinking to a human. This is the breakthrough that made the current wave of agents possible.
Action is how the agent changes the world. For a thermostat, action is flipping a relay. For a chess program, action is moving a piece. For an LLM-powered agent, action might mean writing a paragraph of text, calling an external API, executing a line of code, clicking a button in a browser, sending an email, or—more often than people realize—deciding that no action is needed at all. Action is what closes the loop.
When you put those three components together, you get a cycle. The agent perceives the world, reasons about what to do, acts on the world, and then perceives the world again to see what changed. This is the perception–reasoning–action loop, sometimes called the sense–plan–act loop or, more simply, *the agent loop*. Every agent in this book, no matter how sophisticated, runs some version of that loop.
```mermaid flowchart LR A[Perception] --> B[Reasoning] B --> C[Action] C --> D[Environment] D --> A ```
A thermostat loops through those four states perhaps once per second. A chess program loops through them once per move. A modern LLM-powered agent might loop through them dozens or hundreds of times during a single user request, with each iteration refining the agent's understanding of what to do next.
This loop is so important that I want to spend a moment longer on it. Notice that the loop is closed. The agent's actions change the environment, and those changes become new perceptions that feed back into the next round of reasoning. This feedback is what distinguishes an agent from a function. A function takes inputs, produces outputs, and stops. An agent takes inputs, produces outputs, *observes what happened*, and continues. The word "continue" hides the entire difference between a chatbot and an agent.
The other thing to notice is that the loop is driven by the agent, not by a human. Nobody sits next to a thermostat and tells it, every second, "is the room cold yet?" Nobody tells a chess program, "okay, now search the next layer of the tree." The agent decides when to perceive, when to reason, when to act, and when to stop.