Skip to main content

Python SDK for AuthLoop — human-in-the-loop authentication for AI agents.

Project description

authloop

Python SDK for AuthLoop — human-in-the-loop authentication for AI agents.

When your browser agent (Playwright, Stagehand, Browser Use, OpenClaw, any CDP runtime) hits an auth wall it cannot solve — an SMS OTP, a behavioral CAPTCHA, a password prompt, a security question, an ID upload — the agent stops. AuthLoop replaces that stop with a 30-second handoff: the agent calls to_human(), the live tab streams to the user's phone, the user resolves the wall directly, and the agent continues. Credentials never touch our servers.

Install

pip install authloop

Usage

from authloop import AuthLoop

authloop = AuthLoop(api_key="al_live_...")

# When your agent hits an auth wall:
session = await authloop.to_human(
    service="HDFC NetBanking",
    cdp_url="ws://localhost:9222",
    context={"wall_type": "sms_otp", "hint": "OTP sent to ****1234"},
)

# Send session.session_url to the human (Telegram, Slack, etc.)
# Wait for the human to resolve it:
result = await authloop.wait_for_resolution(session.session_id)
# result.status == "RESOLVED" → agent continues

API

AuthLoop(api_key, base_url=None, runtime="other")

Parameter Type Required Description
api_key str yes API key from authloop.ai/dashboard
base_url str no Override API base URL (default: https://api.authloop.ai)
runtime Runtime no Runtime hint reported on every audit event. One of: "playwright", "stagehand", "browser-use", "mcp", "openclaw", "other". Default "other".

await authloop.to_human(...)

Creates a session and loops the auth to a human. Returns a ToHumanResult with session_id, session_url, stream_token, stream_url, expires_at.

Parameter Type Required Description
service str yes Human-readable service name shown on the session page (e.g. "HDFC NetBanking")
cdp_url str yes CDP endpoint — HTTP or WebSocket URL
ttl int no Session timeout in seconds (default 600)
context dict no {"url": ..., "wall_type": ..., "hint": ...}

wall_type is one of: "sms_otp", "email_otp", "totp", "password", "image_captcha", "behavioral_captcha", "security_question", "document_upload", "other".

await authloop.get_session(session_id)

Returns current session status: PENDING, ACTIVE, RESOLVED, TIMEOUT, ERROR, or CANCELLED.

await authloop.resolve_session(session_id)

Marks a session as resolved.

await authloop.cancel_session(session_id)

Cancels a session.

await authloop.wait_for_resolution(session_id, poll_interval=3.0, timeout=600.0)

Polls until the session reaches a terminal state. Returns the final SessionStatus.

Webhooks

AuthLoop fires a session.created webhook the moment you call to_human() so you can wake up 2am jobs, page on-call, or post to chat. Configure endpoints, view delivery logs, and grab the verify snippet from your dashboard → Webhooks.

Get an API Key

Sign up at authloop.ai — 50 free auth assists, no credit card required.

License

MIT

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

authloop-0.1.0.tar.gz (8.5 kB view details)

Uploaded Source

Built Distribution

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

authloop-0.1.0-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for authloop-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a4a6c16e1ecef14c2940a04d9c7d31d1958bb74afc8b39e95fab356d81705421
MD5 5c6f0fe0ef7092b552e1e92f563f3ad8
BLAKE2b-256 37a9fc8dd175b73e7a379518c679082faa9638392be7962c94a7da19ec988c52

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for authloop-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b8ae1525a35ba71927498a234ab365f33b3ceeb342d1654c96b44ac35c44dde2
MD5 dee91f40f65d460b5034a24e69b5a816
BLAKE2b-256 115b02f5bf6dd8285c542f944dc7066166fc4a310709f1fdf2daf3d1a5625721

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