Skip to main content

CrewAI

Auto-instrumentation for CrewAI multi-agent crews.

Risicare provides deep integration with CrewAI for multi-agent crew observability.

Python only

This framework integration is available in the Python SDK only. No JavaScript package exists for CrewAI.

Version Compatibility

Requires crewai >= 0.50.0.

Installation

pip install 'risicare[crewai]'
# or
pip install risicare crewai

The version of anthropic

The extra risicare[crewai] adds only crewai>=0.50.0. Risicare does not set the version of a model client such as anthropic. The CrewAI extra crewai[anthropic] pins anthropic~=0.73.0. So an install that asks for crewai[anthropic] and also for a newer anthropic (for example 2.x) cannot be resolved: the installer stops with a conflict. Do not ask for both in one install.

Basic Usage

import risicare
from crewai import Agent, Task, Crew
 
risicare.init()
 
# Define agents as usual - they're automatically traced
researcher = Agent(
    role="Researcher",
    goal="Find accurate information",
    backstory="Expert at research"
)
 
writer = Agent(
    role="Writer",
    goal="Write compelling content",
    backstory="Skilled technical writer"
)
 
# Create tasks
research_task = Task(
    description="Research the topic",
    agent=researcher
)
 
write_task = Task(
    description="Write the article",
    agent=writer
)
 
# Run crew - fully traced
crew = Crew(agents=[researcher, writer], tasks=[research_task, write_task])
result = crew.kickoff()

What's Captured

Agent Details

FieldDescription
agent.role"orchestrator" (crew kickoff) or "worker" (agent execution)
agent.type"crewai"
agent.nameThe agent's role (or its name when it has no role), on worker spans. The worker span is crewai.agent/{role}. The crew span has the name of the crew (often crew) when no agent is current (since 0.16.0). All crews with no name are one agent on the Agents page. Give each crew a name to tell them apart

Crew & Task Execution

FieldDescription
framework.crewai.agent_countNumber of agents in the crew
framework.crewai.agent_rolesList of agent roles (up to 10), on the crew span of a synchronous kickoff. kickoff_async gives one crew span
framework.crewai.agent_goalThe agent's goal (when content tracing is enabled)
framework.crewai.agent_outputWorker agent output (when content tracing is enabled)
framework.crewai.resultFinal crew result (when content tracing is enabled)
framework.crewai.task_countNumber of tasks
framework.crewai.task_descriptionTask description, cut to 100 characters, when content tracing is enabled. Without it, the value is <risicare:content-omitted>

Agent Hierarchy

Hierarchical crews are reflected in the span tree:

crew = Crew(
    agents=[manager, worker1, worker2],
    tasks=[task],
    process=Process.hierarchical,
    manager_llm=ChatOpenAI(model="gpt-4o")
)

The span hierarchy shows which agents executed and in what order. Manager and worker relationships are visible through the parent-child span structure.

Tool Usage

Each tool call of a CrewAI agent is a span of kind tool_call (since Python 0.16.0). It is named crewai.tool/{name}, and it is a child of the span of the agent or the step that called it:

from crewai_tools import SerperDevTool
 
search_tool = SerperDevTool()
 
researcher = Agent(
    role="Researcher",
    tools=[search_tool]
)
FieldDescription
tool.nameThe name of the tool
tool.input, tool.outputThe arguments and the result of the call, with content capture on. They are content keys: with content capture off, the span has tool.input_length and tool.output_length instead

A tool that fails

A tool that fails makes an error span. The trace has an error also when CrewAI gives the error to the model as text and the run ends ok. So the trace goes to the trace.error webhook. Before Python 0.16.0, the integration made no span for a tool call, and no span marked a failed tool.

If a tool makes an LLM call, provider instrumentation captures that call as a span of its own.

CrewAI with fork pools has a known limit, and a library handler can chain to the handler of the SDK. See Known limits.

Tasks

Task information is surfaced as attributes on the spans above, not as separate task spans: framework.crewai.task_count on the crew span and framework.crewai.task_description on the worker (crewai.agent) span. Dependencies you declare with context=[...] shape how CrewAI orders execution, but they are not emitted as separate dependency spans.

research_task = Task(
    description="Research the topic",
    agent=researcher
)
 
write_task = Task(
    description="Write based on research",
    agent=writer,
    context=[research_task]  # influences execution order; not a separate span
)

Provider Spans

CrewAI instrumentation creates agent/framework-level spans. Underlying LLM calls (e.g., OpenAI, Anthropic) are traced separately by provider instrumentation, giving you both framework-level and LLM-level visibility.

Visualization

View crew execution in the dashboard:

  • The trace page: the span waterfall and the timeline of the run
  • The Agents page: statistics for each agent

Next Steps