Understanding Agents
Introduction to Agents
What Is an Agent?
In artificial intelligence, an agent is anything that can observe its environment and act upon it. Think of a simple thermostat. It perceives the room's temperature through a sensor. If the temperature drops below a set point, it acts by turning on the heat. When the temperature rises above that point, it acts again by turning the heat off. The thermostat is an agent.
This relationship between perceiving and acting is fundamental. An agent takes in information through its sensors and chooses an action to perform with its actuators. For a software agent, sensors could be keyboard inputs or network packets. Actuators might be displaying something on the screen or writing a file. For a robot, sensors are cameras and touch detectors, while actuators are motors and grippers.
The core job of an agent is to map a sequence of perceptions into a specific action. The rule it uses to make this choice is called the agent function.
Types of Agents
Not all agents are created equal. They range from incredibly simple to highly complex. We can classify them based on how they decide which action to take.
Simple Reflex Agents These are the most basic agents. They make decisions based only on the current percept, ignoring the history of what they've seen before. They operate on a simple condition-action rule: if this happens, do that.
An automated vacuum cleaner that changes direction only when its bumper hits a wall is a simple reflex agent. It doesn't remember hitting the wall a second ago; it just reacts to the present moment.
Model-Based Reflex Agents Simple reflex agents are limited because they can't see the whole picture. What if the environment is only partially observable? A model-based agent handles this by maintaining an internal model of the world. This model keeps track of the state of things it can't currently see.
This internal state is updated over time based on two things: how the world evolves on its own, and how the agent's own actions affect the world. When it's time to act, the agent uses this model, plus the current percept, to make a decision.
Goal-Based Agents Knowing about the current state of the world isn't always enough. Sometimes an agent needs to achieve a specific goal. Goal-based agents take things a step further by considering the future consequences of their actions.
Instead of just reacting, these agents can plan and search. Given a goal, like 'get the package from location A to location B', the agent considers different sequences of actions that could lead to that goal. It then chooses the sequence that works. This makes them more flexible than reflex agents. If it starts raining, a delivery drone with a goal can find a new route, whereas a reflex agent might just stop working.
Utility-Based Agents Sometimes, there's more than one way to achieve a goal. Which one is best? A goal-based agent might see all successful paths as equal. A utility-based agent can distinguish between them.
Utility is a measure of 'happiness' or 'success'. A utility function maps a state to a real number representing its desirability. For a self-driving taxi, reaching the destination is the goal, but a utility-based agent can aim for more. It might choose a route that is not only correct but also faster, safer, and more fuel-efficient. It seeks to maximize its expected utility, leading to more intelligent and refined behavior.
| Agent Type | Basis for Action | Example |
|---|---|---|
| Simple Reflex | Current percept only | A thermostat turning on heat when it's cold. |
| Model-Based Reflex | Internal model of the world | A self-driving car braking because it knows the car ahead is slowing. |
| Goal-Based | A desired future state | A GPS navigator calculating a route to a destination. |
| Utility-Based | The 'best' outcome | A flight booking system finding a cheap and fast flight. |
These agent types build on each other. A utility-based agent still needs a model of the world and a goal. It just adds an extra layer of decision-making to choose the optimal path.
What are the two fundamental capabilities that define an AI agent?
A self-driving car needs to decide between several valid routes to a destination. It chooses the route that is fastest and uses the least amount of fuel. This decision-making process is characteristic of which type of agent?