AI agents: let the result choose the next step
An AI agent uses a model to help decide what to do next while working toward a goal. It can inspect a result, choose a tool, observe what happened and revise its next action. The useful distinction is control flow: some decisions that ordinary software fixes in advance are made during the task.
A coding agent, for example, can read a file, edit a function, run a test and use the failure to choose its next edit. Its ability comes from the model together with the tools, context and execution environment around it.

A loop with observations
The model receives the goal and current state. It requests an action or returns an answer. Software executes an allowed tool call and supplies the result for another model turn. This repeats until the task finishes or a stopping condition is reached.
An error message is useful feedback. The agent can change its approach because the next decision depends on the new observation. A sequence of model calls alone does not establish that such adaptation is happening.
What persists between turns
Conversation history, files, saved notes and external stores can preserve state. The model weights usually stay unchanged while a task runs. Context management determines which parts of that state reach the next model call.
Agents can spend many calls on one task, so step limits, time budgets and explicit completion checks matter. Finishing a loop is not the same as achieving the goal: the result needs evidence, such as a passing test or a verified saved file.