Skip to main content
Available for: Python and TypeScript.

Installation

Usage

Wrap your Crew instance with wrap_crew before calling kickoff. Both sync and async kickoff are supported.

Async usage

With guardrails

Pass guardrails=True to run pre/post content checks on crew inputs and outputs.
For fine-grained control:

What the wrapper records

The crew’s agent span is named after the crew (crew.name, or crew when it has none), and kickoff / kickoff_async run inside that span. A model call the crew makes through a Zespan provider wrapper (OpenAI, LiteLLM, and so on) joins the same trace as a child of the crew span, so the trace has one root and evaluators can read the final model reply. The previous trace context is put back when the kickoff ends, even when it raises. In TypeScript, wrapCrewAgent does the same with the crew name.

Event listener (zespan-crewai)

The zespan-crewai package forwards CrewAI’s own events to Zespan with no wrapper around the crew. One crew run is one trace: crew span, then a span per task, per agent, per tool call and per model call, each nested under the one that ran it.
  • Hierarchical crews — a coworker’s run is nested under the manager’s Delegate work to coworker tool call, and the crew span carries the crew’s final output. Evaluators judge the manager’s final report, not a coworker’s raw findings.
  • Agent names on tools and model calls — tool and model-call spans carry the name of the agent that made them.
  • Real times — each span is stamped with the time its CrewAI event finished, so traces order correctly and the waterfall starts where the work started.
  • Model text — model-call spans store the prompt and the reply, and agent, task and crew text is kept up to 20,000 characters (it was 2,000). With store_prompts=False none of this text is sent, and stored text is redacted like the SDK’s own.
  • Tool arguments, results and errors — a tool span’s arguments, result and error text follow store_tool_io (and store_prompts) and are redacted like the SDK’s own, then cut to their limit. Agent, task, crew and model-call error text follows store_prompts and is redacted the same way. Pass store_prompts= and store_tool_io= to ZespanCrewAIListener(...) to set them yourself. Without zespan.init() the listener keeps text (the SDK default) and cannot redact it, and logs one warning, no zespan.init() was called. Turn text off without init with those arguments or ZESPAN_STORE_PROMPTS=0 / ZESPAN_STORE_TOOL_IO=0.
  • Crews running at the same time in one process (threads or asyncio tasks) each keep their own trace and agent names.

Agent steps

The crew’s span records zespan.agent.step (how many tasks the crew ran), zespan.agent.stop_reason (done, or error when the run failed) and zespan.agent.route_candidates (how many agents the crew has). With the zespan-crewai event listener, each agent span carries its run number in the crew (zespan.agent.step), the agent’s max_iter as zespan.agent.max_steps, and a stop reason of done or error. See Agent steps.