Skip to Content

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 the anthropic package to be in your environment already. If it is missing, init() logs a DependencyConflict and the integration stays off.
  • TypeScript uses an optional peer package. Install @arizeai/openinference-instrumentation-anthropic at version 0.2.7 or newer, and init() enables the integration. In a CommonJS app, require @anthropic-ai/sdk before init().
  • Decorators map to observe. OpenLLMetry’s @agent and @tool become observe with a span kind, and its conversation scopes become Rius sessions.

The Traceloop migration guide has the full concept mapping.

Set it up

  1. Create a Rius workspace and an API key. Keys start with ri_.

  2. 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 and TRACELOOP_API_KEY, along with any other OpenLLMetry setup for Anthropic.

  3. Install the Rius SDK with the Anthropic instrumentation:

    pip install "glassflow-rius[anthropic]" anthropic
  4. Initialize Rius and map your decorators. @tool becomes observe with the TOOL kind, and @agent becomes observe with 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
  5. Replace conversation and user scopes. @conversation and set_conversation_id(cid) become with rius.session(cid):. Traceloop.set_association_properties({"user_id": uid}) becomes with rius.user(uid):, which stamps user.id on every span in scope.

  6. In TypeScript, withWorkflow, withTask, withAgent and withTool become observe wrappers with the matching kind, and withConversation becomes withSession. The client that init() returns has a ready promise, so awaiting it tells you whether anthropic attached.

  7. 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.create call carries the model (for example claude-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 system parameter lands as the leading system message of the input.
  • Errors by class. A failed call records error.type as the error class, such as anthropic.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_agent or execute_tool plus the name, not OpenLLMetry’s .agent and .tool suffixes. 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.

Still stuck? Get help

Last updated on