LAB 1Agent functions · AIMA 2.1
Agent Functions in the Vacuum World
Design a simple reflex agent for the two-square vacuum world. Edit its condition–action rules, change the environment, and inspect the percept–action sequence.
Explore: Percepts, actions, actuators, agent functions, and how the designer's rules determine behaviour.
Student guideOverview & suggested tasks
The guide walks you through the two-square world and asks you to act as the agent designer: predict what the default rules will do, change a rule, and use the log to explain the result.
What you should learn
Understand how an agent maps percepts to actions, and how its behaviour is determined by its agent function.
Suggested investigation
- Predict the default action sequence when both squares are dirty, then run the agent and compare.
- Change the rule for (A, Clean) to NoOp and explain the changed behaviour.
- Clean both squares and explain why the agent continues moving.
- Design one rule set that behaves well and one that behaves badly.
- Explain whether any assignment of the four rules can make the agent stop once both squares are clean.
Reflection / evidence
Use your observations to explain the limits of a stateless reflex agent: it cannot infer that the entire world is clean from only its current percept.
Prefer the complete instructions? Open the full student guide (Markdown).
LAB 2Rational agents · AIMA 2.2–2.3
The Same Agent, Different Performance Measures
Change the performance measure and evaluate four fixed agents over repeated runs. Observe how the ranking changes when rewards, costs, and environmental dynamics change.
Explore: Rationality, performance measures, designer choices, and why there is no context-free “best” agent.
Student guideOverview & suggested tasks
The guide frames you as the designer of the performance measure. You will predict agent rankings, adjust the reward and penalty sliders, and explain why the same agent can be rational under one measure but poor under another.
What you should learn
See that rationality is relative to a performance measure, and that the designer chooses what outcomes count as success.
Suggested investigation
- Predict the ranking of the four agents under the default measure and evaluate them.
- Increase the movement penalty until the lazy agent wins; record the settings.
- Increase the penalty for leaving dirt over time and explain which agent benefits.
- Compare the reflex and paranoid agents and explain their identical scores.
- Increase dirt respawn probability and identify the changed environment property.
- Discuss whether one measure can make all four agents equally good, and who defines success in the GAMA firefighter practical.
Reflection / evidence
Record at least one set of slider values that changes the winner, and explain what the result reveals about the designer's performance measure.
Prefer the complete instructions? Open the full student guide (Markdown).
LAB 3Simple reflex agents · AIMA 2.3–2.4.2
A Simple Reflex Agent Loses Its Way
Observe a reflex agent in a partially observable corridor. Switch sensors and motor reliability, then trace how changes in the percepts affect the agent's decisions.
Explore: Partial observability, stochastic actions, condition–action rules, and the limits of having no memory.
Student guideOverview & suggested tasks
The guide asks you to act as an analyst of a fixed agent function. You compare full and partial observability, inspect the percept and decision log, and classify the environment using the AIMA dimensions.
What you should learn
Make the limitations of simple reflex agents visible: they depend on the current percept and can fail when relevant information is unavailable or actions are stochastic.
Suggested investigation
- Run with all sensors on and explain which rule fires as the agent moves through the corridor.
- Predict what happens at the rightmost clean square, then verify using the log.
- Turn off the location sensor and trace the unknown-location percept through the rules.
- Enable the flaky motor and explain why the agent cannot detect a failed Suck action.
- Classify the environment with reliable sensors, then with partial observability and a flaky motor.
- Propose the piece of internal state that would repair the agent's failure in the fog.
Reflection / evidence
Write a short reflection comparing predicted and observed behaviour, the two environment classifications, and the memory the agent would need. This prepares Lab 4.
Prefer the complete instructions? Open the full student guide (Markdown).
LAB 4Model-based agents · AIMA 2.4.3
The Agent's Internal State vs. the True World
Compare the true environment with the agent's internal belief map. Follow the state-update process and see how an inaccurate transition model can cause belief drift.
Explore: Internal state, transition and sensor models, belief, memory, and state drift.
Student guideOverview & suggested tasks
The guide explains how the agent maintains a belief map using a transition model and a sensor model. It then asks you to audit that memory when the world behaves differently from the model.
What you should learn
Understand internal state as a concrete data structure with an update rule, and recognise that an agent's decisions depend on the quality of the models maintaining its belief.
Suggested investigation
- Run with reliable movement and predict how the belief map is updated.
- Identify where internal state, rather than the current percept, determines the agent's action.
- Explain why the agent can stop when its belief says the world is clean.
- Enable occasional movement failure and find a run where belief and reality diverge.
- Use the log to locate where the error entered the state and identify the inaccurate model.
- Propose an additional percept that could correct the drift, then connect the transition and sensor models to the GAMA firefighter.
Reflection / evidence
Submit a short reflection explaining why memory enables stopping, with a screenshot and analysis of a belief-drift episode, plus a justified repair proposal.
Prefer the complete instructions? Open the full student guide (Markdown).
LAB 5
Goal-based agents · AIMA 2.4.4
Mountain Rescue: Goal-Based Planning
Take control of a mountain rescue mission! Explore how a goal-based
agent uses breadth-first search (BFS) to find a sequence of actions
that allows a rescue robot to reach a stranded hiker, perform the
rescue, and return safely to its base.
Explore: Goal formulation, agent states, action
sequences, search, breadth-first search (BFS), planning, and
goal achievement.
Student guide
Overview & suggested tasks
In this laboratory, you will investigate a mountain rescue
scenario in which an autonomous robot must find a stranded
hiker and bring them safely back to its base. The agent must
consider its current state, represent its goal, and plan a
sequence of actions to achieve it.
What you should learn
Understand the main idea behind goal-based agents: instead
of simply reacting to the current percept, an agent uses
information about a desired future state to select actions.
You will also investigate how search and planning can be
used to find an action sequence leading to that goal.
Suggested investigation
-
Before running the agent, identify its initial state,
available actions, and goal condition. What must be true
for the mission to count as successful?
-
Select Find a plan. Inspect the explored
cells and the planned route. How does BFS explore the
environment?
-
Execute the plan step by step. Identify when the robot
reaches the hiker and when the rescue action takes place.
-
After rescuing the hiker, explain why the robot must
continue moving. Has it achieved its goal yet?
-
Activate obstacle editing and change the terrain.
Generate a new plan. How does the route change when
obstacles are added or removed?
-
Generate a new terrain and compare the resulting plans.
Does the goal change, or only the sequence of actions
needed to achieve it?
Reflection / evidence
Write a short reflection explaining what makes this agent
goal-based. Describe its initial state, goal condition, and
the role of BFS in planning. In particular, explain the
difference between reaching the hiker (an intermediate
state) and achieving the complete goal (returning to base
with the hiker rescued).
Prefer the complete instructions?
Open the interactive laboratory
.
LAB 5BGoal-based agents · AIMA 2.4.4
Vacuum Cleaner: A Goal-Based Agent
Explore how a vacuum-cleaner agent uses percepts, an internal state, a model of the world and a goal to decide what to do. Follow the agent–environment loop step by step or let the agent run automatically.
Explore: Perception, internal state, world models, action prediction, goal formulation, planning and feedback.
Student guideOverview & suggested tasks
Follow the vacuum cleaner as it observes a room, updates its internal state, predicts action consequences and selects actions to clean the room.
What you should learn
Understand how a goal-based agent considers a desired future state and uses a model of action outcomes to choose what to do.
Suggested investigation
- Identify the agent's goal and available actions before starting.
- Use Next agent step and identify the percept received by the sensors.
- Observe how the agent updates its internal state and uses its model of movement and cleaning.
- Predict what the agent will do when it is standing on a dirty cell, then run the next step.
- Run the agent automatically. Explain how each action changes the environment and leads to new observations.
- Explain why the agent needs a goal and an action model rather than relying only on a condition–action rule.
Reflection / evidence
Describe one complete perception–state update–prediction–decision–action cycle. Explain how the action changes the environment and why the agent repeats the cycle.
LAB 6Utility-based agents · AIMA 2.4.5
Medical Rescue Drone: A Utility-Based Agent
Send an emergency medical package to a remote mountain clinic. Compare three possible routes with different probabilities of success, travel times, battery costs, and incident risks.
Explore: Utility functions, conflicting objectives, trade-offs, uncertainty, outcome probabilities, and expected utility maximisation.
Student guideOverview & suggested tasks
Act as the designer of a utility function for an autonomous medical rescue drone. All routes aim to achieve the same goal—deliver the medicine—but differ in their possible outcomes. Adjust the utility weights and observe how the agent's preferred action changes.
What you should learn
Understand why goal achievement alone is insufficient when objectives conflict or outcomes are uncertain. Learn how a utility function assigns numerical values to outcomes and how an agent selects the action with the highest expected utility.
Suggested investigation
- Start with the default utility weights. Predict which route the agent will choose, then inspect the expected-utility calculations.
- Increase the penalty for an incident or loss. Does the agent change its preferred route? Explain the trade-off.
- Increase the value of successful delivery and the cost of time. Does the agent become more willing to take the direct ridge route?
- Set the time and battery costs to zero. Explain which route is preferred and why.
- Run the mission several times with unchanged utility weights. Can the agent choose the same route but obtain different outcomes?
- Design two different utility functions that lead to different route choices, while keeping the environment and route probabilities unchanged.
Reflection / evidence
Record two utility configurations that produce different decisions. Explain how the utility weights encode preferences, how probabilities affect expected utility, and why a rational agent can still experience an unsuccessful outcome.
LAB 7Learning agents · AIMA 2.4.6
Watch a Learning Agent Improve
Train a Q-learning agent in a five-by-five world. Adjust exploration and learning rate, inspect its policy, and compare its performance before and after training.
Explore: Performance element, critic, learning element, problem generator, rewards, and exploration.
Student guideOverview & suggested tasks
The guide maps the four components of a learning agent onto the running code. You compare an untrained agent with a trained one, then investigate how exploration and learning rate affect what it learns.
What you should learn
Understand how a policy can be acquired from experience, and identify the performance element, critic, learning element, and problem generator in the implementation.
Suggested investigation
- Reset the Q-table and run an episode before training; describe the initially untrained behaviour.
- Train repeatedly and compare the learning curve and behaviour before and after training.
- Increase epsilon, reset and retrain; explain the effect of heavier exploration.
- Set epsilon to zero and investigate what experiences the agent can no longer obtain.
- Compare low and high learning rates on fresh agents.
- Discuss autonomy and the missing social property, relate the components to an LLM-based assistant, and compare the Q-learner with the GAMA BDI firefighter.
Reflection / evidence
Submit a short reflection on epsilon, the problem generator, alpha, and the agent's autonomy/social properties. Include a learning-curve screenshot before and after training.
Prefer the complete instructions? Open the full student guide (Markdown).
LAB 10Learning agents · AIMA 2.4.6
Vacuum Cleaner: A Learning Agent
Train a vacuum-cleaner agent to clean a room through experience. Observe how the performance element selects actions, the critic evaluates outcomes, the learning element updates its knowledge, and the problem generator encourages exploration.
Explore: The four components of a learning agent, performance standards, reward feedback, Q-learning, exploration, and policy improvement.
Student guideOverview & suggested tasks
Use the vacuum-cleaner world to investigate the learning-agent architecture from Russell and Norvig. Train the agent, inspect its feedback and Q-value updates, and compare its behaviour before and after learning.
What you should learn
Identify the performance element, critic, learning element and problem generator, and explain how they work together to improve an agent's behaviour through experience.
Suggested investigation
- Start with the untrained agent. Execute a few actions and observe how the performance element selects them using its initial Q-table.
- Train the agent for one episode, then for 25 episodes. Compare the rewards, success rate and number of actions.
- Change the exploration parameter (ε). Explain how the problem generator affects the actions tried during training.
- Change the learning rate (α) and discount factor (γ). Discuss how these parameters affect Q-value updates.
- Test the learned policy without exploration. Compare its behaviour with the untrained agent.
- Identify the critic's feedback and explain how it is used by the learning element to update the Q-table.
Reflection / evidence
Explain the role of each of the four learning-agent components. Use observations from training and policy evaluation to discuss how feedback and exploration contribute to improved performance.
LAB 11LLM-based agents · AIMA agent architecture
Vacuum Cleaner: The LLM as a Decision-Maker
Run a small instruction-tuned language model locally in your browser. The LLM receives the vacuum cleaner's current percept and proposes one action; the JavaScript agent program validates and executes it in the environment.
Explore: LLM-based action selection, percepts, prompt construction, action parsing, sensors and actuators, local inference with Transformers.js, and the agent–environment feedback loop.
Student guideOverview & suggested tasks
Investigate a vacuum-cleaner agent whose decision-making mechanism is a small language model running locally in the browser. Inspect the percept and prompt, ask the LLM to propose an action, and decide whether to execute or discard its proposal.
What you should learn
Understand how an LLM can be embedded as the decision-making mechanism inside the agent program described by Russell and Norvig. Distinguish the model's proposed action from the JavaScript actuator that validates and executes it.
Suggested investigation
- Inspect the agent architecture diagram. Identify the environment, sensors, agent program and actuators.
- Display the current percept and explain which information is available to the LLM—and which information is not.
- Request an action. Compare the prompt, raw model response and parsed action.
- Execute the proposal and observe how the environment changes and produces a new percept.
- Try several decisions and record invalid actions, wall collisions, actions taken and task completion.
- Compare this LLM decision-maker with the explicit goal-based and Q-learning vacuum-cleaner agents from Labs 5B and 10.
Reflection / evidence
Explain which part of the Russell and Norvig agent architecture is implemented by the LLM and which parts are implemented by the surrounding JavaScript. Discuss at least one strength and one limitation of using an LLM for action selection.
LAB 12Knowledge-based agents · AIMA 2.4
Inside a Knowledge-Based Agent
Operate a simple knowledge-based assistant for a district-heating plant. Change sensor observations, add new percepts to the knowledge base with TELL, and use ASK to retrieve relevant knowledge and select an action.
Explore: Percepts, knowledge bases, facts, IF–THEN rules, TELL, ASK, action selection, and the limits of incomplete knowledge.
Student guideOverview & suggested tasks
Investigate how a knowledge-based agent receives information from its environment, stores relevant facts, applies rules, and recommends an action. The laboratory follows the agent architecture discussed in the lecture and uses a synthetic district-heating plant scenario.
What you should learn
Understand the roles of percepts, the knowledge base, TELL and ASK. Explain how an agent can use a limited set of facts and rules to make a task-specific recommendation without representing every aspect of its environment.
Suggested investigation
- Change the pressure, sensor reliability, independent confirmation, and temperature settings. Generate a percept and describe what the agent receives from its sensors.
- Press TELL. Inspect the knowledge base and identify which new facts have been added.
- Press ASK. Identify the rule used by the agent and explain how it supports the recommended action.
- Run the four predefined experiments. Compare the recommendations when the pressure sensor is reliable, unreliable, or independently corroborated.
- Change one environmental condition at a time. Explain which change causes the agent to select a different action.
- Consider whether the agent needs a complete representation of the plant to answer its current question. Explain what happens when relevant information is missing.
Reflection / evidence
Describe one complete percept–TELL–ASK–action cycle. Explain the difference between adding knowledge and querying knowledge, identify the rule behind one recommendation, and discuss why the agent needs relevant knowledge rather than a complete model of the plant.