Skip to Content

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

Rius shows the agent version on each trace of a CrewAI agent once you set RIUS_MAIN_AGENT_VERSION for the process. The CrewAI integration records model calls on its own but sets no version, so the version comes from that setting. It appears in the Version column of the trace list and in the header of each trace.

How it works

  • What the integration records on its own. For CrewAI, Rius captures each model call as a generation with model, tokens and cost through the OpenAI instrumentation (or the LiteLLM one when LiteLLM is installed). Crews and tasks produce no spans of their own, so nothing in that automatic output says which version of your agent ran. The CrewAI integration page lists what lands in the trace.
  • What needs a setting of your own. The version is an attribute of the agent process, not of a single span. RIUS_MAIN_AGENT_VERSION sets rius.main_agent.version, the version the Agents page compares. You do not need to wrap anything in observe for this, and no span code changes.
  • A second, optional label. RIUS_SERVICE_VERSION sets service.version. The trace list shows the agent version, or the build when there is no agent version.
  • Where it shows in the trace. The Version column appears in the trace list when the traces carry a version. The header of an open trace shows the agent version, and the build when the trace carries one. The Exploring traces page covers both views.

Set it up

  1. Install the OpenAI integration and CrewAI, and call rius.init once at startup. Both are covered in full on the CrewAI integration page.

    pip install "glassflow-rius[openai]" crewai
    import rius rius.init(api_key="ri_...", service_name="my-agent")
  2. Set the agent version in the environment of the process that runs your crew. Change the value whenever the crew’s prompts, tools or policy change, for example in your deploy configuration.

    export RIUS_MAIN_AGENT_VERSION=2.4.0
  3. Wrap your entrypoint around crew.kickoff() with observe, as the CrewAI page shows, so each request has a root span. Use kind SpanKind.AGENT and a name such as handle-ticket. The version is attached to the traces from the process, so every request that process serves carries it.

  4. Run a request, then open Traces. The Version column shows the value for that trace. Open the trace and read the agent version in the header.

  5. To see only the requests one version handled, click Add filter on the trace list and pick the field for the version attribute, or open a span’s Raw tab and choose Filter traces by this on the version value. Filters combine with AND, so you can add an agent or a time range.

What you get

  • Each trace says which agent version handled it, in the list and in the trace header, so a bad answer from last night maps to a release.
  • A filtered list of the requests one version served, which you can save as a search for your team or share as a read-only link without span content.
  • The same version value drives the version comparison on the Agents page, which puts two versions side by side on traces, failed rate, cost per trace, latency and tokens per trace. It shows a warning below 20 traces per side.
  • The model-call generations with tokens and cost that the CrewAI integration records, now grouped by version. Costs are list-price estimates in US dollars.

The version tells you which release ran, not which crew or task inside it. Crews and tasks produce no spans, so wrap per-task entrypoints with observe if you need that split. For the wider view of what to watch across versions, see Monitor AI agents in production.

When something else fits

  • If you need to tell apart several variants inside one release, such as two prompts, give each its own observe wrapper name so they show as separate spans, and keep the version for releases.
  • If you start a new process for each version and want the process to carry its own build label, set RIUS_SERVICE_VERSION as well.

Still stuck? Get help

Last updated on