I trace the Vercel AI SDK with Traceloop. How do I switch to Rius?
To switch to Rius, replace the Traceloop initialization with the Rius SDK’s init() call, and your Vercel AI SDK calls arrive as traces with models, tokens and cost. On ai 7, init() registers the AI SDK’s telemetry for you. On ai 5 and 6, you enable telemetry on each call. Run one tracing setup per process, so remove the Traceloop one when you add Rius.
How it works
The Vercel AI SDK integration is TypeScript only and reads the AI SDK’s own OpenTelemetry telemetry. You do not add a Rius-specific wrapper around each call.
ai7: the AI SDK no longer emits spans itself. They come from@ai-sdk/otel, andinit()registers it when the package is installed. This needs Node 22 or newer, the same floor asai7.ai5 and 6: telemetry is built in but off until a call opts in withexperimental_telemetryset to isEnabled true. Nothing extra is installed, and Node 18 or newer works.- Cost: Rius computes it on the server from the model and the token counts. You never send a cost.
- Counting: each model call is counted once in tokens and cost, and the wrapper span around it still shows the run’s total.
Running both setups in one process produces duplicate LLM spans, because each one instruments the same libraries. Remove the Traceloop initialization from any process where you add init().
If you would rather keep OpenLLMetry and change only where it exports, the Migrate from Traceloop guide covers that path. This article covers the full swap to the Rius SDK. The wider picture is in Migrate to Rius.
Set it up
-
Install the Rius SDK. On
ai7, add the telemetry package too.npm install @glassflow-ai/rius @opentelemetry/api npm install @ai-sdk/otel -
Remove the Traceloop setup from the service you move first. Delete the
traceloop.initializecall, the@traceloop/node-server-sdkimport, and theTRACELOOP_*variables from your deployment. -
Initialize Rius where Traceloop was initialized. Await
readyso the AI SDK integration is registered before your first call, and callshutdown()before a short script exits, because the TypeScript SDK does not flush spans on exit.import { init } from '@glassflow-ai/rius' import { openai } from '@ai-sdk/openai' import { generateText } from 'ai' const rius = init({ apiKey: 'ri_...', serviceName: 'my-agent' }) await rius.ready // the AI SDK integration is registered before the first call const { text } = await generateText({ model: openai('gpt-4o-mini'), prompt: 'Summarize this ticket', }) await rius.shutdown() // export queued spans before the process exitsserviceNametakes the place of Traceloop’sappName. It names the agent your traces are grouped under. -
On
ai5 or 6, opt each call in.const { text } = await generateText({ model: openai('gpt-4o-mini'), prompt: 'Summarize this ticket', experimental_telemetry: { isEnabled: true }, }) -
Replace the Traceloop helpers around your calls.
withWorkflow,withTask,withAgentandwithToolbecomeobservewrappers with the matching kind, andwithConversationbecomeswithSession. Name each wrapped function, because an anonymous one traces as anonymous. To group traces by end user, usewithUser. Traceloop’s association properties such asuser_idare not read as Rius users. -
Verify. Run one
generateTextcall and open the trace in the console. Onai7,await rius.readylistsvercel-ai. Onai5 and 6 it does not list it even when tracing works, so check the trace itself. If no spans appear onai5 or 6, the usual cause is a call withoutexperimental_telemetryenabled.
To compare before you cut over, move one service first and leave the others reporting to Traceloop. For identical traces in both backends, keep OpenLLMetry for now and send through the Collector fan-out instead. Setup details for every library are on the Integrations page.
What you get
- A readable run tree. An agent span (
invoke_agent) wraps the steps of a tool-calling loop. Each step has a span, each model call has achatspan, and each tool execution has anexecute_toolspan. - Full call detail. Each call carries its input and output messages, the request’s tool definitions, the resolved model, and token usage including cache reads, cache writes when the AI SDK reports them, and reasoning tokens (
@glassflow-ai/rius1.2.0 or later). - Time to first token. Streamed calls carry it, from
@glassflow-ai/rius1.1.0. - Cost per call. It is a list-price estimate in US dollars, computed from the model and tokens.
- The same data on
ai5, 6 and 7. A call stores the same fields whichever version made it, from@glassflow-ai/rius1.2.0. - Privacy controls.
captureContent: falseand amaskapply to prompts, responses, tool definitions, the system prompt and tool call arguments and results.
Span names follow the GenAI conventions, so they differ from Traceloop’s names. Update any saved search that matches on a Traceloop span name. Your existing traces stay in Traceloop, and Rius starts from the first span you send it. Rius has no evals, datasets, prompt registry or guardrails, so keep those workflows in Traceloop if you use them.
When something else fits
- If you want to keep OpenLLMetry and only change where it exports, follow the Traceloop guide’s re-pointing path instead of the full swap.
- If your code uses Traceloop’s platform features such as prompts, guardrails or datasets, keep Traceloop for those and add Rius alongside it through a Collector.