agentic loop
The cycle an agent runs in: decide, call a tool, read the result, decide again — repeating until the goal is met or a stop condition fires.
This loop is what separates an agent from a single completion. The model is called repeatedly, each time seeing the results of its last action, so it can course-correct instead of committing to a plan formed before it knew anything.
The stop condition is where loops go wrong. Vague goals produce agents that declare victory early or grind forever; verifiable ones — tests pass, a check returns green, a value crosses a threshold — let the loop terminate on evidence rather than on the model's opinion of its own work.
Put the idea to use
Suppose you ask an agent to fix a failing test. It reads the failure, chooses a change, edits the code, and runs the test again. The new result informs its next action. That repeated interaction is the loop; each result should change what the agent knows about the task.
Repeating an action is not progress by itself. Define the result that counts as success and a point at which the agent should stop or ask for help. Otherwise a tool error can send it through the same unsuccessful action repeatedly.
Background: LangChain: agents and tools.