I trace LangChain with Arize Phoenix. How do I switch to Rius?
Rius replaces Phoenix’s register() call for LangChain with rius.init(), which turns on the LangChain integration and sends a nested trace of your chains, tools and model calls. You install the langchain extra, set an API key and a service name, and run your chains as before. Your LangChain code does not change, and you can send to Phoenix and Rius side by side until you cut over.
How it works
Phoenix’s register() with auto_instrument=True wires OpenInference instrumentors and exports to Phoenix. The Rius SDK ships the same OpenInference instrumentors, so rius.init() takes over both jobs: it wires the LangChain instrumentation and exports to Rius.
The LangChain integration hooks LangChain’s callback system. Anything that runs through it is traced: LCEL chains, agents and LangGraph nodes. Details are on the LangChain integration page, and the full list of supported libraries is on the integrations page.
A few Phoenix concepts map differently:
- Project becomes agent. Rius groups traces by agent name, which defaults to the service name. Phoenix’s project name is stored but does not drive grouping, so pass the same name to service_name.
- Sessions and users. using_session and using_user become rius.session and rius.user. The OpenInference context managers do not stamp spans you start with rius.start_as_current_span or @rius.observe, which are usually the root span.
- Cost. You send tokens, never cost. Rius computes cost from the model and token counts.
Set it up
-
Create a Rius workspace and an API key. Keys start with ri_.
-
Remove arize-phoenix-otel if nothing else uses it, then install the LangChain instrumentation and set your key. The extra installs the instrumentation, not langchain itself, so the package is named for a fresh environment.
pip install "glassflow-rius[langchain]" langchain export RIUS_API_KEY="<your API key>" -
Replace register() with rius.init(). Delete any OpenInference instrumentor calls of your own, because rius.init() instruments every supported library it finds installed. The endpoint defaults to EU ingest, so the key is usually the only setting.
# Before from phoenix.otel import register from openinference.instrumentation import using_session register(project_name="my-agent", auto_instrument=True) with using_session(conversation_id): run_agent(message)# After import rius rius.init(service_name="my-agent") with rius.session(conversation_id): run_agent(message) -
In TypeScript, install the LangChain instrumentation and call init. It resolves the callback manager of @langchain/core for you. Await ready before your first call, since integrations attach asynchronously.
import { init } from '@glassflow-ai/rius' const rius = init({ apiKey: 'ri_...', serviceName: 'my-agent' }) await rius.ready // build and run your chains exactly as before -
To compare before cutting over, do this in place of steps 2 and 3: keep arize-phoenix-otel installed, keep register() pointed at Phoenix and add Rius as a second span processor with replace_default_processor=False. Without that flag, the provider drops its Phoenix exporter. The Phoenix migration guide has the full code. Swap to rius.init() once you have compared both backends.
-
Run one chain that calls a model and open the trace in the console. Check the structure, the model and token counts, the cost, and the session and user.
What you get
- A trace that mirrors your graph. One span per step, typed by what the step is: chains as CHAIN spans, tool calls as TOOL, retrievers as RETRIEVER, and model calls as LLM spans with model, token usage and messages.
- Cost on every model call. Cost is a list-price estimate in US dollars, computed from the model and tokens. A model Rius does not know gets an empty cost, not zero.
- Sessions and users. Traces group under the session.id and user.id you set with rius.session and rius.user.
- Live process view. The SDK sends heartbeats, so you see which agent processes are alive.
- Privacy controls. Step inputs, outputs and messages are content, and the privacy controls apply to the whole tree.
- One count per call. If you also install a client extra such as openai, LangChain’s chat model span wraps the client span, and each call is counted once. Text-completion models (BaseLLM subclasses) are still counted twice.
Historical Phoenix traces stay in Phoenix. Rius starts from the first span you send.
When something else fits
- If you want the smallest diff, keep your OpenInference LangChain instrumentor and re-point its exporter at Rius. The Phoenix migration guide covers that path, and Migrate to Rius covers other tools.
- Rius has no evals, datasets, experiments, annotations, prompt management or custom model prices. If those are central to your work, keep Phoenix for them and send traces to both.
- Rius is a managed service only, so a self-hosted tracing backend needs a different tool.