AgentGuard CrewAI Integration
Automatic trace capture for CrewAI multi-agent workflows.
Installation
pip install agentguard-crewai
Quick Start
from crewai import Crew, Agent, Task
from agentguard_crewai import AgentGuardObserver
# Define your agents
researcher = Agent(
role="Researcher",
goal="Research and analyze topics",
backstory="Expert researcher with deep analysis skills"
)
writer = Agent(
role="Writer",
goal="Write engaging content",
backstory="Creative writer with storytelling expertise"
)
# Define tasks
research_task = Task(
description="Research AI trends in 2026",
agent=researcher,
expected_output="Detailed research report"
)
writing_task = Task(
description="Write article based on research",
agent=writer,
context=[research_task],
expected_output="Published article"
)
# Create crew with AgentGuard observer
crew = Crew(
agents=[researcher, writer],
tasks=[research_task, writing_task]
)
observer = AgentGuardObserver(api_key="ag_live_your_key")
observer.register_crew_agents(crew)
# Run crew - traces automatically captured!
result = crew.kickoff()
# View traces in AgentGuard dashboard
print("✅ Execution complete! View traces at http://localhost:3000/dashboard")
Features
- ✅ Automatic agent registration - Agents registered in AgentGuard on first use
- ✅ Task execution tracking - Capture every task execution with timing
- ✅ Tool call monitoring - Track all tool uses by agents
- ✅ Multi-agent coordination - Capture delegation and collaboration events
- ✅ Error tracking - Automatic error capture and reporting
- ✅ State drift detection - Monitor inter-agent state changes
- ✅ PII redaction - Sensitive data automatically redacted
Advanced Usage
Custom Configuration
observer = AgentGuardObserver(
api_key="ag_live_your_key",
base_url="https://api.agentguard.io", # Production API
capture_tools=True, # Capture tool calls
capture_coordination=True, # Capture agent coordination
auto_register_agents=True # Auto-register agents
)
Manual Event Tracking
# Track task start
observer.on_task_start(task, agent, crew)
# Track tool use
observer.on_tool_use(agent, tool, input_data, output_data)
# Track coordination
observer.on_agent_coordination(source_agent, target_agent, message, crew)
# Track completion
observer.on_task_complete(task, agent, output, crew)
# Track errors
observer.on_task_error(task, agent, error, crew)
Monkey-Patching (Automatic)
For automatic tracing without manual observer setup:
from agentguard_crewai import monkey_patch_crewai, AgentGuardObserver
# Patch CrewAI globally
observer = AgentGuardObserver(api_key="ag_live_...")
monkey_patch_crewai(observer)
# All Crew executions are now automatically traced
crew = Crew(agents=[...], tasks=[...])
crew.kickoff() # Automatically traced!
What Gets Captured
Task Execution
{
"task": "Research AI trends",
"expected_output": "Research report",
"context": ["Previous task outputs"],
"tools": ["WebSearchTool", "ScraperTool"],
"duration_ms": 12500,
"status": "success"
}
Multi-Agent Coordination
{
"coordination": {
"allow_delegation": True,
"crew_size": 3,
"agent_role": "Researcher",
"events": [
{
"from": "Researcher",
"to": "Writer",
"message": "Here's the research data",
"timestamp": 1737645123.45
}
]
}
}
Tool Calls
{
"tool_calls": [
{
"tool": "WebSearchTool",
"input": "AI trends 2026",
"output": "Found 100 articles...",
"timestamp": 1737645120.12
}
]
}
Dashboard Integration
View all captured traces in AgentGuard dashboard:
- Timeline view - See task execution sequence
- Coordination graph - Visualize agent interactions
- Tool usage - Track which tools are used most
- Error analysis - Identify failure patterns
- Performance metrics - Optimize slow tasks
Support
- 📚 Docs: https://docs.agentguard.io/integrations/crewai
- 💬 Discord: https://discord.gg/agentguard
- 🐛 Issues: https://github.com/agentguard/crewai-integration/issues
License
MIT
Metadata
Release files for overseex-crewai 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| overseex_crewai-0.1.0.tar.gz | 11.1 kB | Without provenance | Details for overseex_crewai-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| overseex_crewai-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for overseex_crewai-0.1.0-py3-none-any.whl |
Total release size: 21.3 kB
Release files / overseex_crewai-0.1.0.tar.gz
| Download URL | overseex_crewai-0.1.0.tar.gz |
|---|---|
| Size | 11.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a7ac90654c0bf649fc9bb5f1d2c1e0e00d2bcf6aa94b14af3bed50dbb8330e2f
|
|
BLAKE2b-256 checksum How to use checksums |
f9f34162a746e775d946c30a77430ecf189db0ac09ef03f15b173c719771794f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.2
|
Release files / overseex_crewai-0.1.0-py3-none-any.whl
| Download URL | overseex_crewai-0.1.0-py3-none-any.whl |
|---|---|
| Size | 10.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ab8f989403548034f0a050d479fc9e097e59441c78d0292a23c66884765661a5
|
|
BLAKE2b-256 checksum How to use checksums |
545808605d3bebdfe26c0daa5691dbfff4677475bbd51a07a11b35b655f406ad
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.2
|
Security for overseex-crewai 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.