How agents think and act

How agents think and act

Agents work in a loop of plan, act and observe. See how each turn of the loop moves a task forward and where it can go wrong.

Scroll, swipe or press ↓ to begin

Every agent runs the same loop: plan, act, observe

Why the loop matters

Understanding this loop is the fastest way to predict what an agent will do, and why it sometimes gets stuck.

A plan sketched out before building

Plan

The model reads the goal and everything it knows so far, then picks one next step.

Code running on a laptop screen

Act

It calls a tool, for example searching the web or updating a row in a sheet.

Observe

It reads what the tool returned and adds it to what it knows. That result feeds the next plan.

Connected apps passing work from one step to the next

Round and round

Each turn of the loop feeds the result of one action into the next plan. The loop repeats until the goal is met or a limit is reached.

One task, three turns

Here is the loop for “find this week’s unpaid invoices”:

Plan    → search the invoices sheet for "unpaid"
Act     → sheet.search("unpaid")
Observe → 4 rows found, 1 dated last month
Plan    → keep only this week's rows
Act     → filter(rows, week = this week)
Observe → 3 invoices. Goal met, stop.

Where the loop goes wrong

Agents fail in predictable ways:

  • They misread a tool result
  • They repeat the same step
  • They stop too early

How to prevent it

Clear instructions and a small set of well-described tools prevent most of these problems. Set a limit on the number of turns so a stuck agent stops.

Plan, act, observe. Repeat until done.