Skip to main content

What Gets Tracked Automatically

Agent Steps

Every step each agent takes with reasoning.

Task Completions

When tasks complete with outputs.

Tool Calls

All tool executions with inputs and outputs.

Agent Thoughts

Reasoning and decision making.

Installation

pip install sentrial crewai

Basic Usage with Callbacks

Add SentrialCrewHandler callbacks to your Crew:
from crewai import Agent, Task, Crew
from sentrial import SentrialClient
from sentrial.crewai import SentrialCrewHandler

# Initialize Sentrial
client = SentrialClient(api_key="sentrial_live_xxx")

# Create session
session_id = client.create_session(
    name="Research Team",
    agent_name="crewai-research",
    user_id="user_123"
)

# Create handler
handler = SentrialCrewHandler(client, session_id, verbose=True)

# Define agents
researcher = Agent(
    role="Senior Researcher",
    goal="Find comprehensive information",
    backstory="Expert researcher with years of experience",
)

writer = Agent(
    role="Content Writer",
    goal="Write engaging content",
    backstory="Skilled writer who creates clear content",
)

# Define tasks
research_task = Task(description="Research {topic}", agent=researcher)
writing_task = Task(description="Write article", agent=writer)

# Create crew with callbacks
crew = Crew(
    agents=[researcher, writer],
    tasks=[research_task, writing_task],
    step_callback=handler.on_step,
    task_callback=handler.on_task_complete,
)

# Run
result = crew.kickoff(inputs={"topic": "AI agents"})

# Finish
handler.finish(success=True, output=str(result))

Simple Decorator Usage

Use the @track_crew decorator for simpler tracking:
from sentrial import SentrialClient
from sentrial.crewai import track_crew

client = SentrialClient(api_key="sentrial_live_xxx")

@track_crew(client, agent_name="research-crew", user_id="user_123")
def run_research(topic: str):
    crew = Crew(agents=[...], tasks=[...])
    return crew.kickoff(inputs={"topic": topic})

# Just call - automatically tracked!
result = run_research("AI Safety")

Wrap Existing Crew

handler = SentrialCrewHandler(client, session_id)

# Wrap adds callbacks automatically
crew = handler.wrap_crew(crew)

# Now kickoff is tracked
result = crew.kickoff(inputs={"topic": "AI"})

handler.finish(success=True)

Next Steps