Back to the blog

November 24, 2026 · 10 min read · Agentic AI · Architecture · Production

Agentic Loops: Plan, Act, Observe, Reflect — Until the Work Is Done

A single model call is an answer. An agentic loop is a cycle of work: plan, act, observe, reflect, then repeat until the task is done or a rule stops it. Here is how I treat that loop in production.

Yassine Aqejjaj · HEAD OF AI · Updated on November 24, 2026

An agentic loop is a model that keeps going after the first answer: it plans, acts with a tool, observes the result, reflects on whether the goal is met, and repeats until the work is done or a stop rule ends the run. In production, that loop is what you trace, limit, evaluate and govern, not the model alone.

What is an agentic loop?

A chatbot answers once. An agent is a model placed in a loop and given tools. It reads a goal, chooses a next step, calls a tool, looks at what came back, and decides whether to continue. That cycle — plan, act, observe, reflect — is the agentic loop. The model is only one part of it. The loop is the unit of work.

The four stages in the card above are the core of the cycle. In my article on the AI agent mind map, I also name two bookends: perceive, at the start, when the agent reads the goal and the context, and respond, at the end, when it hands a result back to a person. The loop in between does not change. This article is about that loop as a production object: how to bound it, how to see it, and how to tell whether a new version is really better.

A glowing blue loop on a dark background with four steps: Plan, Act, Observe, Reflect, connected to tools and memory, and an exit to Done.
The agentic loop: plan, act, observe, reflect, then repeat until a stop rule says the work is done.
  1. Plan
  2. Act
  3. Observe
  4. Reflect
Memory and feedback flow back from reflect to plan. A stop rule closes the loop when the work is done, or when a limit is hit.

How is a loop different from a single model call or a workflow?

A single model call has one path: a prompt in, an answer out. A fixed workflow also has a path, but people wrote the steps in advance. A loop is different because the model chooses the next step at run time. That is why it can finish work that you cannot fully specify, and why it can also wander, repeat itself or take an action nobody intended.

I wrote about that choice in my article on agentic AI, RAG and workflows: if you can write the steps down, start with a workflow, and add an agent only when a simpler option has been measured and falls short. The loop is not a badge of sophistication. It is a transfer of control, and it has a cost in traces, limits and evaluation.

What happens in each stage — plan, act, observe, reflect?

Naming the stages is useful because each one fails in its own way, and each one needs its own log line, limit or test.

  • Plan: choose the next step, given the goal, the context and the tools you actually exposed. Failure here is a plan that does not fit those tools, or a plan so vague that the next action is a guess.
  • Act: call a tool or an API, or write a file, or ask a person to approve. Failure here is the wrong tool, the wrong arguments, or an action that should have required approval and did not.
  • Observe: read the result as data, not as instructions. Failure here is trusting a result that was empty, wrong, stale or hostile — including a page or a ticket that tries to redirect the agent.
  • Reflect: ask whether the goal is met, whether to retry, whether to escalate, or whether to stop. Failure here is looping without progress, or declaring the work finished when it is not.

When should the loop stop?

A loop without a stop rule is not autonomous. It is unfinished. Before the first user arrives, write down what “done” means and what happens when “done” cannot be reached: a maximum number of steps, a token or cost budget, a time limit, and a path to a person when the agent is stuck or about to do something irreversible.

Reflection is not a substitute for that rule. Asking a model whether it should continue often produces a polite yes. For anything with consequences I prefer a check that does not share the generator’s blind spots: a verifier, a deterministic rule, or a test. The stop rule closes the loop from the outside, even when the model would rather have one more turn.

What do memory and feedback do inside the loop?

The card shows a return arrow under the four stages, labelled memory and feedback. That arrow is the state of the run: the goal, the steps already taken, the tool results, and the reasons for retrying. Without it the agent plans each turn as if the previous one had not happened. With too much of it, the context window fills up and the plan starts to drift.

This is short-term memory, the context of one task, not the long-term store I describe when I write about context engineering. The practical rule is the same in both places: store provenance next to the content, treat tool output as untrusted data, and decide in advance what may be forgotten. A summary of the last steps is often more useful than the raw transcript of every call.

Which failure modes should you design for?

Most loops I review do not fail because the model cannot write a sentence. They fail because the cycle has no bound, no trace, or no honest observation. The table is the specification I would put next to the first design, not a checklist to add later.

Failure modeWhat it looks likeControl I look for
Infinite loop or no progressThe agent retries the same step, or takes new steps that do not move the goalA maximum number of steps, a stop rule, and an alert when the limit is hit
Wrong tool or argumentsThe call fails, or it succeeds on the wrong objectClear tool names, strict schemas, and a tool-call error rate in the traces
Blind observationEmpty, wrong or hostile tool output is trusted and folded into the next planTreat tool output as data, never as instructions, and include injection cases in the evaluation set
Context overflowThe window fills, early constraints disappear, the plan driftsSummarise and trim the run history, and log tokens per step
Runaway costMany turns, many tools, a bill that nobody budgetedToken and cost budgets per run, with an alert on outliers

