Skip to main content

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.4.0.tar.gz (16.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

the_handover-0.4.0-py3-none-any.whl (22.4 kB view details)

Uploaded Python 3

File details

Details for the file the_handover-0.4.0.tar.gz.

File metadata

  • Download URL: the_handover-0.4.0.tar.gz
  • Upload date:
  • Size: 16.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for the_handover-0.4.0.tar.gz
Algorithm Hash digest
SHA256 77a9072f868a5c5f32b354971d394a692d3ba25aa8adb3ff516519311880bd84
MD5 a9a29b9ede5f8a6800c15b0e27ba9aec
BLAKE2b-256 840168b2d758bdba86fa55f8174ec2d46fb1b8633dd9db32495ce76913aded9e

See more details on using hashes here.

File details

Details for the file the_handover-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: the_handover-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 22.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for the_handover-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bda13e0890902b0b80e89491e9a9e046be385c26a6753cd71af108f2661aa1f1
MD5 4f8ca3634043d9a699476b377d5087be
BLAKE2b-256 151e983fa69470ce5dcd5f35cd6c68d1dbf949a50f788f384683f3b73642ec81

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page