All integrations
CrewAI
Gate sensitive CrewAI crew actions behind human approval before they execute.
Install
pip install cheqpointpip install cheqpoint
Create a Cheqpoint approval tool
Python
from crewai import Agent, Task, Crew
from crewai_tools import tool
from cheqpoint import CheqpointClient
client = CheqpointClient(api_key=os.environ["CHEQPOINT_API_KEY"])
@tool("request_human_approval")
def request_human_approval(action: str, summary: str, details: dict) -> str:
"""Request human approval before executing a sensitive action."""
result = client.checkpoint(
action=action,
summary=summary,
details=details,
risk_level="high",
)
if result["status"] == "APPROVED":
return f"Approved. Note: {result.get('decisionNote', '')}"
raise ValueError(f"Rejected: {result.get('decisionNote', 'No reason given')}")from crewai import Agent, Task, Crew
from crewai_tools import tool
from cheqpoint import CheqpointClient
client = CheqpointClient(api_key=os.environ["CHEQPOINT_API_KEY"])
@tool("request_human_approval")
def request_human_approval(action: str, summary: str, details: dict) -> str:
"""Request human approval before executing a sensitive action."""
result = client.checkpoint(
action=action,
summary=summary,
details=details,
risk_level="high",
)
if result["status"] == "APPROVED":
return f"Approved. Note: {result.get('decisionNote', '')}"
raise ValueError(f"Rejected: {result.get('decisionNote', 'No reason given')}")Wire into a CrewAI agent
Python
finance_agent = Agent(
role="Finance Manager",
goal="Process customer refunds within policy",
backstory="You are a careful finance agent that always gets approval for large refunds.",
tools=[request_human_approval],
verbose=True,
)
approve_task = Task(
description="Approve the £750 refund for order #98765 if within policy.",
agent=finance_agent,
expected_output="Confirmation that refund was approved or reason for rejection.",
)
crew = Crew(agents=[finance_agent], tasks=[approve_task])
result = crew.kickoff()
print(result)finance_agent = Agent(
role="Finance Manager",
goal="Process customer refunds within policy",
backstory="You are a careful finance agent that always gets approval for large refunds.",
tools=[request_human_approval],
verbose=True,
)
approve_task = Task(
description="Approve the £750 refund for order #98765 if within policy.",
agent=finance_agent,
expected_output="Confirmation that refund was approved or reason for rejection.",
)
crew = Crew(agents=[finance_agent], tasks=[approve_task])
result = crew.kickoff()
print(result)