Skip to main content

Python SDK for OpenLeash — authorization + proof sidecar for AI agents

Project description

openleash-sdk (Python)

Python SDK for OpenLeash — authorization + proof sidecar for AI agents.

Install

pip install openleash-sdk

Quick start

from openleash import (
    authorize,
    generate_ed25519_keypair,
    sign_request,
    verify_proof_offline,
)

# Generate a keypair for your agent
keypair = generate_ed25519_keypair()
print(keypair["public_key_b64"])

# Authorize an action (async)
result = await authorize(
    openleash_url="http://127.0.0.1:8787",
    agent_id="my-agent",
    private_key_b64=keypair["private_key_b64"],
    action={
        "action_type": "purchase",
        "payload": {"amount_minor": 500, "currency": "USD"},
    },
)

# Verify a proof token offline
verification = verify_proof_offline(
    token=result["proof_token"],
    public_keys=[{"kid": "key-id", "public_key_b64": keypair["public_key_b64"]}],
)

API

Function Async Description
generate_ed25519_keypair() No Generate Ed25519 keypair (DER SPKI/PKCS8, base64)
sign_request(...) No Sign an HTTP request with Ed25519
redeem_agent_invite(...) Yes Register using an invite URL (recommended)
registration_challenge(...) Yes Request a registration challenge
register_agent(...) Yes Register an agent via challenge-response
authorize(...) Yes Send a signed authorization request
verify_proof_online(...) Yes Verify a proof token via the server
verify_proof_offline(...) No Verify a PASETO v4.public token locally

Requirements

  • Python 3.10+
  • Dependencies: cryptography, pyseto, httpx

License

Apache-2.0

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

openleash_sdk-0.2.0.tar.gz (8.1 kB view details)

Uploaded Source

Built Distribution

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

openleash_sdk-0.2.0-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

Details for the file openleash_sdk-0.2.0.tar.gz.

File metadata

  • Download URL: openleash_sdk-0.2.0.tar.gz
  • Upload date:
  • Size: 8.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for openleash_sdk-0.2.0.tar.gz
Algorithm Hash digest
SHA256 aa59d9adb75634215bc1d8a2014f4b8293782bcbf8564eca9925db5ccdb17f08
MD5 894bb86d84949c5f94fe66161627262c
BLAKE2b-256 c2352402d958ae9197a5f021d100f99919ad228bdac3c34319ecdc7d30509dde

See more details on using hashes here.

Provenance

The following attestation bundles were made for openleash_sdk-0.2.0.tar.gz:

Publisher: ci.yml on openleash/openleash

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file openleash_sdk-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: openleash_sdk-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 6.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for openleash_sdk-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b38f6c40aade385ebfdf664f4bb87da31f8c106da841b38775a45d3dafc0afc5
MD5 a1c9d70eb8d5d42d8d1f63f525391dcc
BLAKE2b-256 0f872925eb8be7c8428f7902876f49e21639893129ea292a57fecb8e0b9f8047

See more details on using hashes here.

Provenance

The following attestation bundles were made for openleash_sdk-0.2.0-py3-none-any.whl:

Publisher: ci.yml on openleash/openleash

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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