Diagrid

The Evolution of AI Agents · Chapter 6 of 7 · Stage 6 — The agent loop · 2020s

The Emergence of the Agent Loop

Mark Fussell

Mark Fussell

Co-Founder & CPO, Diagrid · September 3, 2026

The agent loop at a glance · 2020s

What owns the control flow
The model, one decision at a time
What it added
A dynamic, probabilistic next action - the path emerges as the task runs
What it could not do
Survive the process running it
Agent equivalent
This is the agent equivalent

An agent loop, also called an agentic loop, is the cycle at the core of every AI agent: observe the current context, reason about what to do next, choose an action, execute it, update the context, and repeat until the goal is complete. It is a familiar software shape with one new part: the decision in the middle is made by a language model, so the path emerges as the agent runs.

Into the 2020s. The Emergence of the Agent Loop

Many modern agent frameworks reduce, at some level, to another variation of the same basic pattern. An agent observes the current context, reasons about what to do next, chooses an action, performs that action, observes the result, updates its context, and repeats until the goal is complete.

In simplified form:

while not goal_complete:
observe()
reason()
choose_action()
execute_action()
update_context()

Conceptually:

The agent loop: observe, reason, choose an action, execute it, update context, and repeat until the goal is judged complete.
The agent loop: observe, reason, choose an action, execute it, update context, and repeat until the goal is judged complete.

This is where the similarities to earlier software loops become interesting. Like a game loop, the agent maintains a changing state from one iteration to the next. Like a Linux event loop, it may spend long periods waiting for something external to happen. Like a Kubernetes control loop, it is trying to move from the current state toward some desired outcome. The difference is that the step that determines what happens next is driven by a language model making probabilistic choices.

The Agent Loop Is a Goal-Oriented Control Loop

The Kubernetes analogy is particularly useful because both systems are driven by an outcome. A Kubernetes controller effectively says: “Here is the state I want. Keep acting until reality matches it.” An agent says something more along the lines of: Here is the goal I want to achieve. Keep reasoning and acting until you believe it is complete. It is probabilistic.

The obvious caveat is that a Kubernetes controller usually follows deterministic reconciliation logic written by a developer, while the agent may allow an LLM to choose the next action. That difference is enormous. But it also gives us a useful way to think about agents.

That framing makes the agent feel less alien than it first appears. The loop itself is familiar. What is new is the “intelligence” in the middle.

Agents are loopy. The LLM Changes the Nature of the Loop

Traditional procedural loops are mostly driven by deterministic logic. In a Windows application, a specific message invokes a specific handler. In a game, a known state transition usually produces a known effect. In a Kubernetes controller, reconciliation logic is explicit in code.

An agent introduces a different kind of decision point:

An agent's decision point, where a language model - not fixed code - chooses which action comes next.
An agent's decision point, where a language model - not fixed code - chooses which action comes next.

The answer can vary. The agent may choose one tool rather than another. It may ask for more information. It may revise its plan. It may decide that an earlier assumption was wrong. It may conclude that the goal has been reached. It may go on forever, inspecting its virtual belly button.

This makes the loop much more flexible, and that is the utter brilliance of the whole thing. However, it also makes the execution path much harder to know in advance. A traditional workflow might be:

A traditional workflow as a fixed, known-in-advance sequence of steps.
A traditional workflow as a fixed, known-in-advance sequence of steps.

An agent will behave more like:

An agent's execution path emerging step by step as it reasons, calls tools, revises its plan and changes direction.
An agent's execution path emerging step by step as it reasons, calls tools, revises its plan and changes direction.

The path emerges as the task progresses. And that matters enormously when the loop is long-running.

Why this matters if you are building agents

This is the chapter to send to anyone asking how AI agents work under the hood. Strip the framework branding off LangGraph, CrewAI, Strands, Google ADK or Microsoft Agent Framework and you find variations of the same five lines - the observe-reason-act cycle, often called the ReAct loop. Whatever else differs between autonomous AI agents, the AI agent architecture at this layer does not. The differentiation is not the loop.

The differentiation is what the loop does under failure. An emergent execution path is a feature right up to the moment you have to answer which steps already ran? - and that question is Chapter 7.

Frequently asked questions

About the author

Mark Fussell — Co-founder and Chief Product Officer of Diagrid and co-creator of Dapr. He was a Windows 3.0 developer in the early nineties — the message loop in Chapter 2 is his, not a history lesson — and has spent the three decades since on distributed systems, most recently making them durable for agents.

LinkedIn

Read next

Chapter 7 is the one the whole series walks toward. The loop has been running for forty-five minutes. The next action is to issue the refund. Then the process crashes.

Chapter 7: The durable agent loop

All seven chapters are live.

Read The Evolution of AI Agents end to end, or get the next special project when it ships.