OpenTelemetry CrewAI Instrumentation
This library provides OpenTelemetry instrumentation for CrewAI, a framework for orchestrating autonomous AI agents.
Installation
pip install splunk-otel-instrumentation-crewai
Usage
from opentelemetry.instrumentation.crewai import CrewAIInstrumentor
from crewai import Agent, Task, Crew
# Instrument CrewAI
CrewAIInstrumentor().instrument()
# Create your crew
agent = Agent(
role="Research Analyst",
goal="Provide accurate research",
backstory="Expert researcher with attention to detail",
)
task = Task(
description="Research the latest AI trends",
expected_output="A comprehensive report on AI trends",
agent=agent,
)
crew = Crew(agents=[agent], tasks=[task])
# Run your crew - telemetry is automatically captured
result = crew.kickoff()
What Gets Instrumented
This instrumentation captures:
Crews → Mapped to Workflow spans
Tasks → Mapped to Step spans
Agents → Mapped to AgentInvocation spans
Tool Usage → Mapped to ToolCall spans
All spans are properly nested with correct parent-child relationships and include rich attributes about the operation.
Compositional Instrumentation
This instrumentation focuses on CrewAI’s workflow orchestration. For complete observability:
CrewAI Only
from opentelemetry.instrumentation.crewai import CrewAIInstrumentor
CrewAIInstrumentor().instrument()
Provides workflow structure but no LLM call details.
CrewAI + OpenAI
from opentelemetry.instrumentation.crewai import CrewAIInstrumentor
from opentelemetry.instrumentation.openai import OpenAIInstrumentor
CrewAIInstrumentor().instrument()
OpenAIInstrumentor().instrument()
Adds LLM call spans with token usage, model names, and latency metrics.
Full Stack (CrewAI + OpenAI + Vector Store)
from opentelemetry.instrumentation.crewai import CrewAIInstrumentor
from opentelemetry.instrumentation.openai import OpenAIInstrumentor
from opentelemetry.instrumentation.chromadb import ChromaDBInstrumentor
CrewAIInstrumentor().instrument()
OpenAIInstrumentor().instrument()
ChromaDBInstrumentor().instrument()
Complete RAG workflow visibility with vector store operations.
Configuration
Environment Variables
# Disable CrewAI's built-in telemetry (recommended)
export CREWAI_DISABLE_TELEMETRY=true
Instrumentation Options
from opentelemetry.instrumentation.crewai import CrewAIInstrumentor
# Basic instrumentation
CrewAIInstrumentor().instrument()
# With custom tracer provider
CrewAIInstrumentor().instrument(tracer_provider=my_tracer_provider)
# Uninstrumentation
CrewAIInstrumentor().uninstrument()
Requirements
Python >= 3.9
CrewAI >= 0.70.0
OpenTelemetry API >= 1.38
splunk-otel-util-genai >= 0.1.4
Trace Hierarchy Example
Crew: Customer Support (Workflow)
├── Task: inquiry_resolution (Step)
│ └── Agent: Senior Support Representative
│ ├── LLM: gpt-4o-mini (via openai-instrumentation)
│ └── Tool: docs_scrape
└── Task: quality_assurance (Step)
└── Agent: QA Specialist
└── LLM: gpt-4o-mini (via openai-instrumentation)
Each span includes rich attributes:
gen_ai.system = “crewai”
gen_ai.operation.name = “invoke_workflow” | “invoke_agent” | “execute_tool”
Framework-specific attributes (agent role, task description, tool names, etc.)
Limitations
Async Support: Currently supports synchronous workflows only. Async support (kickoff_async()) is planned for a future release.
LLM Calls: Not instrumented here. Use provider-specific instrumentation (e.g., opentelemetry-instrumentation-openai).
Contributing
Contributions are welcome! Please ensure:
All tests pass
Code follows project style guidelines
Instrumentation is defensive (catches exceptions)
Documentation is updated
Links
License
Apache-2.0
Metadata
Release files for splunk-otel-instrumentation-crewai 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| splunk_otel_instrumentation_crewai-0.1.3.tar.gz | 16.5 kB | Without provenance | Details for splunk_otel_instrumentation_crewai-0.1.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| splunk_otel_instrumentation_crewai-0.1.3-py3-none-any.whl | Python 3 | none | any | Details for splunk_otel_instrumentation_crewai-0.1.3-py3-none-any.whl |
Total release size: 24.0 kB
Release files / splunk_otel_instrumentation_crewai-0.1.3.tar.gz
| Download URL | splunk_otel_instrumentation_crewai-0.1.3.tar.gz |
|---|---|
| Size | 16.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
00c0a66ce85ee46441fc35849410a1a85b31b4fab7bf461cd27983de288801f1
|
|
BLAKE2b-256 checksum How to use checksums |
1a89db3072c13ade35a8dfc41e9700992c2b18a9bc10a4fa4e1fde161b01252b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
Hatch/1.16.5 cpython/3.11.15 HTTPX/0.28.1
|
Release files / splunk_otel_instrumentation_crewai-0.1.3-py3-none-any.whl
| Download URL | splunk_otel_instrumentation_crewai-0.1.3-py3-none-any.whl |
|---|---|
| Size | 7.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
974ff023763daedfc3c89f823ba2f614e1040d27623f86294eeac4cd21664f53
|
|
BLAKE2b-256 checksum How to use checksums |
ab1853cdf228784aa6abc5278f61739f33931fda7791690e284bc8e7edb8f217
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
Hatch/1.16.5 cpython/3.11.15 HTTPX/0.28.1
|
Security for splunk-otel-instrumentation-crewai 0.1.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.