The agent is a central abstraction in AI. An agent:
Perceives its environment through sensors
Acts upon the environment through actuators
Makes decisions based on perceptions to achieve goals
An agent can be a robot, a chatbot, or any other entity that can perceive and act. The decisions of an agent are made in the context of its environment.
An environment is the surrounding or conditions in which an agent operates.
1. Formal Definition:¶
An agent function maps from percept histories to actions:
where is the set of all possible percept sequences and (A) is the set of possible actions.
2. PEAS Description¶
AI agents are characterized using PEAS (Performance, Environment, Actuators, Sensors):
| Agent Type | Performance | Environment | Actuators | Sensors |
|---|---|---|---|---|
| Cleaning Robot | Cleanliness, battery, safety | Room, furniture, dirt | Wheels, vacuum | Camera, dirt sensor |
| Chess Program | Win/loss/draw | Chess board, opponent | Move selection | Board position |
| Self-driving Car | Safety, speed, comfort | Roads, traffic | Steering, throttle | Cameras, LIDAR, GPS |
| Medical Diagnosis | Patient health | Patient symptoms | Treatment plan | Lab tests, imaging |
| Chatbot | User satisfaction | Conversation context | Text response | User input text |
3. Types of Agents¶
3.1. Simple Reflex Agent¶
Acts based only on current percept, ignoring history.
Structure:
function REFLEX-AGENT(percept):
if percept matches condition C1:
return action A1
if percept matches condition C2:
return action A2
...Example: Thermostat - if temperature < 20°C, turn on heater
Advantages: Simple, fast, minimal memory Limitations: Cannot handle partially observable environments, no memory of past
3.2. Model-Based Agent¶
Maintains an internal state to track aspects of the world.
Structure:
function MODEL-BASED-AGENT(percept):
state ← UPDATE-STATE(state, action, percept, model)
action ← CHOOSE-ACTION(state, rules)
return actionExample: Vacuum cleaner remembering which rooms it has cleaned
Advantages: Handles partial observability, remembers history Limitations: More complex, requires accurate world model
3.3. Goal-Based Agent¶
Has explicit goal information and plans actions to achieve it.
Structure:
function GOAL-BASED-AGENT(percept):
state ← UPDATE-STATE(state, action, percept, model)
plan ← FIND-PLAN(state, goal)
action ← FIRST-ACTION(plan)
return actionExample: GPS navigation - planning route to destination
Advantages: Can plan ahead, flexible to new goals Limitations: Planning can be computationally expensive
3.4. Utility-Based Agent¶
Chooses actions to maximize expected utility (degree of happiness/success).
Structure:
function UTILITY-BASED-AGENT(percept):
state ← UPDATE-STATE(state, action, percept, model)
action ← argmax over actions of EXPECTED-UTILITY(action, state)
return actionExample: Stock trading bot - maximizing profit while managing risk
Advantages: Can handle conflicting goals, trade-offs, uncertainty Limitations: Requires utility function, more computational overhead
3.5. Learning Agent¶
Improves performance through experience.
Components:
Performance Element: Selects actions
Learning Element: Improves performance element
Critic: Provides feedback on performance
Problem Generator: Suggests exploratory actions
Example: AlphaGo - learned to play Go through self-play
Advantages: Adapts to new situations, improves over time Limitations: Requires training data/experience, may converge slowly
4. Types of Environments¶
Fully observable: The agent has access to all relevant information about the environment at all times.
Partially observable: The agent has limited access to information.
Deterministic: The outcome of an action is predictable and certain.
Stochastic: The outcome of an action is uncertain and may involve randomness.
Static: The environment does not change while the agent is deliberating.
Dynamic: The environment can change while the agent is deliberating.
Discrete: The number of possible states and actions is finite.
Continuous: The number of possible states and actions is infinite.
The characteristics of an environment significantly affect agent design:
| Dimension | Type 1 | Type 2 | Example |
|---|---|---|---|
| Observability | Fully observable | Partially observable | Chess vs. Poker |
| Determinism | Deterministic | Stochastic | Chess vs. Backgammon |
| Episodes | Episodic | Sequential | Image classification vs. Chess |
| Dynamics | Static | Dynamic | Crossword vs. Self-driving |
| State Space | Discrete | Continuous | Chess vs. Robot control |
| Agents | Single-agent | Multi-agent | Puzzle vs. Poker |
Fully Observable: Agent can see complete state (e.g., chess board) Partially Observable: Agent sees only part of state (e.g., poker - can’t see opponent’s cards)
Deterministic: Next state completely determined by current state and action Stochastic: Randomness affects outcomes (e.g., dice, unpredictable opponents)
Episodic: Each episode is independent (e.g., classifying images) Sequential: Current decisions affect future (e.g., chess moves)
Static: Environment doesn’t change while agent deliberates Dynamic: Environment changes continuously (e.g., real-time strategy games)