Platform

Loop Termination

Recursive agent patterns, runaway tool calls, and circular reasoning loops are detected and terminated automatically — before cost compounds. Zero intervention required.

Detection patterns

repetitionThe same prompt or tool call is made ≥3 times within a session.
high_frequencyCall rate exceeds your configured threshold (default: 60 calls/min).
cost_runawaySpend velocity exceeds 10× the rolling average for this agent.
circularTool A calls tool B which calls tool A — graph cycle detected.

Termination response

{
  error: 'LoopDetected',
  loopDetected: true,
  pattern: 'cost_runaway',  // 'repetition' | 'high_frequency' | 'circular'
  terminatedAt: '2026-05-12T10:23:44Z',
}

Configuration

Thresholds are configured per agent in Dashboard → Agent Fleet → Agent settings. You can also set a global workspace default, or disable loop detection for specific agents that legitimately make repetitive calls.

← Margin EnginePrompt Intelligence →