Community Instrumentors
There are two main community instrumentors available for CrewAI: To use these instrumentors with LangWatch, you would typically configure them to export telemetry data via OpenTelemetry, which LangWatch can then ingest.Installation
Install LangWatch, CrewAI and one of the two instrumentors:LANGWATCH_API_KEY from the environment.
Integrating Community Instrumentors with LangWatch
Community-provided OpenTelemetry instrumentors for CrewAI, like those from OpenLLMetry or OpenInference, capture trace data from your CrewAI agents and tasks. LangWatch reads that data through OpenTelemetry. There are two main ways to integrate these:1. Via langwatch.setup()
You can pass an instance of the CrewAI instrumentor to the instrumentors list in the langwatch.setup() call. LangWatch will then manage the lifecycle of this instrumentor.
Install the instrumentation library for the instrumentor you use:
- OpenLLMetry:
pip install opentelemetry-instrumentation-crewai - OpenInference:
pip install openinference-instrumentation-crewai
2. Direct Instrumentation
If you have an existing OpenTelemetryTracerProvider configured in your application (or if LangWatch is configured to use the global provider), you can use the community instrumentor’s instrument() method directly. LangWatch will automatically pick up the spans generated by these instrumentors as long as its exporter is part of the active TracerProvider.
Key points for community instrumentors:
- These instrumentors typically patch CrewAI at a global level or integrate deeply with its execution flow, meaning all CrewAI operations (agents, tasks, tools) should be captured once instrumented.
- If using
langwatch.setup(instrumentors=[...]), LangWatch handles the setup and lifecycle of the instrumentor. - If instrumenting directly (e.g.,
CrewAIInstrumentor().instrument()), ensure that theTracerProviderused by the instrumentor is the same one LangWatch is exporting from. This usually means LangWatch is configured to use an existing global provider or one you explicitly pass tolangwatch.setup(). - Always refer to the specific documentation of the community instrumentor (OpenLLMetry or OpenInference) for the most accurate and up-to-date installation and usage instructions, including the correct class names for instrumentors and any specific setup requirements.
Check it worked
Run the example. Then open your project in LangWatch: a new trace appears in the traces list within a few seconds. Open it to see the crew’s agents, tasks and model calls nested inside the trace named in the decorator, for example “CrewAI Execution with OpenInference”. If no trace appears, check thatLANGWATCH_API_KEY is set in the environment the script runs in.