Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

The concept of Agents and Environments

The agent is a central abstraction in AI. An agent:

  1. Perceives its environment through sensors

  2. Acts upon the environment through actuators

  3. 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:

f:PAf: P^* \rightarrow A

where (P)(P^*) 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 TypePerformanceEnvironmentActuatorsSensors
Cleaning RobotCleanliness, battery, safetyRoom, furniture, dirtWheels, vacuumCamera, dirt sensor
Chess ProgramWin/loss/drawChess board, opponentMove selectionBoard position
Self-driving CarSafety, speed, comfortRoads, trafficSteering, throttleCameras, LIDAR, GPS
Medical DiagnosisPatient healthPatient symptomsTreatment planLab tests, imaging
ChatbotUser satisfactionConversation contextText responseUser 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 action

Example: 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 action

Example: 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 action

Example: 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:

DimensionType 1Type 2Example
ObservabilityFully observablePartially observableChess vs. Poker
DeterminismDeterministicStochasticChess vs. Backgammon
EpisodesEpisodicSequentialImage classification vs. Chess
DynamicsStaticDynamicCrossword vs. Self-driving
State SpaceDiscreteContinuousChess vs. Robot control
AgentsSingle-agentMulti-agentPuzzle 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)