What gets captured
The adapter hooks into four CrewAI execution points:- LLM calls (
before_llm_call/after_llm_call) — records model name, prompt messages, response, and duration as anLLM_CALLevent. - Tool calls (
before_tool_call/after_tool_call) — records tool name, input arguments, result, and duration as aTOOL_CALLevent.
meta.crewai.*:
| Field | Description |
|---|---|
meta.crewai.executor_id | Identity of the executor running the call |
meta.crewai.iterations | Iteration count at the time of the call |
meta.crewai.duration_ms | Elapsed time in milliseconds for the call |
meta.agent_role | The role of the agent making the call |
meta.task_desc | Description of the task being executed |
Installation
Install AgentDbg with the CrewAI extra:crewai[tools] alongside AgentDbg. If you import the integration without crewai present, you get a clear ImportError with install instructions.
Setting up the adapter
Import the integration module
Importing
agentdbg.integrations.crewai registers the execution hooks automatically. Import it once, anywhere before your crew or flow runs:Wrap your entrypoint with @trace
The adapter only records events while an active AgentDbg run is open. Wrap the function that calls
crew.kickoff() or flow.kickoff():Full example
Hook ordering caveat
CrewAI runs execution hooks in registration order. If anotherbefore_llm_call or before_tool_call hook registered before AgentDbg’s returns False and blocks execution, the AgentDbg hook may not run for that specific call—and that call will not appear in the trace.
What’s coming
The following adapter is planned and not yet available:- Agno — adapter for Agno-based agents.
The adapter requires an active AgentDbg run. Wrap your entrypoint with
@trace or traced_run(...).