What an agent loop is (and isn't): state, action, stop
An agent loop is the cycle in which a language model decides an action, that action runs, and the result feeds back in as context for the next decision, until a stopping condition is met. That repetition—decide, act, observe, repeat—is what separates an agent from a chat. A chat answers each message once; an agent runs that cycle on its own, many times, until the task is done. This is the first…
An agent loop is a cycle that a language model goes through to accomplish a task. This cycle involves three components: state, action, and stopping condition. The model takes in text and produces text, but an agent wraps this inference in a loop. The model's output becomes a decision to run a command, read a file, or search for something.
The program executes this decision and feeds the result back to the model as new context. This process repeats until a stopping condition is met, at which point the task is considered complete. Understanding these three components is essential to grasping how AI agents work.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.