AI agents

How does an AI agent decide what to do next?

Agents work in a loop: read, plan, act, check, repeat. A plain walk through each step, where errors creep in and where a person should step in.

The short answer

An AI agent works in a loop: it reads the goal and the current situation, plans a next step, uses a tool to carry it out, checks the result and then decides whether to continue, change course or stop. The quality of each decision depends on the records it can see, the instructions and limits it has been given, and whether it is required to stop and ask a person at set points.

From the outside, an agent can look as if it simply knows what to do. Inside, it is following a repeated cycle. Understanding that cycle helps an owner see where to put checks, and why an agent that seems clever on Monday can make an odd choice on Tuesday.

The basic loop

Most agents follow a pattern that researchers and builders describe in similar terms: reason about the situation, take an action, observe what happened, and go round again. Anthropic's guidance notes that agents gain ground truth from the environment at each step, such as the result of a tool call, and use it to judge progress.

  1. Read the goal and context. What job am I doing, under what mandate, and what is in front of me now?
  2. Plan. Break the goal into a next step, for example fetch the list of unpaid invoices.
  3. Act. Call a tool: query the ledger, draft an email, prepare a payment.
  4. Check. Read the result. Did the query return what was expected? Does the draft match the policy?
  5. Decide. Continue, try a different approach, stop because the job is done, or stop because a limit has been reached.

What shapes each decision

The model's reasoning matters, but four other inputs usually matter more in practice.

Instructions
The mandate and policies the agent has been given. Vague instructions produce varied behaviour.
Available records
What it can fetch. An agent that cannot see last week's refund will not account for it.
Tools
What it is able to do. If it has no tool for issuing refunds, it cannot issue one, whatever it decides.
Stopping rules
Ceilings, approval points and refusal rules that override its own judgement.

This is why two businesses using the same agent product can get different results. The agent's choices reflect the information and limits each business set up.

Where decisions go wrong

Errors in agents tend to follow a few patterns. Knowing them tells you where to look.

FailureWhat it looks likeControl
Wrong contextActs on stale or missing recordsFetch live data at the step it is used; record the source
Misread instructionFollows the letter of a rule, not its intentWrite policies with examples; test on past cases
Compounding errorAn early mistake carried through several stepsChecks between steps; limits on how many steps run unattended
Hijacked instructionFollows text hidden in an email or documentTreat content as data, not commands; restrict tools
OverreachTakes an action bigger than the task neededNarrow permissions and a ceiling that hands the decision to a person

The fourth row is what OWASP calls prompt injection, and it is a live risk for any agent that reads email or web pages. The NCSC's guidelines for secure AI development make the same point: assume inputs can be hostile and design the system so that a manipulated agent cannot do much damage.

A worked example

Example only. A supplier emails asking to be paid ₦850,000 for a delivery. The agent reads the email and plans to check it. It fetches the purchase order and finds a match for ₦850,000. It fetches the goods-received record and finds only part of the order was delivered, worth ₦600,000. It checks: amounts do not agree. It decides not to prepare the full payment. Instead it drafts a note to the supplier querying the shortfall and, because any supplier payment above ₦500,000 needs a person, it places the item in front of the owner with the purchase order, delivery note and email attached.

Each step was a small decision. The important ones, whether to pay and how much, ended with a person because the stopping rules said so. Notice also what made the right outcome possible: the agent could see the goods-received record. If that record had lived in a notebook on the warehouse desk, the agent would have found a matching purchase order, seen nothing wrong and prepared the full payment. Good decisions depend as much on the records you make available as on the agent itself.

Where a person should stay in the loop

  • Any payment, refund or discount above an amount you choose.
  • Anything that changes a customer's contract, price or terms.
  • Cases where the agent's sources disagree or are missing.
  • First-time actions, such as paying a new supplier or using a new bank account.
  • Decisions about people, such as hiring, firing or credit, where data protection law may give individuals rights over automated decisions, as the ICO explains.

Our guide to human in the loop decisions in finance goes further on the money side.

Where Pryme fits

Pryme's agents run this loop inside a mandate with a ceiling: above it, the agent stops and a person decides. Every action is recorded with its source, which is what lets you trace a decision back. The Compliance agent refuses and records questions its policy set does not cover rather than improvising, and the Chief of Staff collects the decisions that reach you. Read more on audit trails for AI agents.

Questions people ask

Does an AI agent think like a person?

No. It predicts useful next steps from its instructions and the information in front of it. It can reason through problems in text, but it has no understanding of consequences beyond what it has been told.

Why does an agent sometimes make different choices on the same task?

Language models produce varied outputs, and small differences in the records it fetches can change its path. Clear policies, stopping rules and tests reduce the variation that matters.

How many steps should an agent take without a check?

There is no fixed number. Fewer for actions that move money or speak to customers; more for low-risk preparation work such as gathering documents.

Can I see why an agent made a decision?

Only if it records its actions and the sources it used. Ask vendors to show you the record for a real task before you buy.

Sources

  1. Anthropic: Building effective agents · accessed Oct 2026
  2. OWASP: LLM01:2025 Prompt Injection · accessed Oct 2026
  3. NCSC: Guidelines for secure AI system development · accessed Oct 2026
  4. ICO: Rights related to automated decision-making including profiling · accessed Oct 2026

This article is general information, not financial, legal or tax advice. Products described are provided under the terms on this site and are subject to regulation and eligibility.

More on AI governance