observer.kickoff()
Wraps crew.kickoff() for you. Task outputs are automatically captured as tool calls.
What gets traced
Per-task timing comes from CrewAI’s event bus (
TaskStartedEvent / TaskCompletedEvent / TaskFailedEvent, available on modern CrewAI versions) - observer.kickoff() registers temporary listeners for the duration of the call, keyed by each task’s real id so concurrent tasks (async_execution=True) are timed correctly rather than attributed to whichever task started most recently.
On older CrewAI versions that predate the event bus,
kickoff() falls back
to splitting the total latency evenly across tasks instead - still useful
for task order, just not exact per-task duration on those versions.observer.observe() context manager
Use this instead of kickoff() when you need to call crew.kickoff() yourself, for example to catch exceptions before they reach AgentX, or to run additional logic between kickoff and reading the result:
kickoff(), the observe() context manager doesn’t auto-populate toolCalls or performanceSummary from task outputs. Record them yourself with span.add_tool_call(...) if you need that detail.
AgentXCrewObserver reference
observe() parameters
with block, assign span.output before exiting to set the trace output.
Call
tracer.flush() before your process exits in scripts or one-shot jobs.
In long-running servers it is not required: traces drain automatically in the
background.
