Human-in-the-loop approval SDK for AI agents
Project description
The Handover — Python SDK
Human-in-the-loop approval SDK for AI agents. Stop agents from taking destructive actions without human sign-off.
Install
pip install the-handover
With framework integrations:
pip install the-handover[langchain]
pip install the-handover[crewai]
pip install the-handover[openai]
pip install the-handover[all]
Quick Start
from the_handover import HandoverClient, DecisionDenied
client = HandoverClient(api_key="ho_live_...")
try:
decision = client.approve(
action="Delete 500 user records",
approver="admin@company.com",
urgency="critical",
)
print(f"Approved by {decision.resolved_by}")
# Proceed with action...
except DecisionDenied as e:
print(f"Denied: {e}")
# Agent is STOPPED — cannot proceed
Rich Responses
Ask for more than yes/no:
from the_handover import HandoverClient, ChooseResponse
client = HandoverClient(api_key="ho_live_...")
decision = client.approve(
action="Select deployment target",
approver="ops@company.com",
response_type=ChooseResponse(
choices=["staging", "production", "canary"],
label="Which environment?",
),
)
print(f"Deploying to: {decision.response_data['chosen']}")
Enforcement with Decorators
from the_handover import HandoverClient, require_approval
client = HandoverClient(api_key="ho_live_...")
@require_approval(client, approver="admin@company.com", urgency="critical")
def delete_all_users():
db.execute("DELETE FROM users")
# This will NOT execute unless a human approves it.
# If denied, DecisionDenied is raised — the function never runs.
delete_all_users()
LangChain
from the_handover import HandoverClient
from the_handover.integrations.langchain import HandoverApprovalTool
client = HandoverClient(api_key="ho_live_...")
approval_tool = HandoverApprovalTool(client=client, approver="admin@company.com")
# Use in any LangChain agent
agent = create_react_agent(llm, [approval_tool, ...other_tools], prompt)
CrewAI
from the_handover import HandoverClient
from the_handover.integrations.crewai import HandoverApprovalTool
client = HandoverClient(api_key="ho_live_...")
tool = HandoverApprovalTool(client=client, approver="admin@company.com")
agent = Agent(role="Operations Manager", tools=[tool], ...)
OpenAI
from the_handover import HandoverClient
from the_handover.integrations.openai import handover_tool_definition, handle_handover_call
client = HandoverClient(api_key="ho_live_...")
# Add to your tools list
tools = [handover_tool_definition()]
# In your tool call handler
result = handle_handover_call(client, tool_call.function.arguments, approver="admin@company.com")
Docs
Full documentation at thehandover.xyz/docs
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
the_handover-0.2.0.tar.gz
(13.9 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file the_handover-0.2.0.tar.gz.
File metadata
- Download URL: the_handover-0.2.0.tar.gz
- Upload date:
- Size: 13.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6e54ad48ef94c94d28c98eae38659a8f9a9f137bce05739529e80e97fe43bab1
|
|
| MD5 |
48a02799fc370a4e304964d4a57aeb3c
|
|
| BLAKE2b-256 |
c29d454f2c52e3ee91cab00da701a5dfbefafc02127c495024d77d3f43ca3812
|
File details
Details for the file the_handover-0.2.0-py3-none-any.whl.
File metadata
- Download URL: the_handover-0.2.0-py3-none-any.whl
- Upload date:
- Size: 19.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c6b4c827e1488c305e936618ea1220324aa7591421d2343e68cfc3b19081df8d
|
|
| MD5 |
2fcc076f0ed782550aa8a10e80172599
|
|
| BLAKE2b-256 |
727f2ba82b772cde0f5cb40f1f12bf1c1323baa7632299e42c609f9d30c96fc7
|