Skip to main content

supervisor-client

Python client for runtime-supervisor. Signs HS256 JWTs, handles auth headers, typed responses.

Install

pip install supervisor-client  # once published
# for local development:
uv pip install -e packages/supervisor-client-py

Register an integration (one-time, admin)

curl -s -X POST https://supervisor.example.com/v1/integrations \
  -H "X-Admin-Token: $ADMIN_BOOTSTRAP_TOKEN" \
  -H "content-type: application/json" \
  -d '{"name":"acme-refund-agent","scopes":["refund"]}'
# -> {"id": "...", "shared_secret": "kX...", ...}   (secret shown once)

Use from an agent

from supervisor_client import Client, SupervisorError

with Client(
    base_url="https://supervisor.example.com",
    app_id="acme-refund-agent",
    shared_secret=os.environ["SUPERVISOR_SECRET"],
    scopes=["refund"],
) as sup:
    try:
        decision = sup.evaluate("refund", {
            "amount": 420, "currency": "USD",
            "customer_id": "c_1234", "customer_age_days": 18,
            "refund_velocity_24h": 2, "reason": "changed_mind",
        })
    except SupervisorError as e:
        # network or validation failure: fail-closed
        raise

    if decision.allowed:
        execute_refund(...)
    elif decision.blocked:
        notify_user("refund policy blocked this request")
    else:  # needs_review
        enqueue_for_human_review(decision.action_id)

Dry-run ("what would the supervisor do?")

decision = sup.evaluate("refund", payload, dry_run=True)
# no row written to the supervisor; decision.action_id == "dry-run"

Metadata

Release files for supervisor-client 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for supervisor-client 0.3.0
File Size Uploaded
supervisor_client-0.3.0.tar.gz 9.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for supervisor-client 0.3.0
File Interpreter ABI Platform
supervisor_client-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 18.3 kB

Release files / supervisor_client-0.3.0.tar.gz

Download URL supervisor_client-0.3.0.tar.gz
Size 9.2 kB
Tags Source
SHA-256 checksum
How to use checksums
8270867a51d8a92b709055529aaf5f8b7f5951428032b903255383e64ce28eb2
BLAKE2b-256 checksum
How to use checksums
6a6b67e16fdb7bb32cb10263643375fa1765a25339f31c4cf49f8d5c37b90e30
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release files / supervisor_client-0.3.0-py3-none-any.whl

Download URL supervisor_client-0.3.0-py3-none-any.whl
Size 9.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
784ec16fd368ff07125fa6058ba5840b3e8be2606ad270222c92561066a5fe90
BLAKE2b-256 checksum
How to use checksums
7d883460fb180944352d5d561763d6e0823aab9f518354c7e73f154a3062d0a5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page