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:
- Observe. Read the goal and everything gathered so far.
- Reason. Decide what to do next.
- Act. Call a tool: search, look up a record, run a calculation.
- 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.
- Observe
- Reason
- Act
- Observe the result
- 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
- For any agent you run, ask what stops it.
- Set a step limit and a cost limit for each task and log every time they are hit.
- 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
| Term | What it means |
|---|---|
| Agent | A system where a model chooses its own next steps toward a goal |
| Agent loop | The repeated cycle of observe, reason, act and observe |
| ReAct | The reason-and-act pattern most agents follow |
| Stop condition | A rule that ends the loop |
Further reading
Section 6.2 of the AI Engineering Guide · Last reviewed November 2026




