# Agentic Loop

The repeating model-tool-observe cycle that lets Claude act, read results, and decide the next step until a goal is met.

## Why the CCAR-P exam tests this

CCAR-P tests whether you can design a controlled loop with clear stop conditions rather than an open-ended process that never terminates.

## Definition

An **agentic loop** is the core execution pattern of an agent: the model receives context, decides on a tool call (or a final answer), the tool runs, and its result is fed back as an observation. The model then reasons again with that new information. This repeats until the model emits a stopping response or a guardrail halts it.

The loop is what separates an *agent* from a one-shot completion. Each turn, Claude chooses its own next action based on prior results, so the path isn't fixed in advance. That flexibility is powerful but means you must design the **stop conditions** explicitly: a max-iteration cap, a token/cost budget, a success predicate, or an error threshold.

A robust loop also handles tool failures: a bad result should be surfaced to the model as an observation it can react to, not swallowed. Keep the loop's control logic (limits, retries, escalation) in **deterministic code**, not in the prompt, so a confident-but-wrong model can't talk its way past a hard limit.

## Exam trap

Assuming the model will always decide to stop on its own — without a code-enforced iteration/budget cap, a loop can spin indefinitely or burn cost, and 'the prompt says to stop when done' is not a real guardrail.

## Commonly confused with

- **workflow-vs-agent** — A workflow runs fixed, predefined steps; an agentic loop lets the model choose each next step dynamically.

## Related

- workflow-vs-agent
- human-in-the-loop-gate
- idempotency-and-retries
- mcp
- model-selection

---

Source: Claude Cert Prep — an independent, unofficial CCAR-P study resource (domain P1). Not affiliated with Anthropic.
