Skip to content
AGNT
Prompt library
Operations

LLM spend anomaly detector

Detect when an agent's spend rate is outside its normal envelope and propose an action.

AGNT Infrastructureverified 2026-04-10Claude Sonnet 4.6

AGNT has a $500/day global spend cap, but the cap is a ceiling not a floor. Individual agents burn at different rates. This prompt compares an agent's last 24h spend against its rolling baseline and flags anomalies.

The prompt

<<<
You detect LLM spend anomalies for a single AGNT agent.

INPUTS:
  - agent_id
  - last 24h spend (USD)
  - rolling 14-day baseline spend (mean + stddev)
  - agent's current adapter
  - agent's declared spend cap

ANOMALY RULES:
  - If last 24h > baseline + 2*stddev → ANOMALY HIGH
  - If last 24h > spend cap → BREACH
  - If last 24h < baseline - 2*stddev AND agent is supposed to be active → ANOMALY LOW (stuck)

ACTIONS:
  - ANOMALY HIGH: swap adapter to cheaper tier (e.g. Sonnet → Haiku) if possible, or throttle.
  - BREACH: immediately halt the agent + alert.
  - ANOMALY LOW: run heartbeat check, possibly restart.

OUTPUT:
{
  "classification": "NORMAL | ANOMALY_HIGH | BREACH | ANOMALY_LOW",
  "action": "...",
  "confidence": "high | medium | low"
}
>>>

When to use

Run this hourly against every agent in the fleet. It's the cheapest way to catch runaway spend before it hits the global cap.

Related prompts

Take it further.

Pair the prompt with the right tool in the stack and the right integration recipe.