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

1

Deploy DashClaw

Get a running instance. Click the Vercel deploy button or run locally.

Already have an instance? Skip to Step 2.

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==2.6.0 crewai==1.11.0 python-dotenv
3

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=<your-workspace-api-key>
4

Create a governed CrewAI tool with the @tool decorator

The @tool decorator creates a CrewAI tool. Inside the function, call DashClaw guard before executing, then record the action and outcome.

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."""

    # 1. GUARD: Check policy before executing
    result = claw.guard({
        "action_type": "data_analysis",
        "declared_goal": f"Analyze customer data: {query}",
        "risk_score": 40,
        "systems_touched": ["customer_database"],
    })

    if result.get("decision") == "block":
        reasons = result.get("reasons", [])
        return f"Blocked by governance policy: {', '.join(reasons)}"

    # 2. RECORD: Declare intent
    action = claw.create_action(
        "data_analysis",
        f"Analyze customer data: {query}",
        risk_score=40,
    )
    action_id = action["action_id"]

    # 3. EXECUTE: Your tool logic here
    analysis_result = f"Analysis of '{query}': 42 segments, avg satisfaction 4.2/5."

    # 4. OUTCOME: Report result
    claw.update_outcome(action_id, status="completed", output_summary=analysis_result)

    return analysis_result

The guard check runs before each tool execution. If the policy blocks, the tool returns early with the block reason. Otherwise it records the action, executes, and reports the outcome.

5

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.

6

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'.

7

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

Drop a guardrails.yml in your project root to enforce policies without code changes. 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