Integration Guide
CrewAI
Connect CrewAI to DashClaw and get your first governed action into /decisions in under 20 minutes.
Instance URL detected: https://your-dashclaw-instance.example.com
Deploy DashClaw
Get a running instance. Click the Vercel deploy button or run locally.
Already have an instance? Skip to Step 2.
Install the DashClaw Python SDK and CrewAI
Create a virtual environment and install the required packages. Requires Python 3.10+ (Python 3.14+ is not supported by CrewAI).
Terminal
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate pip install dashclaw crewai==1.11.0 python-dotenv
Set environment variables
Create a .env file with your DashClaw connection details. No LLM API key required for the example.
.env
DASHCLAW_BASE_URL=https://your-dashclaw-instance.example.com DASHCLAW_API_KEY=oc_live_...
Create a governed CrewAI tool with the @tool decorator
The @tool decorator creates a CrewAI tool. run_governed keeps policy, approval, execution claiming, callback, and outcome on one persisted action.
main.py
from crewai.tools import tool
from dashclaw import DashClaw
import os
claw = DashClaw(
base_url=os.environ["DASHCLAW_BASE_URL"],
api_key=os.environ["DASHCLAW_API_KEY"],
agent_id="crewai-analyst-agent",
)
@tool("Analyze Customer Data")
def analyze_customer_data(query: str) -> str:
"""Analyze customer data. Governed by DashClaw policies."""
return claw.run_governed(
{"kind": "sql", "statement": f"/* customer analysis */ {query}"},
{
"action_type": "data_analysis",
"declared_goal": f"Analyze customer data: {query}",
"risk_score": 40,
"systems_touched": ["customer_database"],
},
lambda: f"Analysis of '{query}': 42 segments, avg satisfaction 4.2/5.",
)The callback runs only after DashClaw confirms protocol-1 execution authority for the exact action and act.
Run the governed CrewAI tool
Execute the example and watch the governance flow.
Terminal
python main.py
No LLM API key needed: the example calls the tool directly. Only the DashClaw SDK calls are real.
See the result in DashClaw
Open your DashClaw dashboard to confirm the action was recorded.
Go to /decisions: you should see your action in the ledger with action_type 'data_analysis', agent_id 'crewai-analyst-agent', and status 'completed'.
Clone the full example
The complete runnable example is in the DashClaw repo.
Terminal
git clone https://github.com/ucsandman/DashClaw.git cd DashClaw/examples/crewai-governed pip install -r requirements.txt python main.py
For production CrewAI integrations, the Python SDK also includes a DashClawCrewIntegration class (sdk-python/dashclaw/integrations/crewai.py) that provides automatic task callbacks for governing entire crews.
What success looks like
Go to /decisions: you should see your action in the ledger with action_type 'data_analysis', agent_id 'crewai-analyst-agent', and status 'completed'.
Navigate to /decisions in your DashClaw instance. Your action should appear in the ledger within seconds of the agent run.
Governance as Code
guardrails.yml is a policy-as-code template. Import it into your instance — POST the YAML to /api/policies/import or call the Python SDK's import_policies — and DashClaw evaluates these rules at the guard step before any action executes.
guardrails.yml
version: 1
project: my-crewai-agent
description: >
Governance policy for a CrewAI data analysis crew.
Customer data analysis requires audit trail.
External API calls require approval.
policies:
- id: audit_data_analysis
description: All data analysis tools must record an audit trail
applies_to:
tools:
- Analyze Customer Data
- Generate Report
rule:
allow: true
- id: approve_external_calls
description: External API calls require human approval
applies_to:
tools:
- Send Email
- Post to Slack
rule:
require: approval