The Agent Loop

Look, Decide, Act, Check, Repeat

An agent is a model running in a loop: it looks at the situation, decides the next step, acts and checks the result. Understanding the loop explains both the power and the risk.

Ranjit Nethi

·

The Agent Loop

The short version

  • An agent works in a loop: read the situation, choose the next action, carry it out, look at the result, and repeat.
  • The loop lets an agent handle tasks where the steps are not known in advance.
  • Every loop needs clear stop rules: a goal reached, a step limit, a budget limit, or a hand-off to a person.

The idea

A workflow follows a path set by a designer. An agent chooses its own path. It does this with a simple loop, often described as reason and act, or ReAct:

  1. Observe. Read the goal and everything gathered so far.
  2. Reason. Decide what to do next.
  3. Act. Call a tool: search, look up a record, run a calculation.
  4. Observe again. Read the tool’s result. Go back to step 2.

The loop ends when the agent decides the goal is met or when a limit stops it. The model supplies the judgment at each turn. The software around it runs the tools and enforces the limits.

A detective works the same way. Look at the evidence, form an idea, check one thing, see what it shows, and decide what to check next. Nobody hands the detective a script, because the path depends on what turns up.

  1. Observe
  2. Reason
  3. Act
  4. Observe the result
  5. Repeat until done or stopped

Stop conditions are the most important design choice. Without them, an agent can circle forever or spend without limit. Four are standard: the goal is confirmed, a maximum number of steps is reached, a cost or time budget is used up, or the agent meets something it must pass to a person.

An example

A logistics agent is asked, “Why is order 8841 late?” It checks the order system and sees the order has shipped. It checks the carrier and finds it was held at a hub. It reads the hold reason, which is a missing customs document. It checks the document store and finds the document was uploaded after the cut-off. It reports the cause and proposes a fix. Nobody scripted those four lookups. A step limit of 15 and read-only tools kept the investigation safe.

Common mistakes

  • No step or cost limit.
  • Letting the agent judge its own success with no outside check.
  • Starting with write tools. Begin with read-only investigation.
  • Using a loop for a task with a known, fixed path.

What to do this week

  1. For any agent you run, ask what stops it.
  2. Set a step limit and a cost limit for each task and log every time they are hit.
  3. Read ten full runs from start to end. It is the fastest way to understand what your agent really does.

The terms, in plain language

TermWhat it means
AgentA system where a model chooses its own next steps toward a goal
Agent loopThe repeated cycle of observe, reason, act and observe
ReActThe reason-and-act pattern most agents follow
Stop conditionA rule that ends the loop

Section 6.2 of the AI Engineering Guide · Last reviewed November 2026

All parts of the guideChecklists and templates

About the author

Ranjit Nethi leads AI and data for commercial operations at a global industrial manufacturer. He writes about the operating model that turns AI pilots into results finance will sign. Kellogg Executive MBA; MS in Computer Science. This site is his own perspective and view, with no affiliation with any organization.