The LLM reasoning engine in an AI agent is the large language model at the centre of the loop: the component that reads the goal, the current context, and the latest observations, and decides what should happen next. It does not run code, call an API, or write to a file itself. It produces a decision — an answer, a plan, or a structured request to call a tool — and the surrounding software, often called the harness, turns that decision into action and feeds the result back for the next decision. Failures blamed on the model can involve what the harness showed it, what tools it was given, or when the loop was allowed to stop.
What the LLM reasoning engine means in an AI agent
Anthropic’s building block for agentic systems is an LLM enhanced with retrieval, tools, and memory. In that account, current models can actively use those capabilities: generating their own search queries, selecting appropriate tools, and determining what information to retain. The model is a reasoning engine only in combination with those augmentations. A bare model given a single prompt can answer a question, but it cannot pursue a goal over several steps, because it has no way to act or to learn what its actions produced.
The harness is everything around the model that makes the loop possible. It assembles the context for each call, parses the model’s output, executes any tool call requested, stores state, enforces timeouts and budgets, applies policy checks, and logs what happened. Anthropic draws the distinction that matters between workflows and agents: in a workflow, LLMs and tools are orchestrated through predefined code paths, while in an agent, the LLM dynamically directs its own process and tool usage, maintaining control over how it accomplishes the task. The same model can sit in either arrangement. What makes it a reasoning engine in the agent sense is that the harness hands it control of the next step, again and again, until the task ends. The model’s output is a request the harness must validate and execute, not the action itself.
How the LLM reasoning loop works, step by step
Anthropic describes agents as typically just LLMs using tools based on environmental feedback in a loop. One iteration has the same shape in almost every implementation. First, the harness assembles the context: the goal, system instructions, conversation and tool history, tool definitions, and retrieved information. Second, it calls the model. Third, it parses the reply, which is either a final answer or a request to use a tool, sometimes with reasoning text. Fourth, if a tool was requested, the harness executes it and captures the result as an observation. Fifth, the observation is appended to the context, and the loop repeats with a fresh call that can reason with the new fact in hand.
Two points keep the loop honest. Agents should gain ground truth from the environment at each step — tool-call results or code execution — so they can assess their progress rather than reasoning only from what they generated themselves. And stopping conditions, such as a maximum number of iterations, are commonly included to maintain control. A loop with no stopping condition trusts the model’s claim that it is finished, or trusts that it will eventually decide to stop. The stopping rule belongs to the harness, in code, where it is counted rather than requested. Take a simple pass through the loop: asked to summarise a document and email the result, the model first requests a read tool, sees the document as an observation, then produces a summary and requests the send tool — or pauses for human approval. If the send fails, the next call sees the error and can revise its plan instead of announcing success it never achieved.
How the LLM decides the next action
Inside a single call, the decision has three parts: interpret the goal, break it into a next step, and choose how to act. Goal decomposition comes first. A large goal — resolve a support ticket, fix a failing test — is rarely actionable in one step, so the model must induce a plan: what information is missing, which sub-tasks come first, and what would count as done. Anthropic’s orchestrator-workers pattern makes this explicit at a larger scale, with a central LLM that dynamically breaks a task down, delegates the pieces to worker LLMs, and synthesises the results, choosing subtasks from the input rather than a predefined list.
Tool selection is shaped by what the harness put in context. The model sees tool definitions — names, descriptions, and parameter schemas — and chooses among them or answers directly. Anthropic insists that tool definitions deserve as much prompt-engineering attention as the overall prompt: a vague description, an overlapping name, or an unclear parameter format can lead to a tool being chosen wrongly or filled wrongly, and cleverness in the system prompt alone may not compensate for a poor action space. Structured output then turns the choice into something executable. In function calling, the developer describes functions using JSON Schema and the model outputs a JSON object containing the arguments for the function it wants called. The fragment below shows that shape — a schema excerpt, not a complete program — for a tool that looks up an order:
{
"type": "function",
"function": {
"name": "search_orders",
"description": "Look up an order by its order ID and return its status.",
"parameters": {
"type": "object",
"properties": {
"order_id": {"type": "integer", "description": "The numeric order ID, for example 42."}
},
"required": ["order_id"],
"additionalProperties": false
},
"strict": true
}
}With Structured Outputs turned on, using strict set to true, OpenAI’s help documentation states that the arguments generated by the model for function calls are guaranteed to match the JSON Schema supplied. Without that guarantee, the structure of the arguments is not guaranteed to be correct, and the same documentation recommends validating arguments first, for example with a validation library, before using them. The harness must treat arguments as untrusted input: validate them, check them against what the tool accepts, and return an error the model can recover from if they do not fit.
Reasoning patterns that shape the loop

