Skip to main content

Installation

pip install pandaprobe[crewai]

Setup

from pandaprobe.integrations.crewai import CrewAIAdapter

adapter = CrewAIAdapter(
    session_id="conversation-123",
    user_id="user-abc",
    tags=["production"],
)
adapter.instrument()

Usage

from crewai import Agent, Task, Crew

researcher = Agent(
    role="Research Analyst",
    goal="Find the latest AI trends",
    backstory="You are an expert AI researcher.",
)

task = Task(
    description="Research the latest developments in AI agents.",
    expected_output="A summary of key trends.",
    agent=researcher,
)

crew = Crew(agents=[researcher], tasks=[task])
result = crew.kickoff()

What gets traced

CrewAI ComponentSpan KindDescription
Crew.kickoff / kickoff_for_eachCHAINRoot trace boundary, crew configuration as system message
Agent.execute_taskAGENTAgent backstory as system message, prior agent context
LLM completion callsLLMToken delta tracking (per-call usage), reasoning extraction
execute_tool_and_check_finalityTOOLTool name from AgentAction, input/output

Multi-agent support

In multi-agent crews, PandaProbe tracks context propagation between agents. Each agent’s output is made available as context for subsequent agents, and this is reflected in the trace hierarchy.

Token usage

CrewAI token usage is computed using delta tracking: the adapter snapshots the agent’s cumulative _token_usage before and after each LLM call to determine per-call token counts.
CrewAI FieldPandaProbe Field
prompt_tokensprompt_tokens
completion_tokenscompletion_tokens
total_tokenstotal_tokens
cached_prompt_tokenscache_read_tokens
reasoning_tokensreasoning_tokens