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.3.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.3.0-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: openleash_sdk-0.3.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.3.0.tar.gz
Algorithm Hash digest
SHA256 ef8ca08dc8b5f9083339677fa4476910f581b26f6021776d5164227270b1614d
MD5 f15a31a49191be586c9c0006cce1958c
BLAKE2b-256 ddfa08ef43d296c76cf454bcc386a46979509137cb1dd5467a891ce95477f4ee

See more details on using hashes here.

Provenance

The following attestation bundles were made for openleash_sdk-0.3.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.3.0-py3-none-any.whl.

File metadata

  • Download URL: openleash_sdk-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 6.5 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.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 abaa6c0aa8898ed28df312e08d55eb6f18f8efdff38c679cfb3d5053029e7241
MD5 4d3c328aaa14710b1322c6fd52d639b0
BLAKE2b-256 4d904b1701ed306081c5b3cc07f94d3ac832bba3f54ec83e0fc795aac49ea7ef

See more details on using hashes here.

Provenance

The following attestation bundles were made for openleash_sdk-0.3.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