← All articles

AI & LLMs

How AI agents work — the reason–act loop

2026-07-29 · 6 min read

The jump from "chatbot" to "agent" sounds like it should require some radically more powerful model. It doesn't. An agent is the same language model wrapped in a loop and given tools — a way to search, run code, call an API, read a file. The intelligence isn't new; what's new is that the model can now act, look at what happened, and adjust. That loop is the entire idea.

Reason, act, observe — repeat

The pattern is often called ReAct (reason + act). Each turn, the model reasons about what it needs, chooses a tool to call, reads the result, and reasons again — looping until it has enough to answer. Instead of guessing in one shot, it works the problem in steps, using real feedback from the world at each one.

The agent loop: reason, act, observe, then answer Reason Act call a tool Observe tool result 1 · decide 2 · run 3 · feed back Answer when confident
The same model, looped. It reasons, calls a tool, observes the result, and loops — exiting to a final answer only when it has what it needs.

Why the loop matters

A plain model answers from memory alone — frozen at its training cutoff, unable to check anything, prone to confidently making things up. Give it a search tool and a loop, and it can look up the current fact, see it in the result, and answer from evidence instead of guesswork. The loop converts a one-shot guesser into something that can investigate.

The gist

An agent = model + tools + a loop. It thinks, does one thing, looks at what happened, and repeats — instead of blurting a single answer. That's what lets it use a calculator, search the web, or run your code.

What makes agents hard

  • Errors compound. A 90%-reliable step run ten times in a row succeeds only ~35% of the time. Long chains need checkpoints and recovery, not just optimism.
  • Context fills up. Every observation lands back in the context window, which is finite — long tasks force you to summarise or drop history.
  • Tools need guardrails. A model that can act can act wrongly — delete the wrong file, spend real money. Permissions and human check-ins matter.
  • Knowing when to stop. Deciding it has enough to answer — rather than looping forever or quitting early — is its own skill.

Strip away the mystique and an agent is a simple, powerful shape: a model that can take an action and learn from the result, over and over. Everything hard about building one is in making that loop reliable — the pattern itself fits in a paragraph.


AI agentsLLMToolsReAct
← Back to the blog