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.1.0.tar.gz (9.0 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.1.0-py3-none-any.whl (14.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: the_handover-0.1.0.tar.gz
  • Upload date:
  • Size: 9.0 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.1.0.tar.gz
Algorithm Hash digest
SHA256 9f57e5ea44b29d5018503f182d9a966c78a96dd267855c53e6644d577afb03df
MD5 976f3f195af60a5780f21ffdeebfc961
BLAKE2b-256 851e118c16df7b11ffa2fbddc94f2cad6fe6e4f24ac6cd8c7086d40ec3bed72b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: the_handover-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 14.1 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.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c1305e21fdba24b75ed03767c3a8d4febd36d38fdce1b22b59ef09421c967d1a
MD5 b1a115b5a05880a3ff293da912ce3517
BLAKE2b-256 9ddb7128e8eaac3bec9f4c6c8ae237efd8a6ee1290e955d9c24b67f4c76d46f5

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