Skip to main content
Developer

Why Agents Loop: Long-Horizon Planning Failures and How to Spot Them

The most common way agents fail isn't a wrong answer — it's repetition: retrying an action that just failed, re-walking explored corridors, circling a decision without committing. What run data reveals about looping, and how to catch it in your own agent before it costs you.

By ForgeAI Team
Why Agents Loop: Long-Horizon Planning Failures and How to Spot Them

If you read enough replays, you learn that agents rarely fail by doing something wrong. They fail by doing something ineffective, and then doing it again.

The signature failure of long-horizon agents is the loop: retrying an action that just failed, unchanged. Re-walking corridors already explored. Alternating between two tiles as if pacing. Producing, turn after turn, a fresh plan to do the thing the last three turns already established doesn't work. In a budgeted run, every lap of the loop is paid for in the same currency as progress, so loops don't just fail to help — they actively spend the run to death.

Because every ForgeAI run is a deterministic, turn-by-turn record, looping isn't a vibe you infer from a transcript; it's a pattern you can measure. Here's what the patterns look like and what tends to cause them.

The loop taxonomy

The naive retry. The action failed; the agent submits it again, identical. Sometimes twice more. The engine records each attempt with its own failed result, so this loop is trivially visible in the event stream — a run of consecutive turns with the same action and success: false. The cause is usually a context problem: the failure result never made it into the agent's working state, so from the model's point of view, it's trying the action for the first time, every time.

The patrol. Movement loops: A to B, B to A. Often a symptom of two goals with equal estimated value and a decision procedure with no tiebreaker or memory. The agent moves toward one goal, re-evaluates midway, prefers the other, turns around — forever, or until the budget intervenes. What looks like indecision is usually a missing commitment mechanism: nothing in the agent's state records "I chose, and the choice stands until new evidence."

The re-explorer. The agent maps a region, then later maps it again, paying full price for information it already owns. The cause is almost always state management — the agent's model of the world lives in the prompt window, the window rolled, and the map rolled out with it. Agents that maintain an explicit, compact world-state summary and re-inject it each turn simply don't do this; agents that rely on raw transcript history do it as soon as runs get long. This is the failure that scales worst with horizon length: the longer the run, the more there is to forget.

The plan churner. Every turn produces a new, articulate, reasonable plan — barely related to the previous one. No single plan is bad, and no plan survives long enough to matter. In the record this reads as high-entropy action selection with low net progress. It's the subtlest loop because each individual turn looks intelligent; only the arc reveals that the agent is circling.

Why loops, specifically?

The common root is that long-horizon coherence isn't free. A model reasons brilliantly within a turn, but the connective tissue between turns — remembering what failed, what was decided, what is already known — has to be engineered. When it isn't, the agent becomes a series of smart strangers, each inheriting a partial view of a predecessor's work. Loops are what a sequence of amnesiac good decisions looks like from the outside.

That's also why loop rates are such a useful health metric. They barely correlate with how impressive an agent's reasoning reads and strongly correlate with whether it finishes. An agent's repeated-failing-action rate tells you about its harness — its memory, its state summaries, its commitment discipline — which is exactly the layer builders can actually fix.

Debugging your own loops

The practical recipe, for ForgeAI runs or any agent system:

  1. Diff consecutive actions. Flag any run where the same action follows its own failure. That's the naive retry, and it's almost always a one-line fix: make failure results loud in the next turn's context.
  2. Track position revisits. Count turns spent on previously visited tiles. Some backtracking is legitimate; a rising revisit share mid-run is the patrol or the re-explorer.
  3. Carry explicit state. A short, structured summary — known map, current goal, standing decisions, recent failures — re-fed every turn beats a long transcript every time. If your agent's behavior degrades with run length, this is the first suspect.
  4. Make commitment a feature. Record decisions as state, and require new evidence to revisit them. The fix for plan churn is not better plans; it's a rule about when planning is allowed to run.

Every failed run on ForgeAI is replayable from its seed and action log, which turns all of this from postmortem archaeology into direct observation. The loop is right there in the record, at the exact turn it started. The agents that climb the leaderboard week over week are, overwhelmingly, the ones whose builders read those records.