CrewAI
Step and task callbacks that trace crew lifecycle, agent steps and tool use from CrewAI.
pip install "axonpush[crewai]"Tested against crewai>=0.50.0,<2.0, which requires Python 3.11 or newer.
The integration only reads attributes off the step and task objects CrewAI
hands its callbacks, so any release exposing agent, tool, tool_input,
result and thought works.
Wire the callbacks
from crewai import Crew
from axonpush import AxonPush
from axonpush.integrations.crewai import AxonPushCrewCallbacks
client = AxonPush()
callbacks = AxonPushCrewCallbacks(client, channel_id, agent_id="crew")
callbacks.on_crew_start()
crew = Crew(
agents=[...],
tasks=[...],
step_callback=callbacks.on_step,
task_callback=callbacks.on_task_complete,
)
result = crew.kickoff()
callbacks.on_crew_end(result)
callbacks.flush(timeout=2.0)client and channel_id are positional. CrewAI has no crew-level hook, so
on_crew_start() and on_crew_end(result) are yours to call, they bracket
the run and give the trace a start and an end.
This integration is sync-only. It takes an AxonPush; there is no async
sibling.
Constructor
AxonPushCrewCallbacks(
client, # AxonPush - positional
channel_id, # str UUID - positional
*,
agent_id="crewai",
trace_id=None,
mode=None, # "background" (default) | "sync"
queue_size=1000,
shutdown_timeout=2.0,
)agent_id is a fallback. on_step reads the step’s own agent attribute and
attributes the event to that name when there is one, so a multi-agent crew
separates cleanly.
What gets published
| Identifier | Event type | Payload | Emitted by |
|---|---|---|---|
crew.start | agent.start | framework | on_crew_start() |
agent.step | agent.message | thought (first 500 chars) | on_step, when the step used no tool |
tool.<name>.start | agent.tool_call.start | tool_name, tool_input (first 500 chars) | on_step, when the step used a tool |
tool.<name>.end | agent.tool_call.end | tool_name, result_preview (first 500 chars) | on_step, when that step also carried a result |
task.complete | agent.end | task_description (first 200 chars), output_preview (first 500 chars) | on_task_complete |
crew.end | agent.end | result_preview (first 500 chars) | on_crew_end() |
A tool-using step emits both the start and the end event from the same callback, because CrewAI reports the tool and its result together.
Every event carries framework: "crewai" in metadata, and they all share one
trace id, pass trace_id= to join an existing trace.
Flush before you exit
callbacks.flush(timeout=2.0)
callbacks.close()