Skip to main content

Python client for runtime-supervisor — evaluate, review, and audit agent actions.

Project description

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"

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

supervisor_client-0.3.0.tar.gz (9.2 kB view details)

Uploaded Source

Built Distribution

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

supervisor_client-0.3.0-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

Details for the file supervisor_client-0.3.0.tar.gz.

File metadata

  • Download URL: supervisor_client-0.3.0.tar.gz
  • Upload date:
  • Size: 9.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for supervisor_client-0.3.0.tar.gz
Algorithm Hash digest
SHA256 8270867a51d8a92b709055529aaf5f8b7f5951428032b903255383e64ce28eb2
MD5 00b961f02bf985deb1bd0efa202c3261
BLAKE2b-256 6a6b67e16fdb7bb32cb10263643375fa1765a25339f31c4cf49f8d5c37b90e30

See more details on using hashes here.

File details

Details for the file supervisor_client-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for supervisor_client-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 784ec16fd368ff07125fa6058ba5840b3e8be2606ad270222c92561066a5fe90
MD5 b6c40c2d3c8e07e8c1dda5f522d386e1
BLAKE2b-256 7d883460fb180944352d5d561763d6e0823aab9f518354c7e73f154a3062d0a5

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