What is an agent loop?
An agent loop is a repeating cycle where an AI agent thinks about what to do, takes an action, reads the result, and decides whether to keep going or stop.
It follows a pattern sometimes called ReAct (short for Reason + Act). The agent looks at its goal, reasons about the next step, calls a tool or produces some output, reads back what happened, and starts the cycle again. A coding agent might read an error, write a fix, run the tests, see a new error, write another fix, and repeat until the tests pass or it gives up.
Frameworks like LangChain made agent loops easy to set up. You give the agent a goal, a set of tools, and a model, and it runs the loop until it decides it’s finished.
The limitation is that the loop is the entire architecture. The agent has no map of the process and just keeps spinning until it hits the exit condition or gets stuck. If one step fails, the whole loop retries from the top. This works fine for simple, linear tasks but breaks down when work needs to branch, or when multiple agents need to coordinate in parallel. That’s what led to graph engineering, where instead of one loop you design an explicit workflow, and a loop becomes just one edge among many possible paths.