The loop is a skeleton; reasoning patterns organise the model’s reasoning inside it. The best documented pattern is ReAct, from Yao and colleagues in 2022. ReAct generates reasoning traces and task-specific actions in an interleaved manner: a free-form reasoning trace, then an action, then an observation, then the next trace. In the paper’s abstract, reasoning traces help the model induce, track, and update action plans as well as handle exceptions, while actions allow it to gather additional information from external sources. The trace is where the model records its plan, extracts key points from an observation, notices a failed approach, and changes course — and because it is preserved in context, a human can follow why each action was chosen. The trajectory below shows the format, with an illustrative example rather than a real run:
Thought: I need the current status of order 42 before I can answer, so I will look it up.
Action: search_orders[order_id=42]
Observation: The order shipped yesterday and is due to arrive on Tuesday.
Thought: I now have the status. No further tool is needed; I can answer directly.
Action: finish[Order 42 shipped yesterday and is due to arrive on Tuesday.]ReAct’s reported results give the pattern weight, and its limits. On question answering (HotpotQA) and fact verification (FEVER), the paper reports that ReAct overcame hallucination and error-propagation issues prevalent in chain-of-thought reasoning by interacting with a simple Wikipedia API, producing more interpretable trajectories than baselines without reasoning traces. On ALFWorld and WebShop, it outperformed imitation and reinforcement learning methods by an absolute success rate of 34% and 10% respectively, while being prompted with only one or two in-context examples. Those are 2022 benchmark results for the pattern as evaluated, not a promise about any agent today, and they were achieved by interacting with a real environment rather than reasoning from generated text alone.
Two other arrangements are grounded in Anthropic’s workflow patterns. Orchestrator-workers suits complex tasks where subtasks cannot be predicted in advance, such as coding changes across many files. Evaluator-optimizer, in which one call generates a response and another evaluates it and feeds back in a loop, fits when evaluation criteria are clear and iterative refinement measurably helps. Neither is a different kind of reasoning engine; both arrange model calls around the same loop. This research did not establish a separate named plan-then-execute pattern distinct from orchestrator-workers, or a generic self-reflection mechanism distinct from evaluator-optimizer, so this article does not present either as an established pattern.
What the LLM needs in context to reason well
Reasoning quality also depends on the context the harness assembles, alongside the model chosen. System instructions are the standing rules for every decision in the run: role, boundaries, what must never happen without approval, and how to report uncertainty. Tool definitions are the model’s action space: clear names, descriptions written like documentation for a junior developer, example usage, edge cases, input formats, and clear boundaries from neighbouring tools. Memory and observations supply the past. The model is stateless between calls and remembers nothing unless the harness hands it the past: short-term context from the current run, and retrieved long-term context for what the run never saw.
Both can affect the next decision. A huge tool result, an error with no useful detail, or a history so long that it crowds out the original goal may weaken reasoning, even with a capable model. Anthropic’s agent-computer interface guidance captures the remedy: invest in the interface between model and tools with the care given to a human-computer interface, test how the model actually uses the tools over many example inputs, and design arguments so mistakes are hard to make.
Where LLM reasoning breaks down

