Glossary

Agentic loop

The repeating cycle where an AI agent decides what to do, takes an action, observes the result, and decides what to do next, until the task is complete.

The agentic loop is the repeating cycle that makes an AI agent agentic. The basic shape:

  1. Plan, given the goal and current state, the model decides the next action
  2. Act, the model calls a tool (or asks for one to be called)
  3. Observe, the tool returns a result; the model reads it
  4. Reflect, the model assesses whether the result moved toward the goal
  5. Loop, go back to step 1, with updated state

This continues until the model either reports the task complete, runs out of allowed turns, or hits a budget limit.

Why “loop” matters

A single-turn LLM call has no agency. You ask, it answers, done. An agentic loop is what lets the model do something more interesting than answer one question:

  • “Audit this Shopify store and post a summary to Slack” requires the model to plan multiple Shopify queries, run them, observe results, decide whether they’re sufficient, and then post, multiple loops worth.
  • “Refactor every file in src/ to use the new auth module” requires the model to list files, edit each one, run tests, observe failures, fix them, iterate.

Without a loop, you’d have to break the task into 30+ separate prompts. With a loop, you write one goal and the agent grinds.

Where loops fail

The most common failure modes:

  • Looping on noise. The model keeps trying things that don’t work, never giving up. Mitigation: turn caps.
  • Wandering off goal. The model gets distracted by an interesting sub-problem. Mitigation: re-anchor in the system prompt.
  • Action-bias. The model takes actions to “make progress” when it should ask for clarification. Mitigation: prompt for “ask if unsure.”
  • Tool blindness. The model has tools available but doesn’t use them. Mitigation: explicit tool examples in the system prompt.

Modern agent harnesses (Claude Code, Claude Agent SDK) handle most of these guardrails for you.

How long can a loop run?

In Claude Code, the default --max-turns for a session is 200. For agentic background jobs (like our nightly inventory audit), we typically cap at 25-50 turns. A turn = one model call + one tool call.

A typical agentic task fits in 5-30 turns. Anything that needs 100+ turns is probably a poorly-scoped task that should be broken into smaller pieces.

Related terms

Want this built for your business?

Book a free 30-minute AI audit. We'll map your business and show you exactly which systems we'd build first. No pitch deck, no scoping fee.

Book my free AI audit