Skip to main content
CrewAI agents do their work through tools. TracePilot traces those tool invocations using tp.wrapToolCall, which captures the tool name, inputs, outputs, and latency for every call your agents make. Wrap at the tool level, not the agent level — this gives you precise visibility into which tool ran, what it received, and what it returned.

How the pattern works

Each CrewAI tool has an _run method where the actual work happens. You wrap the underlying call inside _run with tp.wrapToolCall. The method still returns its result unchanged; TracePilot captures the span in the background and links it to the parent trace via parentSpanId.
Wrap at the tool level, not the agent level. CrewAI agents orchestrate multiple tools — if you only wrap the agent, you lose per-tool visibility.

Setup

1

Install dependencies

2

Initialize TracePilot

Create a shared tp instance your tools can import.
3

Wrap your tool's _run method

Pass the trace’s root spanId as parentSpanId so the tool span appears nested under the agent trace in the dashboard.
4

Mark destructive tools

Tools that write data — sending emails, updating records, posting messages — should set isDestructive: true. This adds a warning badge in the dashboard so you can review these calls before forking and re-running an execution.

Full example: CrewAI agent with traced tools

This example shows a CrewAI research agent that uses two traced tools — a read-only web search and a destructive database write.

Tracing multiple agents

When your crew has more than one agent, start a trace once and pass the root spanId to each agent’s tools. All tool spans will appear under the same trace in the dashboard, grouped by agent.
Use isDestructive: true for any tool that modifies external state — database writes, API calls that send messages, file deletions. This prevents accidental side effects when you fork and re-run a failing execution from the dashboard.