How do I get alerted when my AI agent starts costing more than usual?
Rius alerts you when an agent’s cost per trace rises, through a custom alert on the Cost metric scoped to that agent and sent to a webhook, email or Slack channel. A rule such as p95 of Cost above a dollar threshold over a 1 hour window catches runs that got expensive, such as a prompt that grew or an agent stuck retrying. You pick the threshold from what the agent normally costs.
How it works
Cost is a metric in custom alerts. Rius prices each model call at ingest and rolls the cost up per trace, so the alert compares a per-trace figure against your threshold over a rolling window.
- Per trace, not total.
avg(Cost)is the average cost per trace in the window, not the workspace total. The aggregations for Cost are avg, min, max, p50, p95 and p99. - Scoped by filters. A Service filter (
service.name) or an Agent filter limits the rule to one agent. A Model filter limits it to one model. - Rolling window. The window runs from 5 minutes to 24 hours and is shared by all rules in the alert.
- Which aggregation. Use avg to see the typical run drift upward. Use p95 to catch the most expensive 5% of runs, which is where a retry loop or an oversized prompt shows first.
A total-spend or budget threshold for the whole workspace is not an alert metric. Watch that total on the Usage and cost page.
Set it up
- Find the agent’s normal cost. Open the agent on the Agents page and read the tile with its average cost per trace for the window. Set your threshold well above that figure, so ordinary variation does not fire it.
- Create a custom alert and add a filter for the agent, for example
Service = checkout-agent. - Add one rule on Cost. Choose p95 to catch expensive runs, or avg to catch a general rise, and set the operator and your threshold in USD.
- Set the window. One hour is a sensible start: short enough to react the same day, long enough to hold several traces. Widen it if the agent runs rarely.
- Attach a channel (webhook, email or Slack) and set Renotify to off or every N minutes, so a long incident does not go quiet or flood you.
- Confirm the model is priced. A rule over mostly unpriced models can stay quiet without firing, so check cost by model on the Usage and cost page before you rely on the alert.
The finished alert reads like this. Replace the service name and the dollar figure with your own:
FILTERS Service = checkout-agent
RULES p95(Cost) > $2.00
WINDOW 1 hourThe builder shows a plain-language preview of when the alert fires, and that sentence becomes the alert’s description. You can also ask an MCP client to set it up. Telling it “Tell me if p95 cost per trace goes over two dollars” makes it call create_alert_rule. The full cost workflow is in Track LLM and agent cost.
What you get
- A notification in the channel you chose when cost per trace for that agent crosses your threshold.
- A details page for the alert with its generated description, the editable rule, attached channels and every firing. Each firing records the observed value against the threshold, so you see how far over you went.
- The share of the window that was priced, shown on each cost firing, so you can tell a real spike from a partly priced reading.
- An alert you can edit or delete at any time. Deleting it removes its firing history after you confirm.
Costs are list-price estimates in US dollars from LiteLLM’s public model-price catalog. They use each model’s standard rates, so expect your invoice to differ, and set thresholds against the figures Rius shows.
When something else fits
- If you want a limit on total spend for the whole workspace, use the Usage and cost page, since workspace-wide spend is not an alert metric.
- If you want either-or logic, such as cost over one limit or errors over another, create a second alert, because rules in one alert combine with AND only.
- If you also want to know when ingestion stops, add a separate rule such as
Traces count < 1over a generous window.
Related
Still stuck? Get help