Skip to Content

How do I see which agent version handled a request in an agent built with LlamaIndex?

Rius shows the agent version on each trace in the trace list and in the trace header, once you set the agent version for your process. The LlamaIndex integration records retrieval, embedding and model-call spans on its own, but it does not record a version, so you set RIUS_MAIN_AGENT_VERSION yourself. Every trace the process sends then carries that version, and you can read it per request or filter by it.

How it works

The LlamaIndex integration turns each query into a nested trace of typed spans. Retrieval steps become RETRIEVER spans, embedding calls become EMBEDDING spans, and synthesis model calls become LLM spans with model, token usage and messages. Cost is computed by Rius from those spans. None of these spans says which release of your agent ran.

The version comes from a setting on your process. RIUS_MAIN_AGENT_VERSION is sent as the rius.main_agent.version attribute on every trace, and it is the version the Agents page compares. You do not add a span or wrap a function for it, and you do not change your query engines.

This is what each part records:

  • The integration, on its own: the span tree for each query, with model, tokens, cost and the retrieved content.
  • Your setting: the agent version, carried by every trace from that process.

The integration is Python only. See LlamaIndex for what it captures and Integrations for how integrations are enabled. For the wider picture of watching agents after release, see Monitor AI agents in production.

Set it up

  1. Install the integration and initialize Rius before you build your indexes and query engines. Nothing else in your LlamaIndex code changes.
pip install "glassflow-rius[llama-index]" llama-index
import rius rius.init(api_key="ri_...", service_name="my-agent") # build indexes and query engines exactly as before
  1. Set the version for the process, using the value you give each release. Set it wherever you deploy, so a new release starts with a new value.
export RIUS_MAIN_AGENT_VERSION=1.4.0
  1. Run a query, then open Traces in the console. When traces carry a version, the Version column appears in the list. If a trace has no agent version, the column shows the build instead.

  2. Open the trace. The header summarizes the run, including the agent version, and the build when the trace carries one. Select a span and open Raw to see the span exactly as ingested.

  3. To see every request a given release handled, click Add filter, pick the field rius.main_agent.version, choose is, and pick the value. Filters combine with AND, so you can add a status filter to see only failed runs from that release. Attribute filters match exact values only, so type the version exactly as you set it. The filter lives in the URL, so you can share the link with a teammate.

The Spans tab accepts the same filters if you want one kind of step, such as every LLM call, from a single version. See Exploring traces for the full filter builder.

What you get

  • A version on every request. Each trace shows the agent version in the list and in its header, so you know which release answered a given query.
  • Filtering by release. Filter traces or spans on the version attribute to isolate the runs from one release, for example only its failures.
  • The LlamaIndex structure underneath. Retriever, embedding and LLM spans sit in the same trace, so after you find a request from a given version you can read what the retriever returned and what the model call cost.
  • Comparison between versions. The Agents page compares two versions of an agent on traces, failed rate, cost per trace, latency, time to first token (p50) and tokens per trace. It warns when a side has fewer than 20 traces.

Costs shown are list-price estimates in US dollars, not billed amounts.

When something else fits

  • If your LlamaIndex agent is written in TypeScript, there is no LlamaIndex integration. Use manual generations for the pipeline, and set the version the same way.
  • If you need to tag individual requests rather than a whole release, for example by customer or conversation, use a session or user identifier instead of the version.

Still stuck? Get help

Last updated on