Documentation / crewai
Framework GuidePython

CrewAI Integration

Enforce policy-based permissions for hierarchical task execution and multi-agent roles.

1. Installation

bash
pip install suprawall crewai

2. Securing a Crew Task

SupraWall integrates with CrewAI's task lifecycle. Initialize the global client and wrap your agent or crew.

python
from crewai import Agent, Task, Crew
from suprawall import Client, secure_agent
import os

# 1. Initialize SupraWall with Deny-by-default
sw = Client(api_key=os.environ.get("SUPRAWALL_API_KEY"), default_policy="DENY")

# 2. Define your research agent
research_agent = Agent(
    role="Researcher", 
    goal="Search the web", 
    tools=[search_tool]
)

# 🛡️ Secure the agent (or the whole crew)
# Every tool call attempted by research_agent is now gated by SupraWall.
secured_agent = secure_agent(research_agent, client=sw)

# 3. Use in your task
task = Task(
    description="Find the latest AI news.",
    agent=secured_agent
)

crew = Crew(agents=[secured_agent], tasks=[task])
crew.kickoff()

Task-Level Governance

Role Permissions

Restrict specific tools to certain agent roles.

Task Sandboxing

Ensure destructive tools are only used in designated safe tasks.

Audit Trail

Full history of which agent executed which tool and why.

Custom Flows

Inject approval steps for high-stakes tasks automatically.