What have I measured when this loop ran in production?

I can talk about a platform that runs work as this kind of loop, not about a controlled experiment that isolates the loop from everything around it. NOVA Suite, the agentic platform I lead, plans a request, acts through specialist agents, observes results against governed context, and reflects through evaluation before a deliverable is handed back. The figures below are published on the NOVA page. They measure the platform in use, not the loop in isolation.

NOVA Suite is deployed to 800 employees at Devoteam. The published task success rate is 92%, and task execution time is 42% lower than the baseline used for that measurement. A high success rate with a shorter execution time is what I want from a loop that stops for the right reason, but I will not pretend those two numbers prove the four stages on their own. Orchestration, context and evaluation all sit around the same work.

In what order should you build the loop?

The card shows the whole cycle. It does not tell you the order, and order is where projects are won. This is the sequence I would follow today.

  • Write the task and the stop rule first: what is done, and when must the agent give up or escalate.
  • Build one agent with two or three tools, and turn tracing on from the first run. You cannot fix a loop you cannot replay.
  • Create the evaluation set before adding features, so every change to the prompt, the tools or the stop rule is measured. I explain that method in my article on evaluating multi-agent systems in production.
  • Add memory only when a measured failure needs it, and give it provenance.
  • Add approvals in proportion to the action surface. A loop that only drafts a paragraph is not the same as a loop that writes files or calls a production API.
  • Add more agents last, and only when a single agent has clearly hit its limit. A second agent is another loop to trace, not a shortcut around the first one.

FREQUENTLY ASKED QUESTIONS

What is an agentic loop?

It is the cycle a production agent runs: plan the next step, act with a tool, observe the result, reflect on whether the goal is met, and repeat until the work is done or a stop rule ends the run. The model is only one part of that cycle.

How is an agentic loop different from a chatbot or a workflow?

A chatbot answers once. A workflow follows steps people wrote in advance. In a loop, the model chooses the next step at run time. That is useful when the path cannot be fully specified, and risky when there is no stop rule, no trace and no evaluation.

How do you stop an AI agent from looping forever?

Define what “done” means, set a maximum number of steps and a token or cost budget, add a path to a person when the agent is stuck, and alert on runs that hit the limit. Do not rely on the model alone to decide whether it should continue.

Do you need several agents to have an agentic loop?

No. One agent with a few tools already runs a loop. Several agents mean several loops plus coordination. Start with one, measure where it fails, and split only when a single agent has clearly reached its limit.

How do you evaluate an agentic loop?

Evaluate the run, not only the final text: tool choices, progress, cost, latency, safety and whether the stop rule fired for the right reason. Use fixed scenarios, keep traces so failures can be replayed, and compare a new version with a baseline before you ship it.

RESULTS

800

employees use NOVA at Devoteam

92%

task success rate (NOVA Suite)

−42%

task execution time (NOVA Suite)

4

stages in the loop: plan, act, observe, reflect

THE CODE

TrustRail ↗

KEEP READING

Building Enterprise Agentic Platforms: Lessons from NOVAAI Operating Model: From Experiments to Enterprise AdoptionEvaluating Multi-Agent Systems in ProductionContext Engineering: Beyond Traditional RAGWhat Is an AI Factory? How to Set One Up Inside a Large OrganisationAgentic AI vs RAG vs Workflows: How to ChooseSovereign Generative AI for the Public Sector: Lessons from DILAAI Agent Governance: Policies, Human Approval and Signed ReceiptsMCP in the Enterprise: Connecting Agents to Confluence, Jira and Microsoft 365 SafelyEarned Autonomy: Governing AI Coding Agents Across the SDLCThe AI Agent Mind Map: From Idea to ProductionLangGraph, CrewAI, OpenAI, Google, Microsoft, Claude: which agentic orchestration framework should you choose?MCP: One Interface, Many Tools — What the Protocol Does and What It Does NotSubagents and Multi-Agent Systems: When to Split the Work, and How to Merge ItAI Gateway: One Control Plane, Many ModelsInference Economics: Tokens, Cache and Model Choice Drive the BillEvals: The Ship-or-No-Ship Test for a Single Agentic LoopGuardrails: Filters on What Goes In and What Comes Out of the LoopObservability: Seeing and Replaying the Loop, Not Just Scoring ItThe Agent Harness: You Own the Loop, the Vendor Ships the Model

Figures come from validated client results and from my role at Devoteam. The projects on GitHub are public betas.