Lesson 9 12 min

Trace a plan–act–check loop

Trace tool results through a loop and decide when the helper should report and stop.

Learning goal

I can follow the output of a tool through an agent loop and explain how the loop ends.

How it works

An agent may plan a step, take it with a permitted tool, and inspect the result. People specify the goal, the allowed tools, and the condition for stopping or escalating. A tool can return stale data, an error, or no answer. An agent’s next step should account for those possibilities.

Think of it like this

Imagine checking two library shelves for a missing book, then telling the librarian what you saw. A person can recognise unexpected clues in the room. A computer helper sees the permitted tool outputs and has to interpret them under its limits.

Worked example

The fictional Lake Club needs this week’s charger count. The helper reads an approved list and gets last week’s number. It checks the date and tries one more approved list. The second list gives this week’s five chargers, so it reports five and stops. If the second list had no number, the same two-try limit would stop the loop and the helper would say it could not confirm a count.

What to remember

Check each result against the goal. Set a boundary for retries and report what the tool actually established.

  1. PlanFind a current count on an approved shelf list.
  2. ActRead one listed sheet.
  3. CheckDoes it include this week’s full count?
  4. Loop or stopTry one more approved sheet or report the outcome.
A tool response can change the next action. The attempt limit still applies.Plan a lookup and read an approved list. If a current complete count appears, report and stop. If the result is stale or incomplete, try once more when allowed. Report any remaining uncertainty and stop.

Key words

Agent
A system that can work toward a goal in steps, sometimes using tools. People decide which tools it can use and which actions need approval.
Stop condition
A rule that tells a helper when to end its work, such as after two tries or when a person says stop.
Reliable source
Information you have good reason to trust for a particular question. A library’s own current notice is a good source for its hours.
More AI Agents lessons

Activity

Trace both endings

Materials Paper for columns Plan, Action, Result, and Next step.

  1. Write two results: “Last week: 8 chargers”, then “This week: 5 chargers”. Trace a run with two approved lookups maximum. Say what the agent checks after each.
  2. Replace the second result with “This week: charger count missing”. Trace the run again without granting new tools.
  3. Write the message the helper should give for each ending. Decide who can check the actual shelf if the lookup fails.

Talk it through A useful failure report names which results were missing or stale. It leaves the next action to a person when the limit is reached.

Quick check

1. Which step belongs in Check?
Answer and explanation

Verify the result covers this week and includes a number. Checking means comparing the returned information with the original goal.

2. What does the helper report after two incomplete results?
Answer and explanation

That it could not confirm the current count and which lists it tried. The approved limit has been reached. The report preserves uncertainty and gives a person context.