An agent loop is the repeated cycle an agent runs to make progress on a goal.

The shape, in one sentence: intake → context assembly → model inference → tool execution → persist → repeat until a stop condition is met.

Every long-running agent is some variant of this loop. The differences between agents are in the tools, the memory, the termination condition, and the routing — not in the shape.

Where the loop shows up

The agent loop is the most general abstraction available for thinking about an agent system. Whether the agent is a single-step tool-using LLM, a multi-step reasoning pipeline, or a long-running background service, the loop is the underlying structure. The loop is what makes the agent agentic rather than merely prompted — the loop is the thing that lets the agent take action, observe the result, and decide what to do next without a human in the loop for each step.

What varies between loops

The loop's shape is fixed, but the components of the loop vary dramatically across systems. The intake can be a user prompt, a cron trigger, a webhook from another service, or a message from a queue. The context assembly can be a simple concatenation of recent messages or a sophisticated retrieval over a vector store. The model inference can be a single LLM call or a chain of model calls with different temperatures or providers. The tool execution can be a single function call or a multi-step plan with rollback. The persistence can be a session log or a long-term memory store. The stop condition can be a target output, a budget, a deadline, or a human approval.

Operator implications

The loop is the right place to start when an operator is debugging an agent that is not behaving as expected. Most operator issues are not about the model's capabilities — they are about the loop's components: the intake is missing a signal, the context assembly is putting the wrong information in front of the model, the tool execution is failing silently, the persistence is being lost, or the stop condition is never met. The loop is also the right place to start when an operator is adding capabilities — the canonical question is "which component of the loop needs to be expanded?"

Related terms

The agent loop is the worker that the state graph routes. The loop's persistence layer is the memory and the compaction step is what keeps the context window manageable. The loop's termination is often tied to HITL approval. The loop is the unit of work that the cron and the session are scheduling and tracking.

For the full primer, see What Is an Agent Loop?.

Why the loop is the right abstraction

The loop is the right abstraction for the agent's work because the loop captures the agent's essence: the agent is the thing that takes action, observes the result, and decides what to do next. The loop is not just a metaphor; the loop is the actual structure of the agent's behavior. The loop is what makes the agent agentic, and the loop is what makes the agent different from a static prompt or a one-shot prediction.