4.3 Agents, rationality and PEAS
Standard classical-AI course material — written August 2026
What this is and why it exists
An agent is anything that perceives and acts. Rationality is doing the best expected thing given what it knows — which is not the same as being right, and confusing the two is where most of the muddle in this area comes from. This topic also gives you the four-line description that should precede every agent design, because writing it down forces the assumptions into the open, and the design questions largely answer themselves once they are.
The vocabulary
- Agent — anything that perceives an environment and acts on it.
- Sensor — how the agent perceives; actuator — how it acts.
- Percept — one instant of sensory input.
- Percept sequence — everything the agent has perceived so far.
- Agent function — the mapping from any percept sequence to an action.
- Performance measure — the external standard for judging behaviour.
- PEAS — performance measure, environment, actuators, sensors.
The mental model
Four terms, defined precisely, make the rest of the topic tractable. An agent perceives through sensors and acts through actuators. A percept is what it perceives at one instant, and the percept sequence is the complete history of everything it has perceived. That last one carries more weight than it appears to: the percept sequence is the agent's entire basis for deciding anything. Whatever it has not perceived, it does not have. An agent choosing between two actions that look identical in its percept history must treat them as identical, however different they are in the world — which is the precise statement of why sensor design decides so much about what an agent can possibly do.
The agent function is the mapping from any percept sequence to an action. It is a specification, not an implementation: it is a table with a row for every history the agent could ever have, and the program is whatever produces the same behaviour without storing that table.
Now the definition that matters. An agent is rational when, for each possible percept sequence, it selects the action expected to maximise its performance measure, given the evidence in the percept sequence and whatever knowledge it was built with. Four things go into that judgement and leaving out any one makes it meaningless.
The performance measure, because "doing well" is undefined without a standard. The agent's prior knowledge of the environment, because an agent that could not have known something is not irrational for not acting on it. The actions available, because you cannot fault an agent for failing to do what it cannot do. The percept sequence to date, because rationality is judged on what was known at the time and not on what was learned afterwards. Change any of these four and the same behaviour changes from rational to irrational or back.
Which brings the central confusion: rationality is about decisions, not outcomes. An agent that crosses a road after looking carefully, and is struck by something that fell from an aircraft, made a rational decision and got a terrible outcome. An agent that crosses without looking and survives made an irrational decision and got a good one. A rational agent can lose, repeatedly, and remain rational — and this matters practically, because a team that judges its agent by outcomes will tune away good decisions after a run of bad luck. The word for judging by outcomes with hindsight is omniscience, and omniscience is not available; rationality is what you can actually build toward.
Two related distinctions. Rational is not perfect, since the best expected action under uncertainty is frequently wrong. And rational includes gathering information: if looking before acting is cheap and improves the expected outcome, then not looking is irrational, so exploration is part of rationality rather than a departure from it.
Then the practical instrument, which is where this topic pays off. Before designing anything, write the PEAS description: Performance measure, Environment, Actuators, Sensors. It takes ten minutes and it forces every assumption into the open.
Work the automated taxi, which is the standard example because every part of it is contested. The actuators and sensors are the parts people find comfortable — steering, acceleration, braking, signalling, a display and a voice for the passenger; cameras, radar, lidar, speedometer, satellite positioning, engine sensors, a microphone, and a keyboard or screen for the destination. Listing them is useful and not hard.
The environment is harder than it looks. Roads of every kind, in weather of every kind, with other vehicles, pedestrians, animals, roadworks, potholes, police, and local conventions that differ between cities and are frequently unwritten. Each clause is a commitment about what the system must handle, and each one you leave out is a commitment you made silently.
And the performance measure is where the real difficulty lives, which is the lesson of the exercise. The obvious candidates are getting to the destination, quickly, safely, legally, comfortably, cheaply, and without excessive fuel or emissions. They conflict: fast argues against safe and comfortable; cheap argues against both. So the measure must weigh them, and writing down the weights is writing down an ethical position, in numbers, that somebody must own. How much extra journey time is worth a given reduction in risk? Whose comfort — passenger, other drivers, pedestrians? Is a legal-but-aggressive manoeuvre acceptable? These are not questions the algorithm answers; they are questions the algorithm implements.
That is the general lesson, not a quirk of taxis. In most real agent designs, the performance measure is the contested part and the sensors and actuators are the tractable part, and teams spend their time on the tractable part because it is tractable. Write the measure first, in external terms — what should happen in the world, not what the agent should compute — and get agreement on it before anything is built. A performance measure that was never written down is one somebody chose by accident, in code, and nobody reviewed.
What you should now be able to explain or do
Define agent, sensor, actuator, percept and percept sequence, and say why the percept sequence is the whole basis for deciding. Distinguish the agent function from the program. State the four things rationality depends on and show that dropping any one makes the judgement meaningless. Argue that rationality is about decisions rather than outcomes, and say why that matters when tuning a system. Say why information-gathering is part of rationality. Write a PEAS description, and work the taxi fully. Explain why the performance measure is the hard part and why it must be written first and externally.
Check yourself
Why is the percept sequence so important?
It is the agent's entire basis for deciding. Two situations that look identical in its percept history must be treated identically, however different they are in the world — which is why sensor design decides what an agent can possibly do.
Name the four things rationality is judged against.
The performance measure, the agent's prior knowledge, the actions available to it, and the percept sequence to date. Leave out any one and the judgement has no content.
A careful agent loses badly. Was it irrational?
No. Rationality is the quality of the decision given what was known, not the outcome. Judging by outcomes is hindsight, and a team that does it will tune away good decisions after bad luck.
Is exploring rational?
Yes, when it is cheap and improves the expected outcome. If looking before acting helps and costs little, not looking is the irrational choice — information gathering is part of rationality, not an exception to it.
Which part of the taxi's PEAS description is hardest, and why?
The performance measure. Speed, safety, legality, comfort and cost conflict, so it must weigh them — and writing those weights down is writing an ethical position in numbers that somebody has to own.
Go deeper
We haven't checked most of these for screen reader use yet.
Back to Agents, rationality and PEAS: work through the checklist