Integrations
CrewAI
Scan CrewAI tool calls through Interven using the Python SDK guard decorator.
Use the base Interven Python SDK to guard CrewAI tool calls. The guard
decorator wraps any function so it's scanned before execution.
Install
pip install intervenGuard a CrewAI tool
from crewai_tools import BaseTool
from interven import guard
class MySalesforceTool(BaseTool):
name = "salesforce_query"
description = "Query Salesforce records"
@guard(api_key="iv_live_...", tool="salesforce", operation="query")
def _run(self, query: str) -> str:
# Your Salesforce logic here
return salesforce_client.query(query)
crew = Crew(
agents=[my_agent],
tasks=[task],
tools=[MySalesforceTool()],
)Alternative โ scan manually with gate
For more control, use gate inside your tool:
from interven import gate
class MySlackTool(BaseTool):
name = "slack_post"
description = "Post a message to Slack"
def _run(self, channel: str, text: str) -> str:
result = gate(
"POST",
"https://slack.com/api/chat.postMessage",
body={"channel": channel, "text": text},
api_key="iv_live_...",
)
if result.decision == "DENY":
return f"Blocked: {result.reason_codes}"
if result.decision == "SANITIZE":
text = result.sanitized_body["text"]
return slack_client.post_message(channel, text)Behavior
| Decision | CrewAI behavior |
|---|---|
| ALLOW | Tool runs normally |
| DENY | guard raises InterventBlockedError; gate returns the decision for you to handle |
| SANITIZE | guard rewrites arguments with redacted values; tool runs with clean data |
| REQUIRE_APPROVAL | guard blocks until analyst approves in the Console |