Agent Loop
Agent Loop
Also called: 智能体循环 · Agentic loop · Run loop
The repeating cycle observe state → model decides → execute tool → feed result back; the underlying structure of almost every agent framework.
What happens in one iteration
- The current context (goal, history, last observation) is passed to the model.
- The model emits a decision: call a tool with arguments, or declare the task complete.
- The runtime executes that tool and gets a result (file contents, command output, an error).
- The result is appended as a new "observation" and the next iteration begins.
The loop ends when the model declares completion, a step/spend limit is reached, or an error stop-condition fires.
Why it is central
The loop turns a single generation into a process that can try, fail, and correct: real feedback at each step revises the model's next decision. Much of what distinguishes agent frameworks is how this loop handles memory, errors, termination, and human intervention points.
Common misconceptions
- The loop is not internal model behaviour — runtime code drives it, and the model is invoked once per iteration.
- Without an explicit termination condition, the loop spins in place or exhausts its budget.
Related terms
Sources
Compiled 2026-08-29 · This glossary is compiled from public papers, official specifications, and common industry definitions, and is updated as the field evolves. Corrections welcome.