Skip to content
mentoor

Topic 3 of 5 · 3 min read

How an agent plans, acts and checks

Goal: Trace an agent's run log and name the goal, each action, the check on its result and the stop decision.

An agent is an assistant that you give a goal instead of a question: it plans steps, uses tools, looks at what happened, and repeats until it decides the goal is met or it should stop. The key difference from a tool-using assistant is the loop. The agent chooses its own next step.

Check yourself · 1 of 3

What mainly separates an agent from an assistant that can call tools?

Choose one answer

Why it matters

An agent can finish a job that would take you an hour: gather sources, compare prices, fix a failing test. But you are no longer reading every step as it happens. To trust the result, you need to know how it works and how to read what it did.

The loop

  1. Goal. What you asked for, in your words: "Find three laptops under 900 dollars with 16 GB of memory and compare battery life."
  2. Plan. The agent breaks the goal into steps. It may rewrite the plan as it learns more.
  3. Act. It calls a tool: search, open a page, run a command, edit a file.
  4. Check. It reads the result. Did the page load? Did the test pass? Does this match the goal?
  5. Decide. Continue, change course, ask you, or stop.

Examples you may meet: a browser agent that clicks through websites, a research agent that reads dozens of pages and writes a report, and a coding agent that edits files and runs tests. Names differ across Claude, ChatGPT, Gemini, Copilot and Cursor, but the loop is the same.

Reading a run log

Most agents show a log. Look for the goal at the top, then each action with its result, then a final stop. Ask three questions: Did each action serve the goal? Did the agent check its result or just move on? Why did it stop?

Before and after

Weak log: Step 1: Searched. Step 2: Wrote report. Done. (No check on whether the sources were any good.)

Better log: Step 1: Searched. Step 2: Opened 4 pages. Step 3: Two pages were forum posts, so dropped them. Step 4: Wrote report with 2 sources and said that the data is thin.

What goes wrong

  • Declaring success too early. The agent says "done" when a test was skipped or a page failed to load.
  • Loops. It repeats the same failing step many times and burns time and money.
  • Drifting from the goal. Small wrong turns add up over many steps. Each step builds on the last, so an early error spreads.
  • Hiding uncertainty. The summary reads smoothly even when the log shows trouble. Read the log, not just the summary.

Examples

A short run log

Goal: Find why the signup test fails.

  1. Ran the test. Result: failed, error on line 42.
  2. Opened the signup file. Found a missing field.
  3. Added the field. Re-ran the test. Result: passed.
  4. Stopped: the goal is met.

The goal is clear, each action has a result, step 3 checks the fix by re-running, and step 4 gives a reason for stopping.

A log with a gap

Goal: Book the cheapest morning flight.

  1. Searched flights.
  2. Picked the first result.
  3. Done.

There is no comparison and no check that the flight is the cheapest or in the morning. The agent stopped without testing its answer against the goal.

Key points

  • An agent takes a goal and chooses its own steps in a loop of plan, act, check and decide.
  • Browser, research and coding agents differ in tools but share the same loop.
  • A good run log shows each action, its result, a check against the goal and a reason for stopping.
  • Early errors spread because every later step builds on the earlier ones.
  • Read the log and not only the final summary, because summaries hide trouble.

Common mistakes

  • Reading only the final summary and skipping the log.
  • Giving a vague goal, so the agent has no way to know when it is finished.
  • Assuming a step was checked because the agent moved on.
  • Letting a stuck agent keep retrying instead of stopping it.

Check yourself · 2 of 3

In a run log, an agent runs a test and sees it fail. What should the next logged step show if the agent is working well?

Choose one answer

Check yourself · 3 of 3

You read a research agent's log: it searched, wrote the report and stopped. It never opened a page or compared sources. What is the main concern?

Choose one answer

Practice items, not counted towards your mastery.

Start here