Failure modes are recognisable in traces, and the documented examples below show how inputs, tools, and controls can each contribute. Repetition loops happen when an observation carries no new information, leaving the context effectively unchanged, so the model’s best next guess is the same guess as last time and the same tool is called with the same arguments until a step limit intervenes. Hallucinated tool calls happen when the task needs a capability that does not exist and the model invents a plausible name instead of concluding it cannot proceed; the fix is partly to list available tools in the error the model sees, and partly to instruct it to say so rather than guess. Malformed output — narrating intent instead of emitting the required format — is a documented failure pattern. Structured output and schema validation exist to catch it before execution.
Wrong termination affects trust directly: answering too early, claiming work is done when a step never ran, or never deciding the task is finished. A study of multi-agent systems reported by Amplitude found step repetition in 15.7% of failure modes and unawareness of termination conditions in 12.4%, across 1,642 annotated traces. Those figures describe multi-agent failures as reported second-hand, not single-agent rates, and must not be quoted as general agent statistics — but they point at the same lesson as Anthropic’s stopping guidance: completion is a claim the harness must verify in code where possible, against tests or a measured result, not a sentence the model wrote. Context growth sits behind several of these failures: when history crowds out early facts and standing instructions, the model may ignore a constraint given at the start of the run. Trimming or summarising context is a harness decision that changes what the reasoning engine can reason about.
Choosing and configuring the reasoning engine in practice
Choosing a model for the reasoning role is a trade-off, not a ranking. Anthropic’s guidance is to start with the simplest solution that works and add complexity only when it demonstrably improves outcomes, because agentic systems often trade latency and cost for better task performance. A smaller, cheaper model may suffice when the task is narrow, the tools are few and well described, and the harness validates every call. A more capable model earns its cost when the goal is open-ended, the tool set is large, or plans must be revised from ambiguous observations. Routing makes the same point at smaller scale: send easy inputs to a smaller model and hard or unusual ones to a more capable one, rather than paying the highest cost for every call.
Configuration steadies the decisions the model makes. Require structured output for tool calls and validate arguments before execution. Add approval steps for risky or irreversible actions, so a plausible-looking but wrong call is caught before it acts. Log the full trace — every decision, tool call with its arguments, and observation — as useful evidence for locating the first wrong step and inspecting the observation that preceded it, treating a suspected cause as a hypothesis to investigate. And test in sandboxed environments with guardrails, as Anthropic recommends, since autonomy means errors compound across steps; test the tools as well as the prompts, over many example inputs.
When the LLM should not direct the loop
The LLM reasoning engine may not be the right tool when the task is predictable. Anthropic’s rule is to find the simplest solution possible and increase complexity only when needed; for many applications, optimising a single LLM call with retrieval and in-context examples is enough. When a task decomposes cleanly into fixed subtasks, a workflow such as prompt chaining with programmatic checks between steps may offer greater predictability and consistency for that task, and can do so at lower latency and cost, subject to evaluation. The model still reasons, but inside steps whose order and checks a human fixed in advance.
High-stakes and irreversible actions are the second boundary. Issuing a refund, messaging a customer, changing production data, or spending money are actions where a wrong decision is expensive and hard to undo; the model’s decision should be a proposal that a human approves or a hard rule gates, not an instruction executed unchecked. Agents suit trusted environments and open-ended problems where the number of steps cannot be predicted, and their autonomy brings higher costs and the potential for compounding errors. A simple decision rule follows from the distinction this article began with. Ask whether predefined orchestration suffices, or whether the process and tool use must be directed dynamically by the model on the basis of what previous steps returned. If the sequence, checks, and stopping point can be fixed in advance, a workflow may suffice — fixed code paths can branch on results and apply checks between steps. If dynamic model-directed process and tool use is needed, an agent loop may be warranted, with validation, approval gates, and stopping conditions containing the cost of a wrong step. Human approval can gate agent actions rather than ruling agents out: in Anthropic’s account, agents may pause for human feedback at checkpoints or when encountering blockers. Cost, latency, and reliability for the task at hand require evaluation rather than categorical promises. The reasoning engine is powerful because it decides; the discipline of building agents is deciding, in advance, which decisions it may make alone.












