Intelligent agents and rationality
Concise, exam-focused notes on intelligent agents and rationality: definitions, agent types, PEAS, expected utility, worked examples, common pitfalls and exam tips.
Drafted with Aria, reviewed by the AiCanCode.org team · Updated . How we write and check our notes. Spotted an error? Use Give Feedback at the bottom of the page.
Why it matters
Intelligent agents are the basic engineering abstraction in AI: every autonomous system (robot, software bot, smart sensor) is designed as an agent that perceives and acts to achieve goals. Understanding rationality and agent architectures helps an engineer choose the right design (simple reflex, model-based, goal-based, utility-based, learning) and the right performance measure for a real system.
Key ideas
Start from first principles and build up the formal definitions used in university answers.
Agent: a computing system that perceives its environment through sensors and acts upon that environment through actuators. Use this when describing any autonomous system.
Percept: a single sensor input at one time. A percept sequence is the complete history of all percepts up to now. Always define percept sequence before using it in formulas.
Agent function: a (mathematical) mapping from percept sequences to actions. Write it exactly as: f: P* -> A, where P* is the set of all possible percept sequences and A is the set of actions. In answers draw a box labelled "Agent function f" with an arrow from "Percept sequence (P*)" and an arrow out to "Action (A)".
Agent program: the concrete implementation (code, rules, network) that computes the agent function on a physical machine.
Performance measure: a task-specific scoring function defined by the designer that evaluates the agent's behaviour over an environment run. Always state the performance measure when you define rationality.
Rational agent (exact statement used in exams): A rational agent is one that, for each possible percept sequence, selects the action that is expected to maximize the performance measure, given the agent's built-in knowledge and its percept sequence. Explicit assumptions: performance measure is known to designer; agent's knowledge and percepts are those available; expectations are computed under agent's current beliefs. The theoretical definition does not assume resource limits; in practice we discuss bounded rationality when computation (time/memory) constrains choice. Rationality is not omniscience: an agent can be rational yet unlucky; it is judged by expected performance given the available evidence, not by actual outcomes.
Autonomy: the degree to which an agent's behaviour depends on its own experience rather than on built-in knowledge. There is no standard numeric formula for autonomy; treat it qualitatively (more experience-driven behaviour implies higher autonomy). Use this qualitatively in answers.
Bounded rationality: realistic agents cannot always compute the theoretically best action because of time, memory, or computational constraints. State it when an exam asks about limitations of rationality.
PEAS framework: describe a task by listing Performance measure, Environment, Actuators, Sensors. In answers draw a 4-box list labelled PEAS and fill items for the problem.
Types of agent architectures (define each before use):
- Simple reflex agent: selects actions using condition-action rules that depend only on current percept. Suits fully observable, simple environments.
- Model-based reflex agent: keeps an internal state to represent unobserved aspects of the current world, updates it based on percepts and model of how the world evolves, then uses rules.
- Goal-based agent: uses a goal description and searches for sequences of actions to reach the goal; decisions based on goals, not just rules.
- Utility-based agent: has a utility function mapping states (or state histories) to real numbers and selects actions that maximize expected utility. This generalises goal-based agents when trade-offs or uncertainty exist.
- Learning agent: contains a learning element that improves the agent program over time from feedback.
Expected utility principle (definition): under uncertainty, rational decisions should maximise expected utility (EU). Write and derive the expected utility formula when needed (see Formulas).
Environment properties to state and define: observable vs partially observable, deterministic vs stochastic, episodic vs sequential, static vs dynamic, discrete vs continuous, single-agent vs multi-agent. For each, give the exact definition (e.g., partially observable: agent's sensors give incomplete information about the environment's true state).
Diagrams to draw in exams (describe exactly):
- Agent diagram: draw a box "Agent" at center, left arrow from box labelled "Sensors" pointing to box, right arrow from box labelled "Actuators" leaving box, surrounding box label "Environment". Inside box write "Agent function f: P* -> A".
- PEAS table: a 2x2 table with rows labelled Performance measure and Environment, columns Actuators and Sensors; fill with the task-specific items.
Assumptions behind main definitions:
- Rationality assumes the performance measure correctly captures designer goals.
- Expected utility assumes probabilistic beliefs over states are available and utilities are comparable.
- Agent function definition assumes percept sequences and action sets are well-defined; they may be very large or infinite (discrete or continuous).
If an exam asks for derivations, show the step-by-step link: rational agent -> need to compare actions under uncertainty -> define belief distribution over outcomes -> compute expected utility for each action -> choose action with maximum expected utility.
Formulas
f: P* -> A — agent function mapping from percept sequences to actions; P*: set of all percept sequences; A: action set. Unit: not applicable. Applies in all agent definitions.
EU(a) = sum_s P(s | a, e) * U(s) — expected utility of action a given evidence/percept sequence e. Here EU(a) is the expected utility (unitless), sum over possible resulting states s, P(s | a, e) is the probability (unitless) that state s results if action a is taken given percepts e, and U(s) is the utility of state s (real number, unitless). Applies when outcomes are discrete and utilities are defined for resulting states under uncertainty.
argmax_a EU(a) — the rational decision rule: choose the action a that maximises expected utility. Unitless. Applies when computing rational choice under uncertainty.
P(h | e) = P(e | h) * P(h) / P(e) — Bayes' theorem for updating belief in hypothesis h given evidence e. P(...) are probabilities (unitless). Use when agent updates beliefs from percepts.
Performance = measure(Run) — not a numeric formula but a reminder: performance is a function evaluating the whole episode/run. Unit depends on measure (e.g., time in seconds, score points). State units when giving a concrete performance measure.
Worked examples
Example 1 — Vacuum world: simple reflex vs model-based Question (model answer): A two-room vacuum environment: rooms A and B, each can be Clean or Dirty. Agent perceives current room and its status only. Actions: Suck, Left, Right, NoOp. PEAS: Performance = +10 for each square the agent cleans the first time, -1 per move, -100 if any square remains dirty after 100 steps (example). Show how a simple reflex agent fails if percepts are only current room, and how model-based agent succeeds. Answer (step-by-step):
- State definitions: Rooms = {A,B}. Percept at time t: (location, status).
- Simple reflex rule set (example): IF status = Dirty THEN Suck ELSE IF location = A THEN Right ELSE Left.
- Show failure: Suppose at t0 agent in A, status Clean, rule sends Right to B. After cleaning B and returning, if agent has no memory it will oscillate unnecessarily. Explain in 4 sentences.
- Model-based fix: maintain internal state variable Cleaned = {rooms believed clean}. Update rule: when Suck produces Clean percept, add room to Cleaned. When both rooms in Cleaned, choose NoOp. Show the internal-state update rule: Cleaned := Cleaned ∪ {currentRoom} if percept.status = Clean. This avoids unnecessary movements and increases performance measure.
Example 2 — Utility-based decision under uncertainty (numerical) Question: An agent must choose between two actions a1 and a2. If a1 is taken, with probability 0.7 the outcome s1 occurs with utility 100, otherwise s2 occurs utility 0. If a2 is taken, with probability 0.4 s1 occurs (utility 100) else s3 occurs (utility 30). Which action is rational? Compute expected utilities. Solution (numbered steps):
- Write formula: EU(a) = sum_s P(s|a) * U(s).
- EU(a1) = 0.7 * 100 + 0.3 * 0 = 70.
- EU(a2) = 0.4 * 100 + 0.6 * 30 = 40 + 18 = 58.
- Compare: 70 > 58, so choose a1. Final answer: Choose a1 (expected utility 70).
Note: utilities are unitless scores; if performance measure had units (seconds, energy), convert to a comparable utility scale first.
Worked example 3 — Bayes update for belief state (short) Question: Agent initially believes a room is dirty with prior 0.2. Sensor returns "Dirty" with reliability: P(sensor=D | dirty)=0.9, P(sensor=D | clean)=0.2. Compute posterior P(dirty | sensor=D). Solution:
- Use Bayes: P(dirty | D) = P(D | dirty)P(dirty) / [P(D | dirty)P(dirty) + P(D | clean)P(clean)].
- Numbers: numerator = 0.90.2 = 0.18. Denominator = 0.18 + 0.20.8 = 0.18 + 0.16 = 0.34.
- Posterior = 0.18 / 0.34 = 0.5294 (approx).
- Final answer: P(dirty | sensor=D) ≈ 0.529.
Common mistakes
- Applying expected utility without defining or normalising utilities to the same scale.
- Assuming deterministic outcomes where the environment is explicitly stochastic.
- Omitting computation limits when claiming an agent is "rational" — mention bounded rationality if relevant.
- Using Bayes without stating or computing normalization denominator.
- In PEAS descriptions, swapping Sensors and Actuators or leaving out the performance measure.
For your exam
Types of questions you will see: precise definitions, short notes comparing agent types, derivations of EU rule, simple Bayes updates, PEAS descriptions for given tasks, diagram-drawing (agent box, PEAS table), and short programs or pseudocode for simple reflex/model-based agents. What a full-marks answer includes:
- Clear definitions of all bold terms used (agent, percept, agent function, rationality, utility).
- Explicit PEAS specification for any task question.
- Correct diagram with labelled sensors, actuators, agent and environment.
- When asked to compute, show each formula line, substitute numbers, carry units (if any), and give final answer bolded.
- If uncertainty is involved, compute expected utilities and show argmax choice.
- If learning or resource limits matter, state bounded rationality and practical trade-offs.
Quick check
- Define "agent function" in one line.
- Write the formula for expected utility and explain what each symbol means (short).
- If an agent has prior P(h)=0.1 and P(e|h)=0.8, P(e|¬h)=0.2 and sensor reports e, what is P(h|e)? (compute numerically)
Answers: 1) Agent function f is the mapping f: P* -> A from percept sequences to actions. 2) EU(a) = sum_s P(s | a, e) * U(s) where P(s | a, e) is the probability of resulting state s given action a and evidence e, and U(s) is the utility of s. 3) P(h|e) = (0.80.1) / (0.80.1 + 0.2*0.9) = 0.08 / (0.08 + 0.18) = 0.08 / 0.26 ≈ 0.3077.
Finished this topic? Mark it so your progress, study plan and readiness keep up.
Stuck on something here?