You have already trained a model and used it inside a program. Today the question is different: what happens when software is given a goal and allowed to plan, use tools, and act in a loop until the job is done?
That kind of software is called an AI agent. You will direct one on the board, then take turns being the agent yourselves.
A chatbot answers. You ask a question, it replies with text. The conversation stops until you type again.
An AI agent is a model given a goal. It works through four phases:
| Phase | What the agent does |
|---|---|
| Plan | It plans the steps needed to reach the goal. |
| Act | It uses tools: it writes a file, runs code, searches or sends a message. |
| Observe | It looks at what happened: an error message, a result or a web page. |
| Adjust | It adjusts the plan and tries the next step. |
It keeps looping through plan, act, observe, adjust until the goal is met or it is stopped. A chatbot waits; an agent keeps going.
Your class is about to direct an AI coding agent. One person is the error-spotter: their job is to call out when something looks wrong. Everyone else confirms the goal, predicts the next step before it happens, and names which phase is running: plan, act, observe, or adjust.
Write a short program that asks for two numbers and prints their sum. If anything breaks, fix it.
Your teacher will run a live agent on the board, or walk through a worked example one move at a time. Before each new move is shown, write or say: next phase = ? next action = ?
Plan. The agent says: "I will write a short program that asks for two numbers, adds them, and shows the total."
Predict: what tool will it use first?
Act. The agent writes this program:
a = input("First number: ")
b = input("Second number: ")
print(a + b)Predict: what will it print when someone types 3 and then 4?
Observe. It runs. The output is 34, not 7.
Error-spotter: what went wrong?
Adjust. The agent says: "The inputs were treated as text, so + joined them together. I need to convert them to whole numbers first."
Predict: what will it change in the program?
Act again. The agent changes the program and runs it with 3 and 4:
a = int(input("First number: "))
b = int(input("Second number: "))
print(a + b)Predict: what will it print now, and what will the agent do after that?
Observe. The output is 7. The goal is met, so the agent stops.
After the run, answer as a class:
You're previewing this lesson. Get full access to this lesson and hundreds more — each one ready to teach, with interactive activities, printable resources and pupil progress tracking built in.