Skip to content

Expensive Loop

Detector key: expensive_loop · Source: runtime · Severity: low → high · Suspicion: 70–92

Agents get stuck. They call the same tool with the same input, get the same error, and try again — no backoff, no escalation, no progress — until the run times out or the budget is gone. Nothing throws; you just get a big bill.

The detector fires on either signal, at a threshold of 3:

  1. Retry spike — any step with retryCount >= 3.
  2. Repeated identical calls — the same tool step (same label + same inputSummary) appears 3 or more times in the run.

The score scales with the number of repeats and is capped at 92:

score = 70 + min(repeats, 6) × 3 (max 92)

Severity follows suit: high at ≥6 repeats, medium at ≥3.

If the run carries a cost (metadata.costUsd or cost_usd), Lumni estimates the spend attributable to the redundant repeats and includes it in the summary:

wasted ≈ cost × (repeats − 1) / repeats
trips expensive_loop
{
"metadata": { "costUsd": 0.90 },
"steps": [
{ "stepKind": "tool", "stepName": "search_orders", "inputSummary": "{ q: 'latest' }", "status": "failed" },
{ "stepKind": "tool", "stepName": "search_orders", "inputSummary": "{ q: 'latest' }", "status": "failed" },
{ "stepKind": "tool", "stepName": "search_orders", "inputSummary": "{ q: 'latest' }", "status": "failed" }
]
}

Lumni reports:

Runaway loop: “search_orders” repeated 3× with no progress — The agent retried “search_orders” 3 times without changing inputs or making progress, with no escalation or backoff. Estimated wasted spend: $0.60.