An agent loop is the control cycle that lets an agent work across multiple steps. The loop collects context, asks a model to choose an action, executes an allowed tool and returns the result for another decision.
A reliable loop also handles stopping conditions, errors, state updates and limits on time, cost or authority. Frameworks and managed runtimes can provide this machinery so application developers focus on the domain task rather than rebuilding control flow.
ELI5
An agent loop is the repeated cycle an AI agent uses to make progress. It looks at the current situation, chooses a next action, uses a model or tool, checks the result, and decides whether another step is needed.
For example, an agent fixing a program might read an error, edit one file, run the test, inspect the new result, and repeat. The loop needs a clear finish condition and limits so it does not keep making the same failed change or spend resources forever.
Why does an agent need a loop?
Many tasks require several connected decisions, and the loop lets later decisions use the results of earlier actions.
What stops an agent loop?
It may stop after reaching a goal, encountering an error, requesting human input or hitting a configured time, cost or iteration limit.







