agents
Glossary ↗Agent Loop
The agent loop is the core runtime cycle that turns a language model into an agent: the model receives the goal and current context, decides on an action (usually a tool call), your code executes that action, the result is fed back, and the loop repeats until the model emits a final answer or hits a stop condition. It is the ReAct pattern generalized into production plumbing — sometimes called the agent harness or scaffolding. Everything else in agent design hangs off this loop: memory decides what context enters each iteration, guardrails validate actions before they run, and budgets cap how many times it can spin. For builders, most 'agent frameworks' are really opinionated agent loops plus tool plumbing; understanding the raw loop lets you debug why an agent stalls, repeats itself, or never terminates, and often build your own in a few dozen lines rather than adopting a heavy framework.
Related terms