CrewAI Integration
Secure your multi-agent CrewAI systems with AIM. Get complete visibility, audit trails, and trust scoring for your entire crew - from individual agents to complex multi-agent workflows.
What You'll Get
- Crew-level verification for multi-agent system executions
- Task-level verification for individual agent tasks
- Complete audit trail of all crew and task executions
- Real-time trust scoring for AI agent crews
- Automatic compliance reporting (SOC 2, HIPAA, GDPR)
Integration Time: 5 minutes
Code Changes: 3-5 lines
Difficulty: Beginner
Quick Start (5 Minutes)
Step 1: Download SDK from AIM Dashboard
Important: There is NO pip package for the AIM SDK. You must download it from your AIM dashboard with pre-configured credentials.
- 1. Login to AIM Dashboard → Settings → SDK Download
- 2. Click "Download Python SDK" (contains your credentials)
- 3. Extract the downloaded ZIP file
- 4. Install dependencies:
pip install crewai keyring PyNaCl
Step 2: Register Crew Agent
In AIM Dashboard (running on http://localhost:8080):
- Navigate to Agents → Register New Agent
- Name:
research-crew - Type: AI Agent
- Copy the generated credentials
export AIM_URL="http://localhost:8080"
export AIM_AGENT_ID="your-agent-id"
export AIM_PRIVATE_KEY="your-private-key"
export OPENAI_API_KEY="your-openai-key"Step 3: Add AIM to Your CrewAI Crew
Before (Unsecured)
from crewai import Agent, Task, Crew
# Define agents
researcher = Agent(
role="Researcher",
goal="Find accurate information",
backstory="Expert researcher"
)
writer = Agent(
role="Writer",
goal="Write engaging content",
backstory="Professional writer"
)
# Define tasks
research_task = Task(
description="Research AI safety best practices",
agent=researcher
)
write_task = Task(
description="Write blog post about AI safety",
agent=writer
)
# Create crew and run (no security, no audit trail)
crew = Crew(agents=[researcher, writer], tasks=[research_task, write_task])
result = crew.kickoff()After (Secured with AIM)
from aim_sdk import secure # ← Line 1: Import AIM
from aim_sdk.integrations.crewai import AIMCrewWrapper
from crewai import Agent, Task, Crew
# Register with AIM
aim_agent = secure("research-crew") # ← Line 2: Secure your crew
# Define agents (unchanged)
researcher = Agent(
role="Researcher",
goal="Find accurate information",
backstory="Expert researcher"
)
writer = Agent(
role="Writer",
goal="Write engaging content",
backstory="Professional writer"
)
# Define tasks (unchanged)
research_task = Task(
description="Research AI safety best practices",
agent=researcher
)
write_task = Task(
description="Write blog post about AI safety",
agent=writer
)
# Create crew
crew = Crew(agents=[researcher, writer], tasks=[research_task, write_task])
# Wrap with AIM
secured_crew = AIMCrewWrapper(crew, aim_agent) # ← Line 3: Wrap crew
# Run crew - now secured with full audit trail!
result = secured_crew.kickoff()That's it! Your CrewAI crew is now secured with:
- Complete audit trail of every crew execution
- Task-level tracking for each agent
- Real-time trust scoring (0-100%)
- Security alerts for anomalous behavior
- Automatic compliance reporting
What Gets Logged
Every crew execution is logged to AIM with:
- Crew Name: Identifier for the multi-agent crew
- Agent Roster: Which agents participated
- Tasks Executed: All tasks and their outputs
- Task Assignments: Which agent performed which task
- Execution Timeline: Start/end times for each task
- Trust Score: Crew's trust score during execution
- Verification Status: Whether execution was approved/denied
View in AIM Dashboard
After running your CrewAI crew, visit the AIM Dashboard to see:
- Activity Feed: Real-time stream of crew executions
- Task Timeline: Visualize task execution flow
- Agent Performance: Track individual agent contributions
- Trust Score Evolution: How crew trust changes over time
- Security Alerts: Any anomalous behavior detected
- Audit Logs: Complete compliance-ready audit trail
Advanced: Task-Level Verification
For sensitive tasks, you can require explicit verification before execution:
from aim_sdk.integrations.crewai import AIMVerifiedTask
# Wrap sensitive tasks with verification
sensitive_task = AIMVerifiedTask(
task=research_task,
aim_agent=aim_agent,
require_verification=True # Blocks until verified in AIM dashboard
)
# Add to crew
crew = Crew(
agents=[researcher, writer],
tasks=[sensitive_task, write_task] # First task requires verification
)Multi-Crew Orchestration
Managing multiple crews? AIM tracks them all independently:
# Register multiple crews
research_crew_agent = secure("research-crew")
writing_crew_agent = secure("writing-crew")
editing_crew_agent = secure("editing-crew")
# Each crew gets its own audit trail and trust score
research_crew = AIMCrewWrapper(research_crew, research_crew_agent)
writing_crew = AIMCrewWrapper(writing_crew, writing_crew_agent)
editing_crew = AIMCrewWrapper(editing_crew, editing_crew_agent)
# Run crews - each independently tracked
research_result = research_crew.kickoff()
writing_result = writing_crew.kickoff()
editing_result = editing_crew.kickoff()Next Steps
Trust Scoring
Learn how AIM calculates trust scores for your crews
Security Alerts
Configure alerts for suspicious crew behavior
Compliance Reporting
Generate SOC 2, HIPAA, GDPR compliance reports
API Reference
Explore all 136 AIM API endpoints
Need Help?
Questions about integrating AIM with CrewAI? We're here to help!
- Discord: https://discord.gg/uRZa3KXgEn
- Email: info@opena2a.org
- Documentation: View all docs