What is an agent loop?

Definition

An agent loop connects a model's decisions to feedback from its environment. After choosing and carrying out an action, the system supplies the observed result for the next decision. The loop may use tools, revise a plan or ask a person for clarification.

A useful loop needs explicit limits and a trustworthy completion check. Repetition can otherwise amplify mistakes or waste resources. Reaching a stop condition does not prove that the intended real-world outcome occurred unless the system verifies the relevant evidence.

ELI5

An agent loop is the repeated cycle an AI agent uses to make progress. It looks at the current situation, chooses a next action, uses a model or tool, checks the result, and decides whether another step is needed.

For example, an agent fixing a program might read an error, edit one file, run the test, inspect the new result, and repeat. The loop needs a clear finish condition and limits so it does not keep making the same failed change or spend resources forever.

Does an agent loop need to run forever?

No. It should have task-specific completion rules, resource limits and ways to stop or request human help.

How does a loop differ from one model response?

A loop feeds action results back into later decisions. A single response may produce an answer without interacting with changing task state.

  1. Matthew Berman explains AI coding-agent loops
  2. Adam Lucek beside the words AI Agents Use Your Computer
  3. David Ondrej beside the blue and white headline BUILD REPEATABLE AGENT LOOPS against black.
  4. Nathaniel Whittemore beside the words AI Changed This Summer
  5. Mike Chambers in a plain blue hoodie beside the headline Build the Harness in blue and true white on a black background.
    Harness Engineering for Production AI Agents
    AI Engineer20m 46s7 VIEWS
  6. Tisha Chawla and Susheem Koul beside the words Control the Token Burn
  7. 0xSero in a blue top gestures beside the blue and white headline "LOOPS NEED REAL VALUE" on black.
  8. Philipp Schmid in a light attention-blue top on a black background beside the headline “FILES REPLACE AGENT CODE”.
  9. ThePrimeagen in a blue top gestures beside the blue and white headline “Building a Balatro Agent” on black.
  10. Portrait of Riley Brown beside the headline GPT-6 Astra in Action.
Definition card for agent loop: What is an agent loop?

An agent loop repeatedly observes a task's state, chooses an action, checks the result and decides whether to continue or stop.