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.3.0.tar.gz
(15.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.3.0.tar.gz.
File metadata
- Download URL: the_handover-0.3.0.tar.gz
- Upload date:
- Size: 15.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 |
e83c9db2a4dbaf97875ef0ae96cba841c74183add812ff0093c69d8b6e148eda
|
|
| MD5 |
bb3cff678e41864ee5aff8401dcd42a1
|
|
| BLAKE2b-256 |
614acd0114a57a127214bbc0fab3c153f8e69f887f04d5012de8b3441399fd21
|
File details
Details for the file the_handover-0.3.0-py3-none-any.whl.
File metadata
- Download URL: the_handover-0.3.0-py3-none-any.whl
- Upload date:
- Size: 21.7 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 |
62d99a51c5f1ef917e99a8fcf27263320a44b7c427a53a72146438221b92dc98
|
|
| MD5 |
6205a478e9a1d55a0e3b3d0983b6fda9
|
|
| BLAKE2b-256 |
c247e627fff68ae4ff902b92e40904c8e17cc38838051786f41a69951365b322
|