Level : Intermediate

How do AI agents make decisions?

By The Info Agent IA editorial team ·

A glowing path splitting into several branches, with points of light at each fork and a loop leading back to the start, an image of an AI agent's successive choices.

An AI agent makes decisions in a loop: it looks at the situation, writes down what it plans to do, picks a tool, reads the result, then repeats until it reaches the goal or hits a preset limit. Each “decision” is really a prediction by the language model, steered by its instructions, the tools it has been given and everything it has seen so far during the task.

A language model does not decide the way you do

At the heart of every agent sits a large language model. On its own, it does one thing: produce the most likely continuation of a text. It has no will and no goals of its own.

What turns it into an agent is the program wrapped around it. That program hands the model a goal, a list of tools and a history of what has happened so far, then essentially asks: “What do you do now?” The model replies either with a final answer or with a request to take an action. The program runs the action, adds the result to the history and asks again.

An agent’s “decision” is therefore the choice of its next action among the ones it is allowed to take. For a broader introduction to these systems, see our guide what is an AI agent.

The core loop: think, act, observe

The most widespread pattern has a name: ReAct, short for Reasoning and Acting. It was described in the paper “ReAct: Synergizing Reasoning and Acting in Language Models”, posted to arXiv on October 6, 2022 by Shunyu Yao and colleagues from Princeton and Google. The idea is to interleave reasoning and action instead of treating them separately. Our glossary entry on the ReAct pattern walks through the mechanics.

On each turn, the agent goes through three stages:

  1. Thought: it writes what it has understood and what it intends to do.
  2. Action: it picks a tool and its parameters.
  3. Observation: it reads the result returned by the tool.

Here is an example. You ask: “Find an Italian restaurant near me that is open Sunday evening and book a table for four at 8 pm.”

TurnAgent’s thoughtActionObservation
1I need the user’s addressRead the profileAddress found
2I’ll look for nearby Italian restaurantsWeb searchFive places
3Which are open Sunday evening?Read the restaurants’ pagesTwo are open
4I’ll check availability at 8 pmOpen the booking siteOne table free
5Booking commits the userAsk for confirmationWaiting for your go-ahead

Nothing magical: the agent simply chained five small decisions, each built on the previous observation. Had it misread opening hours on turn 3, everything after would have been wrong.

Planning: breaking the goal down before acting

For a short task, the agent can move one step at a time. For a long one, it pays to make a plan first. This is task decomposition. “Plan a weekend in Lisbon” becomes: set the budget, look for flights, compare three hotels, suggest an itinerary, sum it all up in a table.

Two approaches coexist:

  • A fixed plan, written in advance by the developer. Predictable and easy to test, it suits repetitive tasks.
  • A dynamic plan, proposed by the model itself and revised as it learns more. More flexible, but harder to control.

A good agent does not follow its plan blindly. If the chosen flight is sold out, it should backtrack and adjust what comes next. That is what separates an agent from a plain automation, a distinction we explore in agentic AI: what the buzzword really means.

Calling a tool: how the choice is made

The key moment in any decision is choosing a tool. Technically, this goes through tool calling, also known as function calling.

In practice, the developer describes each tool to the model: a name, a sentence explaining what it is for, and the list of expected parameters. When the model decides a tool would help, it does not reply with a sentence but with a structured request, such as search_flights(origin="London", destination="Lisbon", date="2026-11-14"). This format is a structured output that the program can read without ambiguity.

The model never runs the tool itself. The program does, then sends the result back. That separation matters: it is where you can forbid an action, log it or require your approval.

The quality of decisions therefore depends heavily on the quality of those descriptions. A poorly described tool will be misused, or not used at all. Standards such as MCP now make it possible to plug tools into many agents in a uniform way; we explain them in MCP explained simply.

Check yourself An agent has two tools, send_email and create_draft. You ask it to prepare a reply to a customer. Which should it pick, and who really decides?

It should pick create_draft, since you asked it to prepare, not to send. But the model makes that choice from your wording and the tool descriptions: if it misreads the request, it might send. The safest safeguard lives in the program, for example by requiring your confirmation before any call to send_email.

What shapes each choice

On every turn, the agent’s decision depends on several ingredients, all sitting in its context window:

  • The initial instructions: the system prompt sets the role, the rules and the no-go areas.
  • Your request: the more precise it is, the less the agent has to guess.
  • The tool descriptions: they define what it can do.
  • The task history: every earlier thought, action and observation.
  • Its memory, if it has one: preferences or past experiences, recalled at the right moment through agent memory.

Recent reasoning models think longer before each action. They do not replace the loop: they make each turn more deliberate, at the cost of more time and more tokens.

Knowing when to stop

A loop has to end. Ideally, the model judges the goal achieved and writes its answer. But an agent can also go in circles, rerun the same search or chase a dead end.

In “Building Effective Agents”, published December 19, 2024, Anthropic stresses that an agent should get “ground truth” from its environment at each step, such as a tool result or code execution, to assess its progress. The company adds that agents can pause for human feedback at checkpoints, and that it is common to include stopping conditions such as a maximum number of iterations.

In practice, three safeguards are combined: a cap on the number of steps, a budget in tokens or money, and human approval points before sensitive actions. Every turn of the loop costs model calls: our AI agent cost calculator helps you estimate what a ten-step task costs compared with a two-step one.

Where decisions go off the rails

Understanding the loop helps you spot its weak points:

  • A bad observation: the agent misreads a page, and everything after rests on an error.
  • Cascading errors: a small approximation on turn 2 becomes a wrong result on turn 8.
  • The endless loop: the agent repeats a failing action without changing strategy.
  • Hijacking: hidden text in a page or document poses as an instruction and steers the next decision. This is prompt injection.
  • A vague goal: faced with fuzzy instructions, the agent fills in the gaps its own way.

To go further, see how far these decisions can be left unsupervised in our article on autonomous AI agents.

Frequently asked questions

Does an AI agent really think before it acts?

It writes out a line of reasoning, then picks an action based on that text and on what it has already observed. This is not conscious thought but a prediction shaped by its instructions, the tools available and earlier results. The reasoning is often useful, but it is no guarantee of being right.

What is the ReAct loop?

It is a pattern published in October 2022 by researchers from Princeton and Google: the model alternates a written thought, an action such as a search, and an observation of the result, then repeats. Most of today's agents rely on a variant of this loop.

Who actually carries out an agent's actions?

Not the model itself. The model outputs a structured request with a tool name and its parameters, and the surrounding program runs the action and sends the result back. That is the layer where an action can be blocked or sent to a human for approval.

How does an agent know it is done?

The model judges that the goal has been reached and writes a final answer. To stay on the safe side, developers also add limits: a maximum number of steps, a budget, or a pause to ask a human before certain actions.

Go further