Skip to Content

How do I switch from LangSmith to Rius for AutoGen tracing?

Rius traces AutoGen through its own integration, so you remove LangSmith’s tracing setup and call rius.init() once, with no change to your agents. AutoGen’s own spans carry the agent and tool structure, and the OpenAI integration adds each model call with tokens and cost. You can run both tools side by side until Rius shows what you need. The general approach is in Migrate to Rius.

How it works

AutoGen (AgentChat) emits its own OpenTelemetry spans for agent creation, agent runs and tool calls. rius.init() installs the global tracer provider those spans go through, so the agent and tool structure arrives with no wrappers. Model calls go through the OpenAI client from autogen-ext[openai], and the OpenAI integration records each one as a generation with model, tokens and cost. The AutoGen integration page covers the details.

The LangSmith concepts map across like this:

  • A LangSmith project becomes an agent in Rius, named by service_name in rius.init(). Give each environment its own workspace and API key.
  • A run becomes a span, and a trace stays a trace.
  • A LangSmith thread becomes a session, set with rius.session() around each conversation.
  • Cost is computed by Rius from the model and token counts. You never send it.

One rule differs from habits you may have with @traceable: do not wrap AutoGen tool functions with observe. AutoGen 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.

Set it up

  1. Install the SDK with the OpenAI extra, plus AutoGen and its OpenAI client:
pip install "glassflow-rius[openai]" "autogen-agentchat" "autogen-ext[openai]"
  1. Drop any @traceable decorators and wrap_openai wrapper around your AutoGen code. You do not need a client wrapper in Rius, because rius.init() instruments the OpenAI library for the whole process. The LANGSMITH_* variables can stay until you cut over in step 6.

  2. Call rius.init() at startup and put one observe wrapper on the entrypoint, so agent creation and the run land in a single 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)
  1. Map threads to sessions. Where you put a thread or session id in LangSmith metadata, scope each run with with rius.session(conversation_id): instead, reusing the same id. It stamps every span started inside it.

  2. Run both tools in parallel for one service or environment while you evaluate. Compare trace counts, token totals and cost on real traffic.

  3. Cut over. Once Rius shows what you need, unset LANGSMITH_TRACING, remove the remaining LangSmith code and revoke the LangSmith keys.

The full mapping of LangSmith calls to Rius calls, including @traceable and metadata, is in Migrate from LangSmith to Rius.

LangSmith’s OpenTelemetry export can also send to Rius without code changes. Content and threads do not arrive that way, so use it only as a bridge and move to the integration above.

What you get

A run that calls a tool looks like this in the trace view:

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 root span is your observe wrapper. The create_agent, invoke_agent and execute_tool spans come from AutoGen itself.
  • Each model call is a generation with model, tokens and a list-price cost estimate in US dollars.
  • Conversations group into sessions, and you get Rius alerts and the agents view on top of the traces.
  • A few quirks to expect: AutoGen’s own span statuses arrive as unset on success, though the trace status still reads Ok, and generation spans are all named ChatCompletion.

To verify, run one request that calls a tool, then open the trace and check that the root span, the framework spans and the generation with its model, tokens and cost are all there. The Integrations page lists the other frameworks you can trace the same way.

When something else fits

  • Rius has no evaluators, datasets, experiments, feedback queues, Prompt Hub or playground. If you rely on them, keep LangSmith for those workflows and use Rius for tracing, cost and alerts.
  • Existing LangSmith traces cannot be imported. Rius starts from the first span you send, so keep LangSmith available for looking up history.
  • Rius is a managed service only. If you need a self-hosted deployment, it does not fit.

Still stuck? Get help

Last updated on