An AI agent is a language model put in a loop. The model looks at a goal and the history so far, and it proposes one action. An orchestrator, which is ordinary code you write, runs that action, takes the result, and hands it back. The model looks again and proposes the next action. This repeats until the model says the goal is met, or until a limit stops it.
A few words carry the rest of the idea. A tool is a function the agent may ask for, such as a database query, a web search or sending an email. A step is one full turn: one action proposed, run, and its result returned. A side effect is a change in the world that stays after the call, like a charge or a sent email. A budget is a hard limit on steps, tokens or seconds.
The key point is who does what. The model never runs anything. It only writes text that proposes an action. The orchestrator executes, and it owns the loop, the budget and the stop condition. That gives you seams you can control: how many steps are allowed, which tools exist, what happens on an error, and whether a proposed action may run at all.