openinference-instrumentation-crewai package, paired with an LLM-level instrumentor matching the provider CrewAI routes to.
CrewAI Tracing Tutorial (Google Colab)
Prerequisites
- Python 3.10+
- An Arize AX account (sign up)
- An
OPENAI_API_KEYfrom the OpenAI Platform - CrewAI 1.0+ (this guide uses the native-SDK routing model introduced in 1.0; for 0.x see Troubleshooting)
Launch Arize AX
- Sign in to your Arize AX account.
- From Space Settings, copy your Space ID and API Key. You will set them as
ARIZE_SPACE_IDandARIZE_API_KEYbelow.
Install
CrewAI 1.0+ routes LLM calls based on the model-string prefix:
openai/... and bare model names go to the native OpenAI SDK, anthropic/... goes to Anthropic, etc. The LLM-level instrumentor must match the provider CrewAI is actually calling. The example below uses openai/gpt-5.5 so it pairs openinference-instrumentation-crewai with openinference-instrumentation-openai. Other prefixes need a different pairing — see Which instrumentor do I need? below.Which instrumentor do I need?
CrewAI 1.0+ routes LLM calls to different provider SDKs based on your model string. Match your LLM-level instrumentor to the provider CrewAI is actually calling:
The CrewAI instrumentor (
openinference-instrumentation-crewai) is always required regardless of provider — it captures Crew, Agent, and Task spans.
Configure credentials
Setup tracing
CrewAI ships its own built-in telemetry, which emits extra OpenTelemetry spans (Set it before running your app. On older CrewAI releases the variable is
Crew Created, Task Created, Task Execution, Environment Context) to the same tracer provider you register above. Those spans carry no openinference.span.kind, so they land in Arize AX as kind-less spans mixed in with the Crew, Agent, and LLM spans you instrumented. Opt out of CrewAI’s telemetry to keep them out of your project — it leaves the OpenInference spans exported to Arize AX untouched:CREWAI_DISABLE_TRACKING=true. Don’t reach for OTEL_SDK_DISABLED=true here — CrewAI honors it too, but it turns off the entire OpenTelemetry SDK and stops the Arize AX export along with the CrewAI spans.Run CrewAI
Expected output
Verify in Arize AX
- Open your Arize AX space and select project
crewai-tracing-example. - You should see a new trace within ~30 seconds with this shape: a
Crew_<uuid>.kickoffroot span (CHAIN) wraps a per-agent<role>._execute_corespan (AGENT) for each task, and each_execute_corewraps aChatCompletionLLM span (modelgpt-5.5, with prompt, response, and token usage attached). If you left CrewAI’s built-in telemetry on, you’ll also see kind-lessCrew Created/Task Created/Task Executionspans — see the note under Setup tracing to suppress them. - If no traces appear, see Troubleshooting.
Check from the skill, CLI, or SDK
Confirm spans are actually reaching your Arize AX project. Use whichever fits your workflow — the skill and CLI work for any framework; the SDK check is shown for each language.- Arize skill (agent)
- AX CLI
- SDK
Install the Arize Skills plugin and let your coding agent check for you:Then prompt your agent:
Use the arize-trace skill to export and analyze recent traces from my project. Confirm spans are arriving, and summarize any errors or latency issues.
Troubleshooting
- No traces in Arize AX. Confirm
ARIZE_SPACE_IDandARIZE_API_KEYare set in the same shell that runsexample.py. Enable OpenTelemetry debug logs withexport OTEL_LOG_LEVEL=debugand re-run. - Crew / Agent / Task spans appear but no LLM spans. The LLM-level instrumentor doesn’t match the provider CrewAI is calling. CrewAI 1.0+ routes by model-string prefix:
openai/<model>(or no prefix) → installopeninference-instrumentation-openaianthropic/<model>→ installopeninference-instrumentation-anthropic- Groq / Together / providers without a native CrewAI SDK → install
openinference-instrumentation-litellm(CrewAI falls back to LiteLLM for these)
- All spans missing — no Crew, no LLM. This is almost always import order.
CrewAIInstrumentor().instrument(...)and the LLM-level instrumentor both monkey-patch class methods or module functions; ifcrewai(or the LLM library) is imported beforeinstrument()runs, the patches land on stale references and never fire. Make sureinstrumentation.pyis the first import in your entry point — and watch for transitive imports (importing your owncrew.pymodule that hasfrom crewai import ...at the top has the same effect). 401from OpenAI. VerifyOPENAI_API_KEYis set and has access togpt-5.5. Swapopenai/gpt-5.5inLLM(model=...)for a model your key can call.- Version-check error from
CrewAIInstrumentor. If you’re on a CrewAI release candidate that’s outside the instrumentor’s supported range, escape-hatch withCrewAIInstrumentor().instrument(skip_dep_check=True, tracer_provider=tracer_provider). - You’re on CrewAI 0.x. 0.x routes every LLM call through LangChain or LiteLLM rather than provider-native SDKs. Pair the CrewAI instrumentor with both
openinference-instrumentation-langchainandopeninference-instrumentation-litellminstead ofopeninference-instrumentation-openai. The Setup tracing call list becomesCrewAIInstrumentor().instrument(...)+LangChainInstrumentor().instrument(...)+LiteLLMInstrumentor().instrument(...). Upgrade to 1.0+ when you can — the LiteLLM removal guide covers the migration.