Loop Engineering Detection
PromptKing now detects runaway AI loops in CI/CD pipelines before they become billing incidents — within the active session, before the billing cycle ends.
Loop engineering is the dominant agentic pattern in 2026. Engineers design systems that prompt AI agents repeatedly until a goal is met — a PR gets reviewed, a document gets processed, a pipeline completes. That is the right architecture for complex work. The billing problem is what happens when a loop has no stop condition.
CI/CD pipelines have no human pacing mechanism. An agent configured to review every pull request can fire hundreds of times per hour. Token consumption grows quadratically per step in ReAct-style agents — not linearly. Without a MAX_ITER, a cost ceiling, and a stop condition, a single session can consume a month of AI budget in under an hour.
Where loops show up
| Environment | Why it matters |
|---|---|
| GitHub Copilot PR review agents | Triggers on every commit, no idle time, quadratic token growth per review cycle |
| Azure OpenAI multi-step workflows | Orchestrated chains with no native cost ceiling |
| Bedrock and Claude Code agent loops | Agentic sessions running in headless CI mode |
| Internal document processing pipelines | Batch jobs with unbounded iteration counts |
| Scheduled CI/CD automation jobs | Cron-triggered, no human in the loop, no pacing |
| Copilot Studio and ServiceNow agents | Enterprise workflow agents with variable session depth |
What v3.69.0 ships
- Loop Detection Engine — session-level burst detection, CI/CD correlation, runaway pattern identification. Detection happens within the active session, not after billing.
- Severity ranking — Critical / High / Medium / Low ranked by cost impact. Critical fires when active cost escalation is in progress with zero verified outputs.
- SOP classification — every detected loop is classified as GOVERNED, UNGOVERNED, or UNKNOWN based on whether MAX_ITER, a cost ceiling, a stop condition, and an owner are defined.
- Auto-pause governance — pipelines can be paused before the billing cycle ends. When UNGOVERNED fires: alert triggers, pipeline pauses, owner is notified, cost ceiling simulation runs.
- Loop CPSO — Cost Per Successful Loop Completion. Verified output types: merged PR, completed review, resolved ticket, passing test suite. Loop waste rate shows what percentage of loop spend produced nothing.
Competitors track cost after the billing cycle. PromptKing reads the consumption signature and classifies governance maturity within the active session. The SOP checklist surfaces four questions for every detected loop: Is MAX_ITER defined? Is a session cost ceiling set? Is a stop condition defined? Is an owner assigned? If the answer to any of these is no, the loop is flagged UNGOVERNED and the alert fires immediately.
Loop CPSO
A loop that runs 200 iterations and produces nothing is not usage — it is waste.
Loop CPSO (Cost Per Successful Loop Completion) is the metric that answers the CFO question. Not how many tokens did we consume — but what did those tokens actually produce. The loop waste rate shows the percentage of total loop spend that generated zero verified outputs. Both metrics appear in the CFO report section for the first time in v3.69.0.
What's next
Per-pipeline daily budgets, MAX_ITER enforcement, auto-pause triggers, and owner notification workflows. Simulate before you enforce — model what last month's loops would have cost with the policy applied.
Loop waste rate, cost per successful completion, and ungoverned loop spend as a dedicated section in the CFO report. The number that moves the conversation from cost management to outcome accountability.
Unified cost map across Claude, Copilot, Gemini, Bedrock, and Watsonx showing where loop spend originates by vendor, model, and pipeline.