I trace CrewAI with Traceloop. How do I switch to Rius?
To switch CrewAI tracing from Traceloop to Rius, you replace the Traceloop setup with the Rius SDK’s CrewAI integration and wrap your entrypoint and tools with observe. Model calls then arrive as generations with model, tokens and cost computed by Rius, and your entrypoint becomes the root agent span. If you would rather not touch your code, you can keep OpenLLMetry and change only where it exports, as the Traceloop migration guide describes.
How it works
- Model calls. CrewAI 1.x drives the OpenAI client natively, so the Rius
openaiintegration captures its model calls. If LiteLLM is installed, CrewAI uses it instead, and thelitellmintegration applies. - Run structure. Crews and tasks run inside the framework, where auto-instrumentation cannot see them. You wrap the entrypoint and the tool bodies with
observeto give the run its shape. - One instrumentation per process. OpenLLMetry and the Rius SDK instrument the same client libraries with different instrumentors, so running both in one process produces duplicate LLM spans. Remove Traceloop when you add the Rius SDK.
- Cost. You never send a cost value. Rius computes it from the model and token counts.
This is one path of Migrate to Rius. The Integrations page lists every framework Rius covers this way.
Set it up
-
Remove the Traceloop setup from one service first. Leave the others reporting to Traceloop while you compare. Delete the
Traceloop.init()call, theTRACELOOP_*variables from your deployment, and the OpenLLMetry decorators from your crew code. Keep this step before the next ones so the two tools never instrument the same process. -
Install the Rius integration. The
openaiextra installs the instrumentation, and CrewAI itself comes from its own package:pip install "glassflow-rius[openai]" crewai -
Initialize Rius and wrap the entrypoint and tools. This example is the CrewAI integration setup. The
@tooldecorator stays outermost, withobserveon the function body:import rius from crewai import Agent, Crew, Task from crewai.tools import tool from rius import SpanKind rius.init(api_key="ri_...", service_name="my-agent") @tool("account_status") @rius.observe(kind=SpanKind.TOOL) def account_status(email: str) -> str: """Fetch a customer's account standing by email.""" return lookup(email) support_agent = Agent( role="Support specialist", goal="Answer support tickets accurately and concisely.", backstory="You resolve product and account questions.", tools=[account_status], llm="gpt-5-mini", ) @rius.observe(name="handle-ticket", kind=SpanKind.AGENT) def handle_ticket(ticket: str) -> str: task = Task( description=f"Resolve this support ticket: {ticket}", expected_output="A short, direct answer.", agent=support_agent, ) return str(Crew(agents=[support_agent], tasks=[task]).kickoff()) -
Map your Traceloop decorators. Each one becomes an
observewrapper:Traceloop (Python) Rius (Python) @workflow(name="plan")and@task(name="summarize")@rius.observe(name="plan"), which makes a generic CHAIN span@agent(name="planner")@rius.observe(kind=SpanKind.AGENT, agent_name="planner")@tool(name="search")@rius.observe(kind=SpanKind.TOOL, tool_name="search")@conversation(conversation_id=cid)orset_conversation_id(cid)with rius.session(cid):Traceloop.set_association_properties({"user_id": uid})with rius.user(uid): -
Keep CrewAI’s own tracing prompt quiet. CrewAI asks about its own tracing product on first run. Set
CREWAI_TRACING_ENABLED=falsewhere no terminal is attached, such as CI or containers. -
Update saved searches. Unnamed agent and tool spans are now called
invoke_agentandexecute_toolfollowed by the name, not the name followed by.agentor.tool. Workflow and task spans use their plain name. -
Run one ticket that calls a tool and open the trace in the console.
What you get
A run that calls a tool looks like this:
handle-ticket AGENT 8.4s
├─ ChatCompletion LLM 3.9s agent decides to call the tool
├─ execute_tool account_status TOOL 0ms
└─ ChatCompletion LLM 4.3s agent answers- The root agent span is your
observewrapper around the kickoff. - Each model call is a generation with model, tokens, cost and time to first token. Cost is a list-price estimate in US dollars.
- Each tool is a tool span named after the tool, so tool-based alerts can see it.
- Crews and tasks produce no spans of their own, and generation spans carry the generic name
ChatCompletion. To see which task a call belongs to, wrap per-task entrypoints withobserve. - Streamed calls need usage enabled on the underlying client to carry token counts.
- With
rius.session()around each kickoff, one conversation or job is one session.
The CrewAI integration page covers setup and blind spots in full.
When something else fits
- If you want no code changes, keep OpenLLMetry and re-point its exporter at Rius. In Python this switches off Traceloop’s platform features such as
get_prompt(). - Rius has no evaluators, guardrails, prompt registry, datasets or experiments. If you depend on them, keep Traceloop for those and send traces to both through a Collector, as the Traceloop migration guide shows.
- Existing traces stay in Traceloop. Rius starts from the first span you send.