CrewAI
CrewAI is a framework for orchestrating role-playing autonomous AI agents. It allows you to define agents with specific roles, goals, and tools, then coordinate them to accomplish complex tasks through collaborative workflows. Respan traces CrewAI runs with respan-instrumentation-crewai, which activates the OpenInference CrewAI instrumentor and exports crew, agent, task, tool, and LLM spans through the Respan tracing pipeline.
Set up Respan
Create an account at platform.respan.ai and grab an API key. For gateway, also add credits or a provider key.
Run npx @respan/cli setup to set up with your coding agent.
Example projects
Tracing
Gateway
Setup
Set environment variables
OPENAI_API_KEY is used for LLM requests. RESPAN_API_KEY is used to export traces to Respan.
Initialize and run
Initialize Respan before importing CrewAI so the instrumentor can patch CrewAI early.
View your trace
Open the Traces page to see your CrewAI workflow with agent spans, task execution, tool usage, and LLM calls.
Configuration
CrewAIInstrumentor(use_event_listener=True, create_llm_spans=True, **kwargs) passes keyword arguments through to the underlying OpenInference CrewAI instrumentor.
Attributes
In Respan()
Set defaults at initialization. These apply to all spans.
With propagate_attributes
Override per-request using a context scope.
Decorators (optional)
Decorators are not required. All CrewAI agent steps, tasks, and LLM calls are auto-traced by the instrumentor. Use @workflow and @task to add structure when you want to group related crews into a named workflow with nested tasks.
Examples
Tool calls
Tool calls are automatically captured as spans with inputs, outputs, and timing.