Skip to Content

I trace AutoGen with Helicone. How do I switch to Rius?

Rius traces AutoGen with one call to rius.init(), which replaces your Helicone proxy settings or async logger and records agents, tools and model calls. You install the Rius SDK with the openai extra, wrap your entrypoint in one observe, and remove the Helicone setup. AutoGen’s own spans and the OpenAI client’s generations then arrive as a single trace per unit of work, with cost computed by Rius.

How it works

Helicone logs calls on the network path, through a proxy base URL and Helicone-Auth header, or through its async logger. Rius works inside your process instead, so nothing sits between AutoGen and the model provider. This page covers AutoGen specifically. The Migrate from Helicone guide covers the concept mapping and the full cutover checklist, and Migrate to Rius lists the other migration paths.

For AutoGen, Rius gets coverage from two places:

  • AutoGen’s own spans. The framework emits create_agent, invoke_agent and execute_tool spans through the global tracer provider, which rius.init() installs. Agent and tool structure arrives with no wrappers.
  • The OpenAI integration. AutoGen’s model calls go through the OpenAI client from autogen-ext[openai]. The openai integration records each one as a generation with model, tokens and cost.

Cost is a list-price estimate in US dollars, computed by Rius from the model and token counts. You never send a cost value. The AutoGen integration page covers the details, and the Integrations overview lists the other frameworks.

Rius is not a gateway. If you rely on Helicone for caching, rate limits, retries or fallbacks, Rius does not provide them, so keep the gateway for those. Rius traces the calls either way.

Set it up

  1. Install the SDK with the OpenAI integration and AutoGen.

    pip install "glassflow-rius[openai]" "autogen-agentchat" "autogen-ext[openai]"
  2. Call rius.init() and wrap your entrypoint. Put init at startup and one observe with the AGENT kind around the function that handles a unit of work. The wrapper groups agent creation and invocation into one trace.

    import rius from autogen_agentchat.agents import AssistantAgent from autogen_ext.models.openai import OpenAIChatCompletionClient from rius import SpanKind rius.init(api_key="ri_...", service_name="my-agent") def account_status(email: str) -> str: """Fetch a customer's account standing by email.""" return lookup(email) @rius.observe(name="handle-ticket", kind=SpanKind.AGENT) async def handle_ticket(ticket: str) -> str: agent = AssistantAgent( name="support_agent", model_client=OpenAIChatCompletionClient(model="gpt-5-mini"), tools=[account_status], system_message="Answer support questions; check accounts with the tool.", ) result = await agent.run(task=ticket) return str(result.messages[-1].content)

    Do not wrap AutoGen tool functions with observe. The framework runs tools in a detached context, so the wrapper’s span splits off as its own single-span trace. The framework’s execute_tool spans already cover tools.

  3. Remove the Helicone setup, or keep it for the gateway.

    • If you used the async logger, delete the HeliconeAsyncLogger lines and let rius.init() replace them. Do not run both in one process. Both register the process-wide OpenTelemetry tracer provider, OpenTelemetry keeps only the first registration, and calls reach only one tool.
    • If you used the proxy, keep the Helicone base URL and Helicone-Auth header in your model client configuration while you compare, as the next point describes. At cutover, remove them so the client calls the provider directly with your own provider key.
    • If you need gateway features, leave the Helicone base URL in place and add rius.init() anyway. Rius patches the client library in your process, so calls are traced whatever base URL the client uses. This is also the way to run both backends side by side. Use plain model names such as gpt-4o-mini, not the gateway’s gpt-4o-mini/openai form, or calls show tokens but no cost.
  4. Move sessions and users. Replace Helicone-Session-Id with rius.session(conversation_id) around each run, and Helicone-User-Id with rius.user(user_id). Every span in scope then carries session.id or user.id. Properties you sent as Helicone-Property-* headers become span attributes, as the Helicone migration guide explains.

  5. Verify. Run one request that calls a tool, then open the trace in the console and check that the root span, the invoke_agent and execute_tool spans, and the generation with model, tokens and cost are all there. Compare request counts, token totals and cost with Helicone for a few days before you remove the Helicone setup and revoke its key.

What you get

After the switch, one AutoGen run is one trace. A run that calls a tool looks like this:

handle-ticket AGENT 2.8s ├─ create_agent support_agent 0ms └─ invoke_agent support_agent 2.8s ├─ ChatCompletion LLM 2.6s └─ execute_tool account_status 0ms
  • The full agent tree. Agent creation, agent runs, model calls and tool calls appear as nested steps, not only logged LLM requests.
  • Generations with tokens and cost. Each model call shows the model and token counts, and Rius prices it.
  • Sessions and users. One conversation is one session, and each user appears with their traces, failures and cost.
  • Alerts. You can set rules on cost, errors and duration.

Three quirks to expect. Generation spans are named ChatCompletion. Framework span statuses arrive as UNSET rather than OK on success, while the trace status still reads Ok. If you keep the Helicone gateway during side by side, a response served from its cache is still recorded as a generation priced from its tokens, so Rius cost runs higher than Helicone’s by your cache-hit share.

Existing Helicone traces stay in Helicone. Rius starts from the first span you send, and there is no import.

When something else fits

  • If caching, rate limits, retries or fallbacks are load-bearing in production, keep the Helicone gateway and add Rius next to it first. Replace the gateway as a separate project.
  • If you depend on prompt management, scores, datasets or evals, Rius does not offer them, so keep those workflows where they are today.
  • If your model calls do not go through the OpenAI client, check the Integrations list for the provider you use.

Still stuck? Get help

Last updated on