How do I switch from LangSmith to Rius for tracing LangChain?
Rius traces LangChain through its callback system, so you install the langchain extra, call rius.init() at startup and leave your chains, agents and graphs as they are. The trace shows your graph as nested spans, with each model call carrying model, token counts and cost. You can keep LangSmith running beside Rius while you compare, then unset LANGSMITH_TRACING when you cut over. The LangSmith migration guide covers every path in full.
How it works
LangSmith traces LangChain through LangChain’s callbacks. The Rius SDK hooks the same callbacks, so anything that runs through them is traced: LCEL chains, agents and LangGraph nodes. You change your setup, not your application code.
After the switch, each step is one span, typed by what the step is:
- Chains are CHAIN spans.
- Tool calls are TOOL spans.
- Retrievers are RETRIEVER spans.
- Model calls are LLM spans with the model, token usage and messages. Rius computes cost on its side from the model and token counts, as a list-price estimate in US dollars.
The nesting follows your chain structure, so a trace reads like your execution graph. If you also use a client library such as OpenAI, the chat model span wraps the client span. You get framework context and client detail, nested, and each model call is counted once in tokens and cost on glassflow-rius 1.1.0 or later, within the supported instrumentation versions. Text-completion models (BaseLLM subclasses such as langchain_openai.OpenAI) are still counted twice.
Concepts map across directly. A LangSmith project becomes an agent named by service.name, a run becomes a span, and a thread becomes a session. Tags and metadata become span attributes. The LangChain integration page has the details, and the Integrations page lists the other frameworks and clients Rius covers.
Set it up
- Install the Rius SDK with the
langchainextra. The extra installs the instrumentation, not LangChain itself, so namelangchainfor a fresh environment. For LangChain.js, install the TypeScript instrumentation instead.
pip install "glassflow-rius[langchain]" langchain
# LangChain.js
npm install @arizeai/openinference-instrumentation-langchain- Replace the LangSmith environment with a Rius API key. You no longer need
LANGSMITH_API_KEY, andLANGSMITH_PROJECTbecomes theservice_namein the next step.
export RIUS_API_KEY="ri_..."- Call
init()once at startup, then build and run your chains exactly as before.
import rius
client = rius.init(service_name="my-agent")
# build and run your chains, agents and graphs exactly as beforeIn TypeScript, the equivalent is:
import { init } from '@glassflow-ai/rius'
const rius = init({ apiKey: 'ri_...', serviceName: 'my-agent' })
// build and run your chains exactly as before-
In a short-lived Python script, call
client.flush()before it exits so every call is exported. In a short TypeScript script, awaitrius.shutdown()instead. -
Map threads to sessions. LangSmith asks for
thread_idin run metadata. In Rius you wrap the call once, and every span inside it, child spans included, gets the session:
with rius.session(thread_id):
agent.invoke({"messages": [{"role": "user", "content": "Weather in Lisbon?"}]})-
Run both backends side by side. Leaving
LANGSMITH_TRACING=trueset keeps LangSmith’s callback tracer running next to Rius in the same process. Run one traced request and open it in the console. You should see the chain as nested spans, with the model call carrying model, tokens and cost. -
Cut over. Unset
LANGSMITH_TRACING, remove any@traceablecode and revoke the LangSmith keys once nothing sends to them. If your code also uses@traceableor the client wrappers, the migration guide maps each one to its Rius equivalent.
What you get
- The same nested trace. Your graph appears as chain, tool, retriever and model spans, so a trace you read in LangSmith has a familiar shape in Rius.
- Model calls with tokens and cost. Each model call shows its model, token counts and a list-price cost estimate, counted once.
- Sessions and users. Conversation turns inside
rius.session()group together in the sessions view, and you can follow end users on the Users page. - Alerts and live agent views. With the SDK you also get alerts and a view of which agent processes are alive.
- A reversible move. Both tools can receive traces from one process until you decide to remove LangSmith.
Existing LangSmith traces stay in LangSmith, because Rius has no importer. It starts from the first span you send.
When something else fits
- If you cannot change code yet, LangSmith’s own OpenTelemetry export can send to Rius with environment variables. Model calls, tokens and cost arrive, but content and threads do not, so treat it as a bridge and move to the SDK steps above.
- Rius has no datasets, experiments, evaluators, feedback queues or prompt hub. If you depend on them, keep LangSmith for those workflows and use Rius for tracing, cost and alerts.
- Rius is a managed service only. For other tools and routes, start from Migrate to Rius.