Definition
An AI agent is a software system in which a model helps choose the next action toward a goal. The surrounding system or runtime gives the model context, exposes the actions it can take (often as tools), and keeps state across steps. It also sets limits and runs the loop. The model is a decision-making component inside that system, not the whole agent.
Simple example
A repository assistant receives a bug report and reads the relevant files. It prepares a patch. If permitted, it applies the patch and runs tests against the changed code. A failed test may lead to another edit. The assistant stops when the checks pass or it needs approval to continue. Here, the application decides which tools are available, validates their arguments, records results, and caps the number of steps.
Why it matters
Some tasks cannot be completed with one generated response. The next step depends on what the system observes after an action: a file may reveal another dependency, or a test may fail. An agent loop can use that result to choose what to do next rather than follow a fixed sequence.
One important nuance
An agent still needs controls outside the model. It can request the wrong action, repeat a failed attempt, misread a result, or keep going after the work is done. The runtime checks permissions and controls side effects. The model can ask to retry or signal completion, but the runtime enforces retry limits, time and cost budgets, and hard stop conditions. If the steps are known and stable, deterministic code may be simpler and safer.