How do AI agents work? Tools, feedback and the next step

By Unlearnt

An AI agent is a system that uses a model to choose actions towards a goal, observe what happens and decide what to do next. In many language-model agents, the important addition is a loop around the model: tools can affect or inspect the outside world, and their results inform the next decision.

The model chooses; software carries out the action

A model can propose a tool call, such as searching a calendar. The surrounding software checks and executes the permitted operation, then returns the result. A sentence saying ‘I booked it’ is not itself a booking.

The word agent is used loosely. A useful distinction is who chooses the route: a fixed workflow follows steps defined in code, while an agent can choose the next step according to the task and results. A chat interface can contain either kind of system.

[2][1]

A worked example: finding a meeting slot

Imagine a scheduling assistant is asked to find a 30-minute slot next week when Sam and Priya are both free, but to ask before sending an invitation. This is an illustrative system, not a claim about any particular app.

It reads their calendars using a permitted tool and finds Tuesday at 10:00. Before proposing it, it notices that Sam's calendar is in London time and Priya's is in New York time. It normalises the times, checks the overlap and offers a suitable slot.

The user approves. A final availability check now shows a conflict. A useful agent reacts to that observation by looking for another slot and asking again if necessary. Repeating the original plan without checking would ignore the very feedback the loop supplied.

The loop connects a decision to an observable result.
StageIn the meeting example
Goal and constraintsFind a shared slot; do not send without approval.
Choose a toolRead the two calendars.
Observe the resultCompare times, time zones and conflicts.
Choose the next stepSuggest a slot, search again or ask for missing information.
Verify and finishReport success only after the calendar service confirms creation.

Feedback changes the next action

Research such as ReAct explores interleaving model reasoning with actions and observations. An external result can supply information the model did not have and reveal that its plan needs changing.

In the meeting example, the new conflict is task data. It should change the next move even if the agent previously sounded certain. The system needs to retain enough task state to know what has been tried, what the user authorised and what still needs doing.

[3]

What is the agent harness?

The harness is the surrounding code that runs the loop: it passes context to the model, exposes tools, checks requests, stores results and decides when to stop or ask a human. The exact components vary between systems.

For this scheduling assistant, a sensible design would give access only to the relevant calendars, enforce the approval requirement in software and stop after a bounded number of failed attempts. These are design choices for the example. Writing ‘be careful’ in a prompt would not by itself enforce them.

If the booking service times out, the assistant should inspect whether the event was created before retrying. Otherwise it could send two invitations. Observing a tool failure is useful only if the system handles what that failure leaves uncertain.

A common misconception: an agent is an LLM that learns by itself

Changing the next action after reading a tool result does not require updating model weights. The result can simply be added to the current context. A system may also store memory between tasks, but that is different from retraining the model.

Agents can still make wrong choices, misread results or stop too early. ReAct's experiments demonstrate a particular approach on particular tasks; they do not show that any agent with tools will reliably complete any goal.

[3]

When is a fixed workflow enough?

If the task is always ‘read a form, validate its fields, then create a draft’, a fixed workflow may be easier to predict and check. If the next action depends on an unexpected result, flexible routing may help. The extra loop also adds calls, waiting and opportunities for errors.

For a reader evaluating an agent, three practical questions are enough to start: what can it actually do, what evidence confirms success, and where does it stop for permission or help? Those answers say more than whether the interface calls itself autonomous.

[2]

Check your understanding

Optional: apply the idea to a new scenario.

An agent is asked to find a flight under £250 and ask before buying. Its search tool finds one at £220, but the booking tool later reports that the fare has risen to £290. What should change in its next step, and why is the earlier search result not enough to justify buying?

Answer with the tutor →

Free to start, no account needed.

Sources

  1. Anthropic: Tool use with Claude
  2. Anthropic: Building effective agents
  3. Yao et al.: ReAct, Synergizing Reasoning and Acting in Language Models