Skip to Content

My AI agent makes more LLM calls than usual. How do I find the cause?

Rius shows where extra LLM calls come from: open the agent on the Agents page, then a costly recent trace, and read its spans for retries, loops and growing prompts. Cost per trace and tokens per trace on the agent page tell you when the rise started. The trace waterfall tells you which step makes the extra calls. For more on watching agents in general, see Monitor AI agents in production.

How it works

Extra calls leave three kinds of marks in Rius, and each lives in a different place.

  • On the agent page. Open the agent in Agents. The Drift charts plot cost per trace over time, so a step up shows the day behavior changed. Versions and Compare put two versions side by side on cost per trace and tokens per trace. More calls per run raise both. The error rate also matters: a high Error rate with few Failed traces means the agent recovers through retries or fallbacks, which costs time and money without breaking the result.
  • In the trace. Open a trace from Recent traces. The waterfall badges each span by kind (chain, llm, tool) and shows token counts on LLM spans. Back-to-back calls of the same tool or step collapse into one row such as fetch_article · 3 attempts · recovered, so a retry loop reads as one event. Expand the row to see each attempt.
  • In the prompt. For a trace with several LLM calls, the context growth strip plots input tokens per call in order. A climbing bar means history is growing with every step. On an LLM span with captured messages, Since previous llm call on the Input / Output tab marks what each step added, removed or changed.

The Exceptions section on the agent page groups errored spans by failure type, such as llm request failed. If one group dominates, retries after that failure are a likely source of the extra calls.

Set it up

  1. Tag your versions so you can compare before and after a release. Set them in the environment of the agent process:
RIUS_MAIN_AGENT_VERSION=prompt-v12 # the agent definition: prompt, tools, policy RIUS_SERVICE_VERSION=2026.09.29-a41f3c # the build or deploy

If the agent is not sending traces yet, start with the Monitor AI agents in production guide.

  1. Find when it started. Open the agent in Agents and set the time window to 7d or 30d. Check Drift for a step up in cost per trace. With two or more versions, use Compare and read cost per trace and tokens per trace. Rius warns when either side has fewer than 20 traces, because the difference can be noise.

  2. Pick two traces. Click View all in Traces to open the list filtered to this agent. Each row shows token total, computed cost and span count. Open a heavy trace and a normal one. In the heavy one, use Compare runs against the normal run of the same agent to see which steps were added or dropped and where cost moved.

  3. Read the heavy trace. Look for collapsed retry rows, repeated tool steps and the context growth strip. Press ]l to jump to the next LLM span and ]e to the next failed span. On a recovered trace, child spans errored while the run itself finished clean, which is the retry or fallback pattern.

  4. Look across traces. On the Spans tab, set All kinds to LLM, filter by model, and sort by Tokens or Cost. Pasting a session ID into the search box lists every span in that session. Use Exploring traces for the filter builder and saved searches.

  5. Alert on the next spike. A custom alert can watch the LLM calls metric, which counts inference calls only. Agent, tool, retrieval and embedding spans never count. Adjust the service name, threshold and window to your agent:

FILTERS Service = checkout-agent RULES count(LLM calls) > 200 WINDOW 15 minutes

See Custom alerts for filters, windows and channels.

What you get

  • The date or version where cost per trace and tokens per trace began to rise.
  • The step that makes the extra calls, shown as a retry chain, a repeated tool step or a growing prompt.
  • A side-by-side comparison of a heavy run and a normal run of the same agent.
  • The failure type behind the retries, from Exceptions and the recovered status on traces.
  • An alert that fires when LLM calls in a window cross your threshold, so the next spike reaches you before the bill does.

Costs shown are list-price estimates in US dollars, so use them to compare runs, not as billed amounts.

When something else fits

  • If the prompt diff is empty, content capture may be off. The rest of the span (timings, tokens, cost) still works, so lean on the context growth strip and Compare runs.
  • If calls look normal but runs are slow, start from latency and time to first token on the agent page rather than from call counts.
  • If the rise comes from one end user or session, filter the Traces page by that user or session before comparing versions.

Still stuck? Get help

Last updated on