How do I switch from Traceloop to Rius for the Anthropic API?
Rius replaces your Traceloop setup for the Anthropic API with its own Anthropic integration: remove OpenLLMetry, install glassflow-rius[anthropic], and call rius.init(). Every messages.create call then arrives as a span with the model, token counts and cost. If you would rather change no code, you can keep OpenLLMetry and point its exporter at Rius instead. You can send traces to both backends while you compare, and cut over when Rius shows what you need. The Migrate to Rius guide covers the other tools and paths.
How it works
- One integration instead of OpenLLMetry’s. On
init(), Rius instruments the Anthropic client library process-wide, so your call sites stay as they are. Rius gives you two ways in: swap to the Rius SDK, or keep OpenLLMetry and change where it sends traces. - Run one or the other per process. OpenLLMetry and the Rius SDK instrument the same client library with different instrumentors, so running both produces duplicate LLM spans. Remove OpenLLMetry when you add the Rius SDK.
- The extra installs instrumentation, not Anthropic.
glassflow-rius[anthropic]expects theanthropicpackage to be in your environment already. If it is missing,init()logs aDependencyConflictand the integration stays off. - TypeScript uses an optional peer package. Install
@arizeai/openinference-instrumentation-anthropicat version 0.2.7 or newer, andinit()enables the integration. In a CommonJS app, require@anthropic-ai/sdkbeforeinit(). - Decorators map to
observe. OpenLLMetry’s@agentand@toolbecomeobservewith a span kind, and its conversation scopes become Rius sessions.
The Traceloop migration guide has the full concept mapping.
Set it up
-
Create a Rius workspace and an API key. Keys start with
ri_. -
Pick one service to move first, and leave the others reporting to Traceloop so you can compare. In that service, remove the
Traceloop.init()call andTRACELOOP_API_KEY, along with any other OpenLLMetry setup for Anthropic. -
Install the Rius SDK with the Anthropic instrumentation:
pip install "glassflow-rius[anthropic]" anthropic -
Initialize Rius and map your decorators.
@toolbecomesobservewith the TOOL kind, and@agentbecomesobservewith the AGENT kind. The Anthropic call inside is traced automatically:import rius from rius import SpanKind from anthropic import Anthropic rius.init(api_key="ri_...", service_name="trip-planner") client = Anthropic() # use the client exactly as before @rius.observe(kind=SpanKind.TOOL, tool_name="lookup_weather") def lookup_weather(city: str) -> str: ... @rius.observe(kind=SpanKind.AGENT, agent_name="weather_agent") def weather_agent(city: str) -> str: response = client.messages.create( model="claude-haiku-4-5-20251001", max_tokens=200, messages=[{"role": "user", "content": f"Weather in {city}?"}], ) return response.content[0].text -
Replace conversation and user scopes.
@conversationandset_conversation_id(cid)becomewith rius.session(cid):.Traceloop.set_association_properties({"user_id": uid})becomeswith rius.user(uid):, which stampsuser.idon every span in scope. -
In TypeScript,
withWorkflow,withTask,withAgentandwithToolbecomeobservewrappers with the matching kind, andwithConversationbecomeswithSession. The client thatinit()returns has areadypromise, so awaiting it tells you whetheranthropicattached. -
Run one call and open the trace in the console. Keep the other services on Traceloop until the numbers match, then move them too. For identical traces in both backends, keep OpenLLMetry and use the Collector fan-out.
To keep OpenLLMetry instead, set TRACELOOP_BASE_URL to https://ingest.eu.console.rius-glassflow.com, put your Rius key in TRACELOOP_HEADERS as a Bearer Authorization header, and in Python set TRACELOOP_METRICS_ENABLED to false, because Rius ingests traces only. The migration guide has the exact lines. The Anthropic integration page covers the SDK side in detail, and the integrations overview lists every other library.
What you get
- A span per model call. Each
messages.createcall carries the model (for exampleclaude-haiku-4-5-20251001), input and output tokens including cache reads and writes, and the request and response messages. - Cost computed by Rius. You send no cost value. Costs are list-price estimates in US dollars, not billed amounts.
- Your run structure. Agent and tool functions appear as agent and tool spans under their names, with the Anthropic call nested inside.
- The system prompt in place. Anthropic’s separate
systemparameter lands as the leading system message of the input. - Errors by class. A failed call records
error.typeas the error class, such asanthropic.NotFoundError. - Streaming with tokens. Streamed calls carry token usage. They carry no time to first token, so trace a call manually with
record_first_token()if you need it. - New span names. Unnamed agent and tool spans are named
invoke_agentorexecute_toolplus the name, not OpenLLMetry’s.agentand.toolsuffixes. Workflow and task spans use their plain names. Update any saved searches that match on span names.
Prompt and response content follows your privacy controls, so you can strip it at export.
When something else fits
- You want no code changes. Keep OpenLLMetry and re-point its exporter. Your decorators and conversation ids carry over as they are.
- You use Traceloop’s platform features. In Python, re-pointing the base URL switches off
get_prompt(), guardrails, feedback, datasets and experiments. Rius has no evals, prompt registry or datasets, so keep OpenLLMetry pointed at Traceloop and add Rius through an OpenTelemetry Collector fan-out. - You need old traces. Existing traces stay in Traceloop, and Rius starts from the first span you send.