Agent Loop
Also known as: Reasoning Loop, Action Loop, Observe-Think-Act Loop
Definition
The iterative cycle an agent follows: perceive the current state, reason about what to do, execute an action, observe the result, and repeat until the goal is achieved or a termination condition is met. The agent loop is what distinguishes agents from single-turn inference—it enables multi-step problem solving where each step's output informs the next step's input.
What this is NOT
- Not a single inference call (loops require multiple iterations)
- Not a batch process (loops are reactive to intermediate results)
- Not recursion in the programming sense (though implementation may be recursive)
Alternative Interpretations
Different communities use this term differently:
llm-practitioners
The core execution pattern of LLM agents: prompt the model, parse the response for an action, execute the action (often a tool call), append the result to context, and loop. Common implementations include ReAct, function-calling loops, and plan-then-execute patterns.
Sources: ReAct paper (Yao et al., 2022), LangChain AgentExecutor implementation, Anthropic tool-use documentation
control-theory
A feedback loop where a controller observes system state, computes control signals, applies them to the system, and measures the new state. The classic observe-orient-decide-act (OODA) loop.
Sources: Control systems engineering literature
Examples
- ReAct loop: Thought → Action → Observation → Thought → ...
- Function calling loop: prompt → function_call response → execute function → append result → prompt
- Self-correction loop: generate → evaluate → regenerate if quality is low
- Research loop: query → retrieve → assess sufficiency → query again or synthesize
Counterexamples
Things that might seem like Agent Loop but are not:
- A single GPT-4 API call that returns a complete answer
- A RAG system that retrieves once and generates once
- Batch inference over a dataset
Relations
Implementations
Tools and frameworks that implement this concept:
- AutoGPT primary