{"id":21655,"library":"openinference-instrumentation-crewai","title":"OpenInference CrewAI Instrumentation","description":"OpenTelemetry instrumentation for CrewAI agents and tasks, enabling distributed tracing and observability via the OpenInference semantic conventions. Version 1.1.3, supports Python 3.10 to 3.13, part of the Arize AI openinference ecosystem. Released as needed alongside crewai updates.","status":"active","version":"1.1.3","language":"python","source_language":"en","source_url":"https://github.com/Arize-ai/openinference/tree/main/python/instrumentation/openinference-instrumentation-crewai","tags":["opentelemetry","instrumentation","tracing","crewai","openinference","observability"],"install":[{"cmd":"pip install openinference-instrumentation-crewai","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"Base instrumentation package providing OpenInferenceSemanticConventions and trace utilities.","package":"openinference-instrumentation","optional":false},{"reason":"Instrumented library; must be installed to use the instrumentation.","package":"crewai","optional":false},{"reason":"Used for monkey-patching crewai classes. Version 2.x compatible since recent fix.","package":"wrapt","optional":false}],"imports":[{"note":"","symbol":"CrewAIInstrumentor","correct":"from openinference.instrumentation.crewai import CrewAIInstrumentor"}],"quickstart":{"code":"from opentelemetry import trace\nfrom opentelemetry.sdk.trace import TracerProvider\nfrom opentelemetry.sdk.trace.export import SimpleSpanProcessor, ConsoleSpanExporter\nfrom openinference.instrumentation.crewai import CrewAIInstrumentor\n\n# Set up OTEL tracing\ntrace.set_tracer_provider(TracerProvider())\nspan_processor = SimpleSpanProcessor(ConsoleSpanExporter())\ntrace.get_tracer_provider().add_span_processor(span_processor)\n\n# Instrument CrewAI\nCrewAIInstrumentor().instrument()\n\n# Now run CrewAI code; spans will be exported to console\ntracer = trace.get_tracer(__name__)\nwith tracer.start_as_current_span(\"example\"):\n    # Your CrewAI agent/task code here\n    pass\n","lang":"python","description":"Minimal setup to instrument CrewAI and export spans to console. Replace ConsoleSpanExporter with an OTLP exporter for production."},"warnings":[{"fix":"Upgrade crewai to latest version (pip install --upgrade crewai).","message":"Requires Python 3.10+ and crewai version >=0.30.0. Older crewai versions are not supported and will fail to instrument.","severity":"breaking","affected_versions":"<=0.30.0"},{"fix":"Reorder imports: call instrument() before any crewai imports, or use suppress_imports=True and then import crewai after instrument().","message":"Must call instrument() before importing or instantiating crewai components to ensure proper monkey-patching. If instrument() is called after crewai is already loaded, it may not work correctly.","severity":"gotcha","affected_versions":"all"},{"fix":"Use `from openinference.instrumentation.crewai import CrewAIInstrumentor`.","message":"The module `openinference_instrumentation_crewai` (underscore style) is deprecated; use `openinference.instrumentation.crewai` (dot style).","severity":"deprecated","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Use `from openinference.instrumentation.crewai import CrewAIInstrumentor`.","cause":"Old import path using underscore or incorrect package name.","error":"ImportError: cannot import name 'CrewAIInstrumentor' from 'openinference.instrumentation.crewai'"},{"fix":"Call `trace.set_tracer_provider(TracerProvider())` before `CrewAIInstrumentor().instrument()`.","cause":"TracerProvider not set before instrumentation.","error":"opentelemetry.sdk.trace.TraceError: failed to set tracer provider"},{"fix":"Add a span processor, e.g., `trace.get_tracer_provider().add_span_processor(SimpleSpanProcessor(ConsoleSpanExporter()))`.","cause":"Instrument() called without setting up a span processor or exporter; spans have no destination.","error":"TypeError: 'NoneType' object is not callable"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}