Agentic Loop

Agentic Loop is the iterative control cycle in which a large language model repeatedly observes state, reasons about what to do, executes an action such as a tool call, and checks the result against the goal, continuing until the task is complete…

Agentic Loop is the iterative control cycle in which a large language model repeatedly observes state, reasons about what to do, executes an action such as a tool call, and checks the result against the goal, continuing until the task is complete or a stopping condition triggers. Unlike single-shot prompting, where the model returns one answer from one input and stops, the loop lets an agent decompose a task, gather missing information, recover from errors, and adapt its plan across many turns. Each pass feeds the outcome of the previous action back into context, so the model works with fresh evidence rather than a fixed initial prompt. A typical iteration runs observe → think → act → check: read the current environment, decide the next step, call a tool or emit output, then evaluate whether the goal is met. Loops usually run under explicit limits—maximum iterations, token budgets, or wall-clock timeouts—to prevent runaway execution when the model cannot converge.

How it works

The loop maintains a running context: the original task, the history of actions taken, and the results those actions returned. On each iteration the model receives this accumulated state and produces either a tool call or a final answer. When it calls a tool, the harness executes it and appends the output back into context for the next pass. A termination check—an explicit "done" signal, a satisfied condition, or a hit iteration cap—decides whether to continue or exit. This feedback path is what separates an agent from a one-shot completion.

Why it matters for AI engineers

Every iteration is another model call, so loops multiply token cost and latency—a five-step task costs roughly five times a single completion, and context grows with each appended result. Unbounded loops can spiral, so hard caps on iterations and budget are non-negotiable in production. Because each pass can invoke tools and act on prior outputs, loops widen the attack surface for prompt injection and compounding errors; a bad observation early can poison every subsequent step. Engineers ship reliable agents by constraining tool access, validating each action's output, and instrumenting the loop so failures are caught rather than silently retried.

Agentic Loop vs. alternatives

Approach Iterations Tool use Best for
Single-shot prompting One None Fixed, self-contained answers
Chain of Thought One None Reasoning that fits in one pass
Agentic Loop Many Yes Multi-step tasks needing feedback

Related terms

Go deeper

Definitions are the start. Ask the Research Desk for a cited, multi-source brief on Agentic Loop — real sources, verified claims, delivered in minutes.

Ask the Research Desk →