Skip to Content

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

Rius shows the agent version on each trace once you set RIUS_MAIN_AGENT_VERSION for your AutoGen process, in the Version column and the trace header. The AutoGen integration records the agent, tool and model-call spans of each request. You supply the version as one setting, and no extra spans are needed. Filter or compare traces by that version to see which release handled a request.

How it works

The AutoGen integration combines two sources. AutoGen emits its own spans for agent creation, agent runs and tool calls, and the openai integration adds a generation for each model call with tokens and cost. One observe wrapper on your entrypoint groups them into a single trace per request, so a run looks like this:

handle-ticket AGENT ├─ create_agent support_agent └─ invoke_agent support_agent ├─ ChatCompletion LLM └─ execute_tool account_status

The version is a separate piece of information that you set on your agent. Rius reads it from RIUS_MAIN_AGENT_VERSION, which is stored as rius.main_agent.version. This is the version the Agents page compares. Set it to whatever identifies a version of the agent definition (its prompt, tools and policy), such as a tag. The build that hosts it is a separate setting, RIUS_SERVICE_VERSION. When a trace carries no agent version, the Version column shows the build instead.

You do not need a span or attribute of your own for this. Do not wrap AutoGen tool functions with observe to add version information. AutoGen runs tools in a detached context, so the wrapper splits off into its own single-span trace, and the framework’s execute_tool spans already cover tools.

Set it up

  1. Set up AutoGen tracing as described on the AutoGen integration page. It covers the install, rius.init() and the observe wrapper on your entrypoint. The install line is:

    pip install "glassflow-rius[openai]" "autogen-agentchat" "autogen-ext[openai]"
  2. Set the version in the environment of the process that runs your agent. Change it on every release, ideally from your deploy pipeline, so each release reports its own value:

    export RIUS_MAIN_AGENT_VERSION=2.4.0
  3. Run one request that calls a tool, then open Traces in the console.

  4. Find the request. The Version column in the trace list shows the agent version. The trace header shows it too, next to the session and the build when the trace carries them.

  5. To see all requests from one release, click Add filter, pick the version field and the is operator, and choose the value. You can also open a span’s Raw tab and use Filter traces by this on the version attribute. Filters combine with AND and live in the URL, so you can share the filtered list as a link.

If you also set RIUS_AGENT_NAME, the name the agent is grouped under stays the same across releases, so the versions line up under one agent.

What you get

  • Version on every trace. The trace list has a Version column, and the trace header names the agent version that handled the request. A request is traced back to a release without opening any spans.
  • Filtering by release. Filter the trace list or the Spans tab to one version to see only the requests that release handled, with their errors, tokens and cost. See Exploring traces for the filter builder and saved searches.
  • Version comparison. 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.
  • Full run structure. Under each trace you still see the create_agent, invoke_agent, execute_tool and ChatCompletion spans, so you can go from the version straight to the step that failed.

For how this fits into watching a live agent, see Monitor AI agents in production.

When something else fits

  • If you want to compare a few versions of the same agent side by side, use the version comparison on the Agents page rather than reading traces one at a time.
  • If your agent is written in another framework, the integrations overview lists how each one is traced, and the same version setting applies to a process using the SDK.
  • If you need to tell apart requests by customer or conversation rather than by release, use the end user and session identifiers instead of the version.

Still stuck? Get help

Last updated on