AI GLOSSARY · AGENTS AND AGENT TOOLING

Agent loop

Markdown version

Definition

An agent loop repeatedly uses model decisions and environmental feedback to choose steps toward a goal. A turn may request tools, including multiple calls, or finish without one; the application manages results, retained context and stopping conditions.

Also called: agentic loop, agent reasoning loop, ReAct loop, observe act loop, think act observe loop.

In plain language

An agent loop is the repeat-until-done cycle behind an AI agent. The agent looks at the task, picks an action such as running a command or reading a file, sees what happened, and decides the next step. Think of fixing a leaking tap: you try something, look at the result, and try again. Anthropic's engineering team describes agents as typically just models using tools based on feedback from their environment, in a loop. The limits are cost and control. Each pass uses tokens, a loop can wander or repeat itself, and it needs a stopping rule, such as a maximum number of passes or a person checking in, to keep it from running on.

Technical definition

In Anthropic's Building effective agents, agents are typically just LLMs using tools based on environmental feedback in a loop. At each step the agent needs ground truth from the environment, such as a tool result or code execution output, to assess its progress. The article says the task often terminates on completion but that it is also common to include stopping conditions, such as a maximum number of iterations, and that agents can pause for human feedback at checkpoints or on blockers. The ReAct paper (Yao et al., arXiv 2210.03629) is one formulation: it has language models interleave reasoning traces with task-specific actions. IBM describes a Think-Act-Observe loop under its ReAct section.

Worked examples in this catalogue

Catalogue examples point at a skill, guide or coding tool listed on this site, with what to run and what you see. An example marked illustrative describes the item from its own documentation; it was not executed for this page. Platform Scores are our assessment under a published method, not a safety guarantee.

  1. Guide · Illustrative, not executed

    What Is an AI Agent? The Model, Tools and Memory Loop

    What you see
    A walkthrough of the agent loop on one task: the model picks a step and a tool call, the tool result comes back, and the model decides what to do next.
    Why it exercises the concept
    It is the plainest worked case of the definition above, with the loop shown on one concrete task.
  2. Skill by Jesse Vincent · Illustrative, not executed

    executing-plans 29/100 · Provisional, not yet measuredScored · Method v0.2 · How we score

    What you see
    Works through a written implementation plan inline using a progress ledger, per-task tests and an end-of-branch review; routine between-task human check-ins are explicitly excluded.
    Why it exercises the concept
    This is a structured inline execution example, not a routine human-check-in loop. The pinned contract uses TDD and a ledger, and reserves stops for its listed exceptional conditions.
  3. Skill by Skill Almanac · Illustrative, not executed

    coding-agent-guardrails 60/100 · grade CScored · Method v0.2 · How we score

    What you see
    A pre-action checklist for coding agents plus a read-only audit of a repo's guardrail setup.
    Why it exercises the concept
    The checklist can guide pre-action review if the agent follows it. It is not automatically applied on every pass and is not an enforcement boundary; permissions, hooks and downstream controls are separate.
  4. Coding tool · Illustrative, not executed

    Claude Code

    What to try
    claude
    What you see
    Claude Code starts an interactive session in which the agent reads files, runs commands and edits code, using the result of each step to choose the next.
    Why it exercises the concept
    A Claude Code session is an agent loop you can watch. Commands such as /context and /usage show how much of the session the passes have used.

How it shows up when you use agents

In Claude Code, Codex or Cursor, the agent loop is what you watch scroll past: the agent reads a file, runs a test, sees the failure, edits, and runs the test again. The surrounding program that drives the cycle is the agent harness. A model turn can request one or several tools, or finish without a tool. The application decides which results and history to retain, summarize or omit in the context window; retaining more material can consume tokens and crowd out earlier instructions.

What breaks when the loop is misunderstood: people expect one prompt to give one answer, then are surprised when a task takes many tool calls, costs more than expected, or goes in circles on a failing step. Anthropic notes that stopping conditions such as a maximum number of iterations are common, and that agents can pause for human feedback at checkpoints or blockers. Use those handles. Interrupt a run that repeats itself, state the goal and the check that proves it is done, and turn on approval prompts for actions you cannot undo. See human in the loop.

Next action: write the stopping rule into your request ("stop when the tests in this folder pass"), and check progress with /context and /usage in Claude Code during long runs.

Common confusions

  • Agent loop versus ReAct. ReAct is one published way to structure the loop, interleaving reasoning with actions. The loop itself is the general cycle, and an agent may not follow the ReAct recipe.
  • Agent loop versus a workflow. Anthropic separates workflows, where code paths are predefined, from agents, where the model directs its own steps and tool use. A fixed chain of calls is not an agent loop.
  • Agent loop versus chat turn. A chat turn is one reply. A loop is many model calls and tool runs inside what looks like one request from your side.
  • Myth: the loop ends by itself when the answer is right. The model decides when it thinks the task is done, and it can be wrong. A stopping condition and a check you control are the safer habit.
Show all 15 related terms

Terms that mention Agent loop

20 terms mention this one

Guides that mention Agent loop

More in Agents and agent tooling

Next steps

  1. What Is an AI Agent? The Model, Tools and Memory Loop The long-form guide.
  2. executing-plans A skill that exercises it.
  3. Human in the loop (HITL) Related term.
  4. ReAct prompting Related term.
  5. All glossary terms A to Z and by family.

Sources

Definitions are written by Skill Almanac from these sources and were checked against them on 2026-11-25. Wikipedia is never the only source.

Review record

Last verified

Drafted by Claude (original draft); OpenAI Codex (bounded factual repairs); sources and example targets checked by Independent automated source review (OpenAI Codex); not human peer review on 2026-11-25. Last verified .

Change log (4)
  • : Independent automated factual/example review completed. Cached US query estimate aligned to receipt; no traffic promise. Final technical gate recorded separately; publication disabled.
  • : First version.
  • : Bounded source repairs: Qualified model/tool/context cycle and actual inline-plan gates; distinguished a followed checklist from enforced every-pass control. Pending independent re-review.
  • : Automated review completed; approved for the staged public release. Search indexing is controlled by the release configuration.