2.1 Agents and Environments (BT104CO)

1. Defining the Agent

An agent is anything that can be viewed as perceiving its environment through sensors and acting upon that environment through actuators.

%%{init: {'theme': 'base', 'themeVariables': { 'primaryColor': '#e3f2fd', 'edgeLabelBackground':'#ffffff', 'tertiaryColor': '#ffffff'}}}%% graph LR subgraph Environment ["The External World"] State["Current State"] end subgraph Agent ["The Intelligent System"] S["Sensors"] --> Program["Agent Program \n (Processing)"] Program --> A["Actuators"] end State -- "Percepts" --> S A -- "Actions" --> State %% Styling for clarity classDef hardware fill:#bbdefb,stroke:#1976d2,stroke-width:1px,rx:5,ry:5; classDef software fill:#c8e6c9,stroke:#388e3c,stroke-width:2px,rx:10,ry:10; classDef world fill:#fff9c4,stroke:#fbc02d,stroke-width:1px,stroke-dasharray: 5 5; class S,A hardware; class Program software; class State world; class Environment world;

The Mathematical Model

The behavior of an agent is described by the Agent Function, which maps any given percept sequence to an action:

$$f: P^* \rightarrow A$$
  • $P^*$: The percept sequence (everything the agent has perceived to date).
  • $A$: The action to be performed.
Important Distinction: The Agent Function is an abstract mathematical description; the Agent Program is the actual implementation (the code) that runs on the physical architecture.

2. Sensors and Actuators

To interact with the world, an agent must have "hardware" or "software interfaces" for input and output.

👁️

Sensors

The inputs the agent uses to perceive the environment.

  • Human: Eyes, ears, skin.
  • Robotic: Cameras, infrared, GPS.
  • Software: Key presses, network packets.

Actuators

The mechanisms through which the agent performs actions.

  • Human: Hands, legs, vocal cords.
  • Robotic: Wheels, motors, screens.
  • Software: File writing, data packets.

3. The Concept of "Percepts"

A percept is the agent’s perceptual inputs at any given instant. An agent’s choice of action can depend on its percept sequence—the entire history of everything the agent has perceived so far.

Note for Exams: An agent cannot see the future, and it may only have partial observability of the current state, so it must rely on its history (percept sequence) to make the most rational choice.

4. The Environment

The environment is the world in which the agent lives and operates. It is everything "outside" the agent. The nature of the environment directly dictates the design of the agent.

Friendly & Static

Like a crossword puzzle. Agent can be simple.

Hostile & Dynamic

Like a battlefield. Agent must be sophisticated.

5. Agent Architecture

Agent = Architecture + Program
%%{init: {'theme': 'base', 'themeVariables': { 'primaryColor': '#e8f5e9', 'edgeLabelBackground':'#ffffff'}}}%% graph TD A["The Complete Agent"] --> |runs on| Arch["Architecture \n (PC, Robot Body, Server)"] A --> |executes the| Program["Agent Program \n (The actual code)"] Program -.-> |implements| Function["Agent Function \n (Mathematical Map: P* -> A)"] %% Styling for clarity classDef agentPart fill:#e1f5fe,stroke:#01579b,stroke-width:2px; classDef mathPart fill:#f3e5f5,stroke:#4a148c,stroke-width:1px,stroke-dasharray: 3 3; class A,Arch,Program agentPart; class Function mathPart;
  1. Architecture: The physical device (PC, robotic chassis, cloud server) that makes percepts available and executes actions.
  2. Program: The software that implements the agent function.

Summary of Agent Types

Agent Type Percepts Actions
Medical System Symptoms, lab results Diagnosis, treatment plan
Satellite Controller Altitude, signal strength Adjust thrusters, aim antenna
Email Filter Words, sender, attachments Mark as Spam, Move to Inbox
Vacuum Cleaner Dust levels, bump sensor Move, turn, suck up dirt

Exam Tip

Be prepared to define an agent using the $f: P^* \rightarrow A$ notation. Remember that an agent is autonomous if its behavior is determined by its own experience rather than just built-in knowledge.

Practice Quiz