No history yet

Introduction to AI Agents

What Is an AI Agent?

An AI agent is anything that can view its environment and act upon that environment. Think of it like a self-operating robot, but it doesn't have to be a physical machine. It could be a software program, a self-driving car, or even a smart thermostat.

An agent perceives its environment through sensors and acts upon that environment through actuators.

Let's break that down. Sensors are the tools an agent uses to gather information. For a robot, this could be a camera or a microphone. For a web-crawling software bot, the sensors would be the ability to read the HTML of a webpage.

Actuators are the tools an agent uses to perform actions. A robot's actuators might be its wheels, arms, or speakers. The software bot's actuators would be the ability to click links or type into a search bar.

From Seeing to Doing

An agent's entire history of what it has perceived is called a percept sequence. At any given moment, the agent's choice of action is based on this sequence.

The mapping from any given percept sequence to an action is called the agent function. It's the ideal, abstract description of the agent's behavior. Think of it as a perfect rulebook that tells the agent what to do in every possible situation.

f:PAf: P^* \to A

In the real world, this perfect rulebook doesn't exist as a giant table. Instead, it's implemented by an agent program. This is the actual code that runs on a physical system (like a computer or robot), taking the current percept as input and deciding on an action.

How Do We Judge Success?

How do we know if an agent is doing a good job? We need a performance measure. This is an objective standard for success in the environment.

A rational agent is one that acts to maximize its expected performance measure, given the evidence provided by its percept sequence. It's crucial that this measure reflects the desired outcome, not just a proxy for it.

For example, a vacuum cleaner agent's performance might be measured by the amount of dirt cleaned up over a specific time, its energy consumption, and the noise it generates. Simply measuring the amount of dirt it sucks up could be misleading, as it might just move dirt around without actually cleaning the room.

Describing the Task with PEAS

To design an effective agent, we must first specify its task environment. A handy framework for this is PEAS, which stands for Performance measure, Environment, Actuators, and Sensors.

Agent TypePerformance MeasureEnvironmentActuatorsSensors
Self-Driving CarSafety, speed, legality, comfortRoads, traffic, pedestrians, weatherSteering, accelerator, brake, signalsCameras, sonar, GPS, speedometer
Spam FilterMinimizing false positives and negativesUser's email account, mail serversMark as spam, delete messageIncoming emails (sender, content)
Medical DiagnosisHealthy patient, minimized costsPatient, hospital, staffQuestions, tests, treatmentsPatient symptoms, test results

Defining the PEAS for an agent forces us to think clearly about what we want it to achieve and the context in which it will operate.

Know Your Surroundings

Environments themselves have different properties that influence how an agent should be built. The more complex the environment, the more complex the agent program needs to be.

PropertyDescriptionExample
ObservabilityCan the sensors access the complete state of the environment?Fully observable: Chess. Partially observable: A self-driving car can't see around corners.
DeterminismIs the next state of the environment completely determined by the current state and the agent's action?Deterministic: A puzzle game. Stochastic (random): A card game.
EpisodicityIs the agent's experience divided into atomic, independent episodes?Episodic: An image classification task. Sequential: Playing chess, where the previous move affects the next.
Static vs. DynamicDoes the environment change while the agent is deliberating?Static: A crossword puzzle. Dynamic: A taxi driving in traffic.
DiscretenessAre the percepts, actions, and environment states distinct and finite?Discrete: Chess. Continuous: Driving a car involves continuous variables like speed and steering angle.
Single vs. Multi-agentIs the agent operating by itself or with/against other agents?Single-agent: Solving a maze. Multi-agent: A soccer game.

Understanding these fundamental concepts is the first step toward building and analyzing intelligent agents. By defining an agent's structure, its measures of success, and the properties of its environment, we can begin to explore the different ways agents can be designed to solve complex problems.

Quiz Questions 1/5

What is the primary role of an actuator for an AI agent?

Quiz Questions 2/5

An agent's choice of action at any given moment is based on its entire history of perceptions, which is called the ______.