Skip to Content

How do I get alerted when my agent suddenly costs more?

Rius alerts you on a cost jump with a custom alert on the Cost metric, for example p95(Cost) > $2.00 over a 1 hour window. Cost is measured per trace, so the alert fires when runs get expensive, such as a prompt that grew or an agent stuck retrying. When it fires, the firing page shows the observed value against your threshold and links to the affected traces. Pre-defined alerts cover errors and loops, not cost.

How it works

Rius prices each model call from its model and token counts, so a trace carries the cost of every call whose model has a known price. The cost figures are list-price estimates in US dollars. A custom alert puts a threshold on that number, evaluated over a rolling window.

  • The rule. Pick the Cost metric and an aggregation: avg, min, max, p50, p95 or p99. Aggregations are per trace, so avg(Cost) is the average cost of a trace in the window, not the workspace total. Use a percentile such as p95 to catch a few runaway runs, and avg to catch a general shift.
  • The window. Choose between 5 minutes and 24 hours. A short window reacts faster. A long window smooths out single expensive runs.
  • The scope. Add filters such as Service, Agent, Step, Model or Session to watch one agent or one model. Filters are applied before the aggregation, so a Step or Span kind filter counts only the matched spans’ own cost. Cost lives on model-call spans, so filter Step to an LLM span name, not to a tool or agent step.
  • The threshold. A fixed value in dollars, not a learned baseline, so pick a number a bit above your normal level.
  • Timing. Rules are checked every minute while they have no open firing and every five minutes while one is open, so timings are approximate to that cadence.

Cost alerts are only as complete as your pricing coverage. A call whose model has no known price carries an empty cost, not zero. A rule over mostly unpriced models can stay quiet without firing, so check cost by model on Usage and cost before you rely on the alert. Firings show the share of the window that was priced.

Set it up

  1. Open the Alerts page and create a custom alert. Creating alerts is an admin action. The Custom alerts page covers the builder and every metric.
  2. Add a filter for the agent you care about, for example Service = checkout-agent.
  3. Add one rule on Cost, with an aggregation and a threshold. The builder shows a plain-language preview of when the alert fires. This is the rule from the cost guide:
FILTERS Service = checkout-agent RULES p95(Cost) > $2.00 WINDOW 1 hour
  1. Set the window. For a quick signal on a busy agent, try 15 minutes. For a steadier signal, use an hour or more.
  2. Attach a distribution channel (webhook, email or Slack) so the firing reaches you. Every firing is delivered to each channel attached to the alert.
  3. Set Renotify if you want reminders. Off sends one notification per firing. Every N minutes, from 5 to 1440, repeats it until someone acknowledges the firing or it resolves.
  4. Optionally pair it with a second alert. Rules inside one alert combine with AND only, so for an either-or condition, such as an avg rule and a max rule, create two alerts.

Over the Rius MCP server, your client can also set the rule up with the create_alert_rule tool. The Track LLM and agent cost guide shows example prompts.

What you get

When the rule matches, a firing opens and notifies your channels. Here is where to look next:

  • The firing page. It records the observed value of each rule against its threshold, when the firing opened, when the condition was last seen, and the affected traces, each linked to the trace view. A delivery list shows the outcome for each channel.
  • View all in Traces. This opens the trace list filtered to the firing’s time window. Cost per trace is shown in the list, and the Spans tab sorts individual calls by cost, so you can find the expensive run or call.
  • Cost by model. On Usage and cost, the total cost tile compares against the previous period, and the cost-by-model panel shows which model drove the jump.
  • Coverage. The share of the window that was priced is shown on the firing, so you can tell a real spike from a partly priced reading.
  • Acknowledge. Any member can acknowledge a firing. That records who saw it and stops further notifications. The firing resolves on its own once the condition has stopped matching for two hours. If it returns later, it is a new firing.

See Alerts for firings, acknowledgment and the optional root-cause analysis on a firing.

When something else fits

  • A total-spend or budget threshold for the whole workspace is not an alert metric today. Watch workspace spend on Usage and cost instead.
  • If the spike comes from errors or an agent looping rather than expensive calls, the pre-defined Consistent Error Pattern, Swallowed Error and Tool Loop alerts fit better.
  • Your invoice from a model provider can differ from what Rius shows, because Rius uses list prices and applies no negotiated discounts or batch pricing.

Still stuck? Get help

Last updated on