Skip to Content

I trace CrewAI with Helicone. How do I switch to Rius?

To switch from Helicone to Rius for CrewAI, you call rius.init() and wrap your entrypoint and tools with observe, and Rius traces the model calls CrewAI makes. You remove the Helicone base URL and header, or the async logger, and the traces arrive as a root agent span, a generation for each model call with tokens and cost, and a span for each tool. Your CrewAI code, agents and tasks stay as they are.

How it works

Helicone captures calls in two ways. The proxy sits in the request path through a Helicone base URL. The async logger instruments your client inside the process. Rius works inside the process: the Rius SDK patches the client library and exports spans, so nothing sits between CrewAI and the model provider.

  • CrewAI 1.x drives the OpenAI client natively, so the openai integration captures its model calls.
  • If LiteLLM is installed, CrewAI uses it as a fallback. In that setup you use the litellm integration instead.
  • With a default init(), every installed integration turns on automatically.
  • The crew structure runs inside the framework, where auto-instrumentation cannot see it. You wrap the entrypoint and the tool bodies with observe.
  • Rius computes cost on its side from the model and token counts. You never send a cost value.

The CrewAI integration page covers the framework in full, and the Helicone migration guide covers the proxy and logger paths.

Set it up

  1. Install the SDK with the OpenAI integration next to CrewAI. If LiteLLM is installed in your project, use the litellm extra and the litellm package instead.

    pip install "glassflow-rius[openai]" crewai
  2. Handle what Helicone added. If you use the proxy or AI Gateway, leave the Helicone base URL and the Helicone-Auth header in place for now, so both tools see the same calls while you compare (see the note after these steps). If you use the async logger, delete the logger and its init() call. Do not run both in one process: both register the process-wide OpenTelemetry tracer provider, and only the first registration is kept.

  3. Call rius.init() at startup, mark each tool as a TOOL span, and wrap the entrypoint around kickoff() as an AGENT span:

    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())

    Put @tool outermost and observe on the function body.

  4. Move what you sent as Helicone headers. Wrap each kickoff in rius.session() in place of Helicone-Session-Id, and use rius.user() in place of Helicone-User-Id. Set Helicone-Property-* values as span attributes on the span that wraps the work.

  5. Set CREWAI_TRACING_ENABLED=false where no terminal is attached, such as CI or containers, so CrewAI’s own tracing prompt does not appear. Then run one ticket that calls a tool and open the trace in the console.

  6. Compare request counts, token totals and cost with Helicone for a few days. Then delete the Helicone base URL and Helicone-Auth header so the client calls the provider directly with your own provider key, and revoke the Helicone key once nothing sends to it.

If you rely on Helicone’s gateway, keep its base URL in place after the cutover too. Rius patches the client in your process, not the network path, so calls are traced either way. Use plain model names such as gpt-4o-mini, not the gateway’s gpt-4o-mini/openai form, or calls show tokens but no cost.

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
  • A root AGENT span from your entrypoint wrapper.
  • A generation for each model call, with model, tokens, cost and time to first token. Costs are list-price estimates in US dollars.
  • A TOOL span for each tool you wrapped.
  • Sessions and users you scoped, so the Users page lists each user with their traces, failures and cost.

Two things to know. Crews and tasks produce no spans of their own, so which task a generation belongs to is not visible unless you wrap per-task entrypoints with observe. Generation spans are all named ChatCompletion. Streamed calls carry token counts only when usage is enabled on the underlying OpenAI client.

When something else fits

  • Rius is not a gateway, so caching, rate limits, retries and fallbacks stay with Helicone or another gateway. Keep the gateway in place and run Rius beside it first, as the Helicone migration guide suggests.
  • Rius has no prompt management, scores, datasets or evals. Keep those workflows in your current tool.
  • Existing Helicone traces stay in Helicone. Rius starts from the first span you send it.

Still stuck? Get help

Last updated on