CrewAI Integration
Instrument your CrewAI agents and tasks with full Nyraxis observability.
Install
pip install nyraxis-sdkQuick start
from nyraxis_sdk import CrewAIHandler
handler = CrewAIHandler(
api_key="nyx_your_api_key",
base_url="http://localhost:8000",
agent_name="my-crew",
)
# Wrap your task execution
span_id = handler.on_task_start(
task_description="Research AI governance trends",
agent_role="Researcher",
)
# ... run your CrewAI task ...
result = crew.kickoff()
handler.on_task_end(
span_id=span_id,
output=str(result),
model="gpt-4o",
input_tokens=1200,
output_tokens=800,
)
# Record tool calls
handler.on_tool_use("web_search", {"query": "AI governance 2025"}, result)
await handler.flush()What gets captured
- Task execution — description, agent role, output, latency
- Tool calls — name, parameters, result
- Token counts and cost per task
- Governance policies evaluated per span (PII, tool authorization)