← Zurück zu ERP-Systembauer
Entdecke, wie der Skill hilft
Kostenanomalien erkennen
Erklärt ungewöhnliche Ausgaben anhand von Aufgabenmenge, Wiederholungen, Modellmix, Promptwachstum und Cacheverhalten.
cost-anomaly-detection
Teammitglieder mit diesem Skill
Wann ist der Skill hilfreich?
Nutze diesen Skill, wenn steigende AI-Kosten aus der Gesamtsumme nicht erklärbar sind.
Wobei hilft er dir?
- Vergleicht Ausgabentempo und Effizienz mit passenden historischen Werten.
- Gliedert Zunahmen nach Mandant, Lauf, Modell und Vorgang.
- Liefert Diagnosen für vorhandene begrenzende Ausführungskontrollen.
Das könntest du fragen
Untersuche den gestrigen Kostensprung und trenne mehr Nachfrage von Wiederholungen, größeren Prompts und schlechterer Cachenutzung. Vergleiche gleiche Aufgabenmengen an beiden Tagen. Benenne kostentreibende Läufe und unterscheide zusätzliche Nachfrage von wiederholten Anbieteraufrufen.
Ausführliche Dokumentation
Hier findest du die ursprüngliche Anleitung, Beispiele und Prüfschritte des Skills in ihrer Originalsprache.
Weniger anzeigen
Cost Anomaly Detection
Sudden cost spikes rarely look like normal growth. They usually stem from a specific pathology: an infinite retry loop, a broken prompt cache prefix, a runaway subagent tree, or an unauthenticated endpoint leak.
Workflow
- Monitor structural efficiency ratios alongside raw spend:
- Track per-model, per-agent, and per-tenant health indicators over rolling windows (5m, 1h, 24h):
- Prompt cache hit ratio: $\text{cache_read_input_tokens} / \text{total_input_tokens}$. A sudden drop from
85%to5%after a deploy indicates a dynamic timestamp or UUID was injected near the start of the system prompt. - Cost per completed task: $\text{Total Run Cost} / \text{Completed Tasks}$. Spikes indicate excessive turns, tool-call loops, or high failure/retry rates.
- Retry amplification factor: $\text{Total Provider Calls} / \text{Logical Steps}$.
- Input-to-output token ratio: Unusually large input growth across consecutive turns within a single
runIdsignals unbounded context accumulation or huge tool outputs being dumped into context.
- Prompt cache hit ratio: $\text{cache_read_input_tokens} / \text{total_input_tokens}$. A sudden drop from
- Track per-model, per-agent, and per-tenant health indicators over rolling windows (5m, 1h, 24h):
- Baseline comparison and velocity checks:
- Compare current window spend velocity (
microsPerMinute) against:- Rolling historical baseline for the same tenant/workflow (seasonality-aware day-of-week / hour-of-day median and MAD/IQR).
- Absolute velocity circuit breakers (e.g., a single task run exceeding
$Xin 60 seconds orNconsecutive identical tool calls).
- Compare current window spend velocity (
- Produce actionable diagnostic payloads:
- When flagging an anomaly, never emit a vague
"Cost is high"alert. Include the top contributing dimensions:- Top
tenantId,taskId/runId,agentRole,model, andoperationTyperesponsible for the delta. - Decomposition of the spike: volume change (more requests), mix shift (switching from a small model to a frontier model), size inflation (larger prompts/outputs), or cache collapse (lost cache hits).
- Top
- When flagging an anomaly, never emit a vague
- Coordinate automated containment:
- Feed runaway loop signals (
maxTurnsExceeded, repeated identical tool errors, velocity breach) into the budget reservation circuit breaker to pause the offendingrunIdorapiKeyIdwithout taking down healthy tenants.
- Feed runaway loop signals (
Anti-Patterns to Avoid
- Alerting only on daily/monthly totals: Waiting 24 hours to detect a runaway loop that spends
$50/hour. - Global-only thresholds: A
$10/hourspike on a small workspace gets masked by aggregate platform traffic unless baselines are evaluated per tenant and per workflow.
Enthaltene Dateien 1
SKILL.md
