Cost Management
Autowright treats AI spend as a first-class output. Every fix attempt records what it actually cost — not an estimate — so you always know what self-healing is worth to you.
The cost model
Each fix attempt captures, from the agent run itself:
| Metric | What it is |
|---|---|
| Cost (USD) | Real dollars for the attempt |
| Tokens | Input, output, and cache tokens separately |
| Turns | Agent conversation turns used |
| Duration | Wall-clock time for the attempt |
A trivial selector fix lands around $0.09. Harder fixes cost more turns and more tokens — and you’ll see exactly how many.
Where costs surface
- Slack — every fix-proposed and needs-attention message carries the attempt’s cost, turns, and duration.
- Dashboard overview — running totals: Total cost across all fixes and Avg/fix with total turns.
- Fix detail page — the full breakdown per fix: USD, turns, duration, and input/output/cache token counts.
The levers
Deduplication is the big one
The largest cost risk isn’t an expensive fix — it’s paying for the same fix
repeatedly. A cron script hitting a broken selector all night reports dozens
of failures; dedup by error hash collapses them
into one fix job. The window is AUTOWRIGHT_DEDUPE_TTL_MS (default 24
hours) — lengthen it for slow-moving fleets, shorten it if sites you scrape
change multiple times a day.
Concurrency caps burst spend
MAX_CONCURRENT_FIXES (default 2) bounds how many agent runs can bill at
once. A site redesign that breaks ten scripts simultaneously queues ten jobs —
the cap decides whether that’s ten parallel agent bills or a steady trickle.
Turns are bounded
Every agent run is capped at 50 turns. An attempt that can’t converge stops
there and reports CANNOT_FIX with what it learned — it can’t spiral.
The confidence gate prevents churn
Low-confidence attempts don’t open PRs, so you never pay review time (or
CI minutes) on speculative fixes. A CANNOT_FIX verdict still costs its
attempt — but it delivers a diagnosis, which is usually the cheap part of the
incident anyway.