3. Task Environments and the PEAS Framework
Source: AIMA 4th Ed, Chapter 2 (Section 2.3.1), physical PDF pp. 107–111
Introduction
Before building a rational agent, you must fully specify the problem the agent is meant to solve. Russell and Norvig call this the task environment — the formal setting in which the agent operates. The PEAS framework is the structured method for doing this specification.
The core idea: task environments are the “problems” to which rational agents are the “solutions.”
The PEAS Framework
PEAS stands for:
| Letter | Component | What it specifies |
|---|---|---|
| P | Performance measure | How is agent success evaluated? |
| E | Environment | What does the agent interact with? |
| A | Actuators | How can the agent act? |
| S | Sensors | What can the agent perceive? |
Design principle: In designing an agent, the first step must always be to specify the task environment as fully as possible using PEAS. Rushing to the algorithm before specifying PEAS is a common source of poorly designed AI systems.
Worked Example: Automated Taxi Driver (Figure 2.4)
This is AIMA’s primary extended PEAS example. It illustrates how a deceptively simple-sounding task resolves into a rich, multi-dimensional environment.
Performance Measure
The taxi should: - Get to the correct destination - Minimize fuel consumption and wear and tear - Minimize trip time or cost - Minimize traffic law violations and disturbances to other drivers - Maximize safety and passenger comfort - Maximize profits
Note that some of these goals conflict (speed vs. safety, profit vs. comfort), so the performance measure must encode tradeoffs. This is already non-trivial to specify correctly — the King Midas problem applies.
Environment
The taxi operates in: - Roads of all types: rural lanes, urban alleys, 12-lane freeways - Other traffic: cars, trucks, motorcycles, cyclists - Pedestrians and stray animals - Road works, police cars, puddles, potholes - Passengers (potential and actual) - Possibly different countries (drive on left vs. right)
The more restricted the environment is defined to be, the easier the design problem becomes.
Actuators
- Steering wheel (direction)
- Accelerator (speed up)
- Brake (slow down)
- Signal / horn
- Display screen or voice synthesizer (communicate with passengers)
- Possibly: inter-vehicle communication
Sensors
- Video cameras (multiple, for 360° vision)
- Lidar and ultrasound (distance to obstacles)
- Speedometer (speed)
- GPS (location)
- Accelerometer (forces on vehicle)
- Engine/fuel/electrical system sensors
- Touchscreen or voice input (passenger destination requests)
- Microphones
Complete PEAS table (Figure 2.4):
| Agent Type | Performance Measure | Environment | Actuators | Sensors |
|---|---|---|---|---|
| Taxi driver | Safe, fast, legal, comfortable trip; maximize profits; minimize impact on others | Roads, other traffic, police, pedestrians, customers, weather | Steering, accelerator, brake, signal, horn, display, speech | Cameras, radar, speedometer, GPS, engine sensors, accelerometer, microphones, touchscreen |
Additional PEAS Examples (Figure 2.5)
| Agent Type | Performance Measure | Environment | Actuators | Sensors |
|---|---|---|---|---|
| Medical diagnosis system | Healthy patient, reduced costs | Patient, hospital, staff | Display of questions, tests, diagnoses, treatments | Touchscreen/voice entry of symptoms and findings |
| Satellite image analysis | Correct categorization of objects, terrain | Orbiting satellite, downlink, weather | Display of scene categorization | High-resolution digital camera |
| Part-picking robot | Percentage of parts in correct bins | Conveyor belt with parts; bins | Jointed arm and hand | Camera, tactile and joint angle sensors |
| Refinery controller | Purity, yield, safety | Refinery, raw materials, operators | Valves, pumps, heaters, stirrers, displays | Temperature, pressure, flow, chemical sensors |
| Interactive English tutor | Student’s score on test | Set of students, testing agency | Display of exercises, feedback, speech | Keyboard entry, voice |
Software Agents (Softbots)
Virtual task environments can be just as complex as physical ones. A software agent (also called a softbot) operating on auction or reselling websites deals with: - Millions of users - Billions of objects (many with real images) - Dynamic pricing, competing agents, adversarial users
The PEAS description of a softbot is no less rich than that of a robot.
The Environment Class Concept
A single environment instance is rarely sufficient for evaluating agent performance. Experiments are typically run over an environment class — a distribution of environments sharing the same PEAS structure but varying in specific values (e.g., different traffic patterns, different weather, different passenger destinations for the taxi).
- Agent performance is measured as average performance over the environment class
- This prevents overfitting to a single scenario
- The aima.cs.berkeley.edu code repository provides environment simulators for exactly this purpose
Why PEAS Matters
- Prevents premature optimization. Without knowing the performance measure, you cannot even define what “better” means.
- Exposes hidden complexity. The taxi example shows that what sounds like a simple driving task involves dozens of sensors, conflicting objectives, and an adversarial multi-agent world.
- Informs algorithm choice. The PEAS description directly determines which agent architecture and algorithm family is appropriate (this is the subject of Section 2.3.2 — environment properties).
- Enables evaluation. The performance measure component of PEAS is what you use to compare agent variants in experiments.
Common Exam Questions on PEAS
- “Given agent X, write out its PEAS description” — practice with medical diagnosis, chess, spam filtering, warehouse robot
- “What performance measure would you use for Y?” — watch for Goodhart’s Law traps (measuring the act vs. the desired state)
- “How does the PEAS description change if you restrict the environment?” — e.g., taxi only in one city with perfect maps vs. globally deployed
Cross-References
- Section 2.3.2 → Environment properties (the 6 dimensions — fully observable, deterministic, etc.)
- Section 2.4 → Agent architecture selection is driven by the PEAS description
- Chapter 17 → MDPs formalize the environment component of PEAS as a transition model
- Chapter 22 → RL agents learn the performance measure from reward signals (the P component)