Skip to Content
Rius

My AI agent suddenly costs more. How do I find the cause?

Rius shows where your agent’s cost went up: open the Agents page, find the jump in cost per trace, then read the most expensive traces to see which model, token count or retry caused it. Rius prices every model call from its model and token counts, so each agent, trace and span carries its own cost. You narrow a spike from the agent, to a run, to a single call. The same path works whether the cause is a bigger prompt, a different model or a retry loop.

How it works

Rius prices each model call when it arrives, from the requested model and its token counts, including prompt-cache reads and writes. It then rolls that cost up per trace, per agent and per end user. A cost increase comes from one of a few things, and each leaves a mark in the spans:

  • More tokens per call. Input tokens on the model-call spans climb, often because history or tool output keeps getting appended to the prompt.
  • A different model. The requested model on the span changed, for example after a release, and a different model has a different price.
  • More calls per run. A retry or a loop adds spans to each trace. Back-to-back calls of the same tool or step collapse into one row such as fetch_article · 3 attempts · recovered.
  • A different mix of users or traffic. One end user or one agent may account for the growth.

Costs are list-price estimates in US dollars, so use them to find the change, not to reconcile an invoice. If a model has no price, its cost is empty rather than zero, so a spike from an unpriced model shows up in token counts instead.

Set it up

  1. Find the agent. Open Agents, pick a window such as 7d or 30d, and scan the Cost column. Open the agent that stands out. Its Cost tile shows total and average cost per trace, and the Drift chart for cost per trace shows the day the jump began.

  2. Check whether a release caused it. If you tag runs with an agent version, Versions and Compare put two versions side by side on cost per trace, tokens per trace and latency, so a new prompt or model shows up from the day it shipped. Set the version before your next deploy:

export RIUS_MAIN_AGENT_VERSION=prompt-v12
  1. Open the expensive runs. Use View all in Traces on the agent page to open Exploring traces filtered to that agent, and set the time range around the jump. Compare the cost column of runs before and after it. For single calls, switch to the Spans tab, filter the kind to LLM and click the Cost header to sort.

  2. Read the costliest trace. The trace header shows total cost. Open the Map tab and switch to the cost lens to see which step took the money. Back in the tree, check the context growth strip: it plots input tokens per model call in order, so a runaway prompt shows as bars that keep rising. Click a bar to select that call.

  3. Inspect the call. In the span detail, the Model section lists requested and response model, input and output tokens, and cost. On the Input / Output tab, Since previous llm call shows what each step added to the prompt, so a growing history or a pasted tool result stands out.

  4. Compare with a normal run. Use compare runs on the open trace against another run of the same agent. It shows which steps were added or dropped and where cost moved.

  5. Rule out one customer. If you tag end users with user.id, open the Users page and sort by Cost to see whether one user drives the increase.

What you get

  • A short path from symptom to cause: agent, then drift chart, then trace, then span.
  • The day the cost per trace changed, and the version that shipped that day if you tagged versions.
  • The step that spent the money, from the cost lens on the map and the cost sort on the Spans tab.
  • The reason for the jump in the span itself: a different model, input tokens that grow call after call, or a retry chain with several attempts.
  • A rule to catch the next one. Cost is a metric in custom alerts, measured per trace, so you can be told when cost per trace goes over a threshold you choose. For the full pricing model and every place cost appears, see Track LLM and agent cost.

When something else fits

  • If the agent is fine but the workspace total rose, start on the Usage and cost page and read cost by model before opening any agent.
  • If the cost on the spans looks flat but your invoice rose, remember that Rius shows standard list prices, not discounts, batch or long-context tiers, so the difference may sit outside the traces.
  • For the wider routine of watching errors, latency and cost together, see Monitor AI agents in production.

Still stuck? Get help

Last updated on