CrewAI

Trace CrewAI multi-agent workflows with Respan.

  1. Sign up — Create an account at platform.respan.ai
  2. Create an API key — Generate one on the API keys page
  3. Add credits or a provider key — Add credits on the Credits page or connect your own provider key on the Integrations page

Add the Docs MCP to your AI coding tool to get help building with Respan. No API key needed.

1{
2 "mcpServers": {
3 "respan-docs": {
4 "url": "https://docs.respan.ai/mcp"
5 }
6 }
7}

What is 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.

Setup

1

Install packages

$pip install respan-ai openinference-instrumentation-crewai crewai
2

Set environment variables

$export RESPAN_API_KEY="YOUR_RESPAN_API_KEY"
$export OPENAI_API_KEY="YOUR_OPENAI_API_KEY"
3

Initialize and run

1import os
2from dotenv import load_dotenv
3
4load_dotenv()
5
6from respan import Respan
7from respan_instrumentation_openinference import OpenInferenceInstrumentor
8from openinference.instrumentation.crewai import CrewAIInstrumentor
9from crewai import Agent, Task, Crew
10
11# Initialize Respan with CrewAI instrumentation
12respan = Respan(
13 instrumentations=[
14 OpenInferenceInstrumentor(instrumentor=CrewAIInstrumentor())
15 ]
16)
17
18# Define agents
19researcher = Agent(
20 role="Researcher",
21 goal="Research and summarize the latest AI trends",
22 backstory="You are a senior AI researcher with years of experience.",
23)
24
25writer = Agent(
26 role="Writer",
27 goal="Write a concise report based on the research",
28 backstory="You are a technical writer who excels at clear communication.",
29)
30
31# Define tasks
32research_task = Task(
33 description="Research the latest trends in AI agent frameworks.",
34 expected_output="A summary of key trends and developments.",
35 agent=researcher,
36)
37
38write_task = Task(
39 description="Write a brief report based on the research findings.",
40 expected_output="A well-structured report in markdown format.",
41 agent=writer,
42)
43
44# Create and run the crew
45crew = Crew(
46 agents=[researcher, writer],
47 tasks=[research_task, write_task],
48)
49
50result = crew.kickoff()
51print(result)
52respan.flush()
4

View your trace

Open the Traces page to see your CrewAI workflow with agent spans, task execution, and LLM calls.

What gets traced

All CrewAI operations are auto-instrumented:

  • Agent role assignments and delegation
  • Task execution and handoffs between agents
  • LLM calls with model, tokens, and input/output
  • Tool usage by individual agents
  • Crew kickoff and workflow completion

Traces appear in the Traces dashboard.

Learn more