How do I switch from LangSmith to Rius when I trace the Anthropic API?
Rius traces Anthropic calls with its Anthropic integration, so you drop wrap_anthropic, call rius.init() once, and leave your Anthropic calls unchanged. Your @traceable functions become @rius.observe, and each messages.create call then shows up as a span with the model, tokens and cost. You can run Rius next to LangSmith while you compare, and cut over when the traces look right.
How it works
LangSmith traces the Anthropic client by wrapping it with wrap_anthropic. Rius works differently: rius.init() instruments the Anthropic library for the whole process, so every client you create is traced and there is no wrapper to forget. You only need to call rius.init() before you make calls. The Anthropic integration turns on automatically when its instrumentation is installed.
The mapping for the common LangSmith pieces is one to one:
wrap_anthropic(Anthropic())becomesAnthropic().@traceablebecomes@rius.observe, and@traceable(name="Chat Pipeline")becomes@rius.observe(name="Chat Pipeline").@traceable(run_type="tool")becomes@rius.observe(kind=rius.SpanKind.TOOL).- A
thread_idin metadata becomeswith rius.session(thread_id):around the call. LANGSMITH_TRACING,LANGSMITH_API_KEYandLANGSMITH_PROJECTbecomeRIUS_API_KEYplusservice_nameinrius.init(). A LangSmith project maps to an agent, named by the service name.
The full concept mapping and the other paths are in Migrate from LangSmith. The wider picture of moving from other tools is in Migrate to Rius.
Set it up
- Install the instrumentation for Anthropic. The extra installs the instrumentation, not
anthropicitself, so name the package if the environment is new. In TypeScript, install@arizeai/openinference-instrumentation-anthropic(version 0.2.7 or newer) and callinit()from@glassflow-ai/rius.
pip install "glassflow-rius[anthropic]" anthropic- Replace the LangSmith environment with a Rius key. Create a workspace and API key in the console first.
# Before: LangSmith
export LANGSMITH_TRACING=true
export LANGSMITH_API_KEY="lsv2_..."
export LANGSMITH_PROJECT="my-agent"
# After: Rius
export RIUS_API_KEY="ri_..."- Swap the wrapper and the decorators in your code.
# LangSmith
from anthropic import Anthropic
from langsmith import traceable
from langsmith.wrappers import wrap_anthropic
client = wrap_anthropic(Anthropic())
@traceable(name="Chat Pipeline", metadata={"thread_id": thread_id})
def pipeline(question: str) -> str:
response = client.messages.create(
model="claude-haiku-4-5-20251001",
max_tokens=200,
messages=[{"role": "user", "content": question}],
)
return response.content[0].text# Rius
import rius
from anthropic import Anthropic
rius.init(service_name="my-agent")
client = Anthropic() # no wrapper: init() instruments the library
@rius.observe(name="Chat Pipeline")
def pipeline(question: str) -> str:
response = client.messages.create(
model="claude-haiku-4-5-20251001",
max_tokens=200,
messages=[{"role": "user", "content": question}],
)
return response.content[0].text
with rius.session(thread_id):
pipeline("What should I check when a collector drops spans?")-
Set the session once per request.
rius.session()stamps every span started inside it, including the spans the Anthropic integration creates, so you do not put the thread id on each call. -
Run both backends while you compare. Leave LangSmith on in one service or environment and send Rius from another, or keep both in the same process. When the numbers match, unset
LANGSMITH_TRACING, remove@traceableandwrap_anthropic, and revoke the LangSmith keys.
If you cannot change code yet, LangSmith’s own OpenTelemetry export can send to Rius. It carries model, tokens and cost, but no inputs, outputs or messages, and threads do not group into sessions. Treat it as a bridge and follow the LangSmith guide for its settings.
What you get
Each messages.create call becomes a span for the model call. It carries the model name, input and output token counts including cache reads and writes, and the request and response messages. Rius computes cost on its side from the model and the tokens, as a list-price estimate in US dollars, so you send no cost value.
A few details of the Anthropic traces:
- The system prompt, which Anthropic takes as a separate parameter, appears as the leading system message of the input.
- Text blocks and tool calls appear as message parts. Any other block, such as an image or a reasoning block, is kept as text so nothing is dropped.
- A failed call records the error class, such as
anthropic.NotFoundError, as its error type. - Streamed calls carry token usage, but auto-instrumented Anthropic streams have no time to first token.
- Inside an
observefunction, the model call nests under your run, so the tree reads like the nested runs you had in LangSmith.
Run one call and open the trace in the console to check the model, token counts and cost. Prompt and response content follows your privacy controls. See the integrations overview for the other libraries and frameworks Rius traces the same way.
When something else fits
Rius has no datasets, experiments, evaluators, feedback scores, annotation queues or Prompt Hub, so keep LangSmith for those workflows and send traces to both. Existing LangSmith traces do not import, so Rius starts from the first span you send. Rius is a hosted service only, so a self-hosted setup is not an option.