Skip to main content

Python SDK for proposing AI-driven actions to a HumanLatch control plane.

Project description

HumanLatch Python SDK

Python SDK for sending AI-driven capability proposals to a HumanLatch control plane.

Use this SDK when your agent, service, robot controller, or automation needs to ask:

  • Can I run this action automatically?
  • Do I need a human approval first?
  • Is this blocked by policy?

The SDK works against either:

  • self-hosted HumanLatch CE
  • a remotely hosted HumanLatch API

Install

pip install humanlatch

Create a Client

from humanlatch import HumanLatchClient

client = HumanLatchClient(
    base_url="https://your-humanlatch.example.com",
    workspace_id="your-workspace-id",
    api_key="hl_your_key_here",
)

Use token for user-authenticated flows or api_key for agent/service integrations.

Core Flow

from humanlatch import HumanLatchClient

client = HumanLatchClient(
    base_url="https://your-humanlatch.example.com",
    workspace_id="your-workspace-id",
    api_key="hl_your_key_here",
)

result = client.propose_action(
    action_type="support.refund.issue",
    target="order-10428",
    summary="Issue a refund above the autonomous threshold",
    payload={
        "amount": 850,
        "currency": "USD",
        "customer_id": "cust_2041",
    },
    context={
        "environment": "production",
        "requested_by": "agent:support-bot",
        "domain": "chatbot",
    },
)

if client.is_approved(result):
    issue_refund()
elif client.requires_approval(result):
    final = client.wait_for_decision(result["id"], interval_seconds=2.0, timeout_seconds=30.0)
    if client.is_approved(final):
        issue_refund()
else:
    raise RuntimeError(f"Blocked by HumanLatch policy: {result['status']}")

Additional Methods

client.list_actions(status="pending_approval", limit=50)
client.get_action("action-id")
client.approve_action("action-id", note="Approved by supervisor")
client.reject_action("action-id", note="Unsafe during shift handoff")
client.cancel_action("action-id")

Integration Model

Before your system performs a sensitive capability, it asks HumanLatch for a decision:

  • approved_auto: execute now
  • pending_approval: wait for human approval
  • blocked: do not execute

That same control plane works for:

  • infrastructure agents
  • support bots
  • warehouse robots
  • manufacturing lines
  • internal copilots

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

humanlatch-0.1.0.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

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

humanlatch-0.1.0-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: humanlatch-0.1.0.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for humanlatch-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d2c86d860db1fe89f85a9f739fa317cece5a8e444570e26ba46201ee572e7b85
MD5 e38d7abcd3e16d63276cdadb9c9e4684
BLAKE2b-256 c57b85b73d928ec0f8a562ac0c2c0b9b5f90bd8d08fd89fb8e59fb90efb89ca8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: humanlatch-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for humanlatch-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a0b7857cdb417ad10d66ed56a36d19c33fdce5ea64117a6446c5b5f3ced54cb2
MD5 e3973ef6dc323cbbae386219d09b704b
BLAKE2b-256 536735ed2b8b116af3e430a5513fe51413fdb2bd3e05a0a357a5054ed9453e51

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