Module 1 · Lesson 1 · 14 min read
What is an AI agent?
What Is an AI Agent?
Introduction
In this lesson we give a precise definition of the AI agent and separate it from the common, loose use of the word. We look at the properties that make a system an agent, and build a tiny agent in Python to see its structure with our own eyes.
Learning objectives
- Define the AI agent in precise terms
- Name five core properties of an agent: goal, perception, reasoning, action and feedback
- Distinguish an agent from a predefined workflow
- Read the structure of a simple agent written in Python
From program to agent
We hear the word "agent" a lot these days, and it is sometimes used to describe any application that contains a language model. But the term has older roots in computer science: in the classic AI literature, an agent is any entity that perceives its environment through sensors and acts on it through actuators in pursuit of a goal. A simple thermostat fits this definition in a primitive way: it reads the temperature, then turns the heating on or off.
An LLM-based agent, on the other hand, is a system that uses a large language model as a "reasoning engine" that decides the next step, carries it out through tools, observes the result, and repeats this until it reaches the goal or stops. In its article "Building effective agents", Anthropic describes agents as systems in which the model dynamically directs its own processes and tool use, keeping control over how the task is accomplished, in contrast to a "workflow", in which the paths are predefined in code.
Properties that make a system an agent
There is no single agreed official list, but most definitions revolve around five properties:
- Goal: the agent works to achieve an outcome, not just to reply to a single message.
- Perception: it receives information from its environment: the user's message, a tool result, a file's content.
- Reasoning and decision-making: it chooses the next action based on the goal and what it knows.
- Action: it does something that changes the environment or fetches new information, usually by calling a tool.
- Feedback: it observes the effect of its action and adjusts its plan.
A practical example: a "travel assistant" agent
Imagine a student named Sara who writes: "I want to travel to Amman on Thursday, and my budget is limited." An ordinary chatbot would reply with generic travel tips. An agent behaves like this:
- It perceives the goal: a Thursday trip on a limited budget.
- It decides it needs to know prices, so it calls a flight search tool.
- It notices that the cheapest flight exceeds the budget, so it decides to ask Sara: would Friday work?
- After the answer it calls the tool again, then presents a suitable option and asks to confirm the booking.
Notice that the number of steps was not known in advance; the agent decided when to search, when to ask and when to stop. That is the essential difference.
A mini agent in Python
The following code does not use a real language model; it replaces "reasoning" with simple rules so you can see the structure of an agent clearly. You can run it directly without any library.
# A simplified thermostat agent: perceive -> decide -> act -> observe
class ThermostatAgent:
def __init__(self, target):
self.target = target # the goal
self.heater_on = False
def perceive(self, environment):
return environment["temperature"]
def decide(self, temp):
if temp < self.target - 0.5:
return "heat_on"
if temp > self.target + 0.5:
return "heat_off"
return "wait"
def act(self, action, environment):
if action == "heat_on":
self.heater_on = True
elif action == "heat_off":
self.heater_on = False
# The environment changes as a result of the action
environment["temperature"] += 0.8 if self.heater_on else -0.3
env = {"temperature": 18.0}
agent = ThermostatAgent(target=21.0)
for step in range(8):
t = agent.perceive(env)
a = agent.decide(t)
agent.act(a, env)
print(step, round(t, 1), a)In an agent built on a language model, the decide function is replaced by a call to the model that receives the goal and the observations and returns a decision such as "call tool X with these arguments" or "give the final answer". The rest of the structure stays very close.
When do we not need an agent?
Not every system should be an agent. If the steps are fixed and known (for example: extract the text from the file, translate it, save it), a predefined workflow is cheaper, easier to test and more predictable. In the same article Anthropic recommends starting with the simplest possible solution and adding agent complexity only when it is shown to improve results. An agent fits when the path is not known in advance and needs successive decisions that depend on earlier results.
Summary
An intelligent agent is a system that perceives its environment, makes decisions and acts to achieve a goal, then monitors the results of its actions and adjusts its course. In modern agents the language model plays the role of the reasoning engine, while tools carry out the actions. The most important difference from a workflow is that the agent decides the steps dynamically instead of having them written in advance. Even so, an agent is not always the best solution, and starting with the simplest possible solution is sound engineering practice.
Terms
| Term | English | Definition |
|---|---|---|
| Agent | Agent | An entity that perceives its environment and acts in it to achieve a goal |
| Perception | Perception | Receiving information from the environment, such as the user's message or a tool result |
| Action | Action | A step the agent carries out to change the environment or fetch information |
| Feedback | Feedback | Observing the effect of an action to use it in the next decision |
| Workflow | Workflow | A chain of steps predefined in code |
| Autonomy | Autonomy | How far the agent can act without human intervention |
Review questions
- What is the essential difference between an agent and a predefined workflow?
- Why is a thermostat considered an agent in the classical sense despite its simplicity?
- In the travel assistant example, which step shows the agent's ability to adjust its plan?
- When would you advise against using an agent? Give an example from your field of study.
References
- Building effective agents (Anthropic, 2024) www.anthropic.com Reviewed on 2026-11-18
- ReAct: Synergizing Reasoning and Acting in Language Models arxiv.org Reviewed on 2026-11-18
