II · THE IDEA · ARTIFICIAL INTELLIGENCE
Agents
▶ Listen · narrated
One bad step in a chain of reasoning costs you the answer. One bad step in a loop costs you only that iteration, provided the agent notices.
At a glance
- What it is
- A system that repeatedly calls a language model to observe state, reason about it, then take an action
- Core structure
- Loop: read environment, generate reasoning and action, execute action, observe result, repeat
- Error behaviour
- Errors compound across iterations; short loops with feedback limit damage
- ReAct contribution
- Interleaving explicit reasoning traces with actions, rather than planning then acting
Imagine you are assembling furniture with instructions that only reveal one step at a time. You read step one, do it, then the instructions show you step two based on what you actually built — not what the manual assumed you would build. If you put a bolt in the wrong hole, step two might say "remove the bolt from the left hole and use the right one" because it can see what you did. An agent works the same way: it asks the language model for the next action, does that action, shows the model what happened, and asks again. The model never sees the whole plan upfront. It decides each step after learning whether the previous step worked, which means a mistake in step three does not ruin steps four through ten — because those steps have not been decided yet. The model gets to adjust. The trade-off is that you are asking the model to make more decisions, and each one is a chance to go wrong, so agent systems usually add limits: a maximum number of steps, checks that the model is not hallucinating success, and sometimes a human watching to press stop if things drift too far off course.
An agent is an orchestration loop around a language model. The loop maintains a prompt that accumulates task description, action history, and observations. On each iteration, it calls the model to generate a reasoning step and an action, parses the action from the model's output (typically using a fixed format or a lightweight parser), executes that action by calling a tool or API, captures the result, appends it to the prompt, and calls the model again. The model itself is stateless between calls; all continuity lives in the prompt. ReAct demonstrated that interleaving explicit reasoning traces with actions improves performance on multi-step tasks compared to either reasoning alone (chain-of-thought) or acting without reasoning. The reasoning step serves two purposes: it helps the model maintain coherence across iterations, and it provides an auditable trace of the agent's decision process, though research suggests these traces are not always faithful to the actual mechanism. The primary failure mode is compounding error: if the model misinterprets an observation, generates an invalid action, or hallucinates success, the next iteration starts from corrupted state. Mitigation strategies include hard iteration limits, schema validation on tool outputs before they re-enter the prompt, and retry logic that catches malformed actions before execution. In production systems, the loop is usually instrumented with logging, cost tracking (since each iteration is a model call), and breakpoints for human review. The agent's capability is bounded by the model's capability and the quality of the loop's error handling. A better model helps, but a careless loop will waste it.
Look closer
The model generates both the reasoning and the action
In the ReAct formulation, the model outputs a thought — an explicit reasoning step written in natural language — then an action, such as calling a search tool or manipulating a file. That thought is not just for human inspection; it becomes part of the prompt on the next iteration, so the model sees its own reasoning history. This differs from earlier approaches that separated a planning phase from an execution phase. Here, thinking and acting interleave, and the model can revise its plan as new observations arrive.
Short loops beat long plans in practice
A model asked to generate a ten-step plan upfront will produce something plausible, but each step depends on assumptions about what earlier steps will yield. If step three fails or returns unexpected data, steps four through ten may become nonsensical. A loop that decides only the next action, observes the result, then decides again confines each error to one iteration. The cost is more model calls, but the benefit is that the agent can adapt. This is why agent systems tend to favour narrow action spaces and frequent check-ins over elaborate advance planning.
The loop is not the model; the loop is code around the model
The language model itself has no memory between calls and no ability to execute actions. The agent system — written in Python, JavaScript, or another host language — maintains the loop, appends observations to the prompt, parses the model's output to extract actions, calls external tools, and decides when to stop. If that orchestration code has a bug, or if it fails to validate tool outputs, the model cannot fix it. The model only sees text; the agent system is what makes that text consequential.
The story
An agent is a language model wrapped in a loop. The model does not act on the world directly; it generates text that describes an action, and code outside the model executes it. Then the loop runs again, feeding the result back as a new observation.
The canonical structure, formalised in the ReAct paper by Yao and colleagues, looks like this: the model receives a prompt containing the task, the history so far, and the most recent observation. It generates a reasoning step — a sentence or two explaining what it thinks should happen next — then an action, such as "search for population of France" or "read file data.csv". The agent system parses that action, calls the appropriate tool, captures the result, appends it to the history, and calls the model again. The model now sees its own previous reasoning, the action it chose, and the outcome. It decides what to do next.
This differs from asking a model to generate a complete plan upfront. A plan written in advance assumes each step will succeed and return the expected information. When reality diverges — a file is missing, a search returns nothing useful, an API times out — the rest of the plan becomes wishful thinking. The agent loop adapts because it observes after every action. If the model searches for "France population 2023" and gets back a disambiguation page, it can refine the query on the next iteration. If it tries to open a file that does not exist, it can list the directory instead.
The price is compounding error. Each iteration depends on the model correctly interpreting the previous observation, generating sensible reasoning, and formatting a valid action. If any of those steps fails, the next iteration starts from a flawed state. The model might misread a number, call a tool with malformed arguments, or hallucinate that an action succeeded when the observation says it failed. The loop continues, and the errors accumulate. This is why short loops with tight feedback are safer than long autonomous runs: fewer iterations mean fewer opportunities for drift.
The ReAct paper demonstrated that interleaving reasoning and acting outperformed both pure reasoning (chain-of-thought prompting with no actions) and pure acting (choosing actions without explicit reasoning steps) on question-answering and decision-making benchmarks. The reasoning traces helped the model stay coherent across multiple steps, and the ability to act let it retrieve information it could not generate from memory alone. But the improvement was modest, and the error rate rose with the number of iterations.
Agent systems in practice often add guardrails: hard limits on loop iterations, validation of tool outputs before they re-enter the prompt, and human-in-the-loop checkpoints for high-stakes actions. The loop is powerful because it lets a model recover from mistakes, but it is also fragile because every cycle is a chance to fail in a new way.
Why it mattered then
The ReAct paper, published in 2022, arrived at a moment when large language models had demonstrated strong reasoning ability in static prompts — chain-of-thought techniques were showing that models could solve multi-step problems if you asked them to show their work — but there was no established method for letting them interact with tools or data sources during that reasoning. Earlier agent architectures, often built on reinforcement learning, required task-specific training and did not generalise well. ReAct showed that a pre-trained language model, given nothing but a prompt format that alternated reasoning and acting, could learn to use tools effectively from a handful of examples. This mattered because it suggested that the same models being used for text generation could, with the right scaffolding, perform tasks that required looking things up, running code, or manipulating files. It moved the bottleneck from model capability to system design: the question was no longer whether a model could act, but how to structure the loop so that it acted reliably.
Why it matters now
Agent systems are now a standard deployment pattern for language models in production. They power coding assistants that read documentation and run tests, customer service bots that query databases and update records, and research tools that search papers and synthesise findings. The loop structure has become infrastructure: frameworks like LangChain and AutoGPT codify it, and cloud providers offer agent orchestration as a service. But the core fragility remains. Every agent system in production has to solve the same problems: how many iterations to allow before giving up, how to validate tool outputs so hallucinated success does not propagate, and how to surface the reasoning trace so a human can audit what went wrong. The agent is still not autonomous in the sense of being trustworthy without oversight. It is autonomous in the narrower sense that it can try things, observe the results, and try again — which turns out to be useful enough, and risky enough, that the design of the loop now matters as much as the capability of the model inside it.
The surprising detail
The reasoning traces that agents generate — the "thought" step in ReAct — are not reliably faithful to the model's actual decision process. The model generates the reasoning as text, in the same forward pass that generates the action, and there is no guarantee that the reasoning caused the action rather than being a plausible post-hoc rationalisation. In some experiments, researchers have found that removing or scrambling the reasoning trace in the prompt history has little effect on subsequent actions, suggesting the model is not always reading its own reasoning as carefully as the system designers assumed. This matters because agent systems often log and display these traces as explanations, and users may trust them more than they should. The thought is part of the output, not a window into the mechanism.
Remember this
An agent is a loop, not a model. The loop decides when to stop, what to retry, and which errors to tolerate. Design the loop badly and the model cannot save you.
Test yourself
An agent runs for twelve iterations and solves the task. On iteration seven, it called a search tool with a slightly malformed query, and the tool returned an error message. Why might the agent have succeeded anyway?
Because the loop gave it another chance. The model saw the error message as the observation on iteration eight, generated new reasoning that acknowledged the failure, reformulated the query, and tried again. A single mistake in a loop costs one iteration; a single mistake in a chain of reasoning costs the entire answer. This is the agent's advantage and also its risk: it can recover from errors, but only if it correctly interprets the observation that signals the error occurred. If the model misreads the error message as success, or generates reasoning that ignores it, the mistake propagates and the agent continues from a false premise.
Go deeper
- ReAct: Synergizing Reasoning and Acting in Language Models · arXiv · Shunyu Yao et al. · 2022-10-06
- A Survey on Large Language Model based Autonomous Agents · arXiv · Lei Wang et al. · 2023-08-22
Image: Original diagram, The Daily Triptych. Licence: Original work. Source.