Summary
Runaway LLM workflows can rack up hundreds of dollars in unexpected API costs. Implement multi-layer timeout protection at job level (GitHub Actions timeout-minutes), request level (max_tokens), and input level (sample size limits) to cap costs at predictable levels. For scheduled scans: $0.12/scan × 120 scans/month = $14.40/month maximum.
The Problem
Autonomous LLM workflows in CI/CD can enter infinite loops, process excessive files, or generate bloated responses, leading to surprise bills of $100+ from runaway API usage. Without hard limits, a single misconfigured job can consume an entire monthly budget in hours.
The Solution
Set strict timeout limits at multiple layers: GitHub Actions job-level timeouts (15 min), LLM request-level token caps (max_tokens: 4096), input sample size limits (50 files max), and model selection (fast, cheap Sonnet). This creates fail-safe protection where even if one layer fails, others prevent cost explosions.

