Lelu · Python SDK
Python client for Lelu — the confidence-aware authorization engine for autonomous AI agents.
Author: Abenezer Getachew
Maintainer: Abenezer Getachew
Installation
pip install lelu-agent-auth-sdk
Requires Python 3.11+.
Quick start
Option 1: Zero-config local (recommended)
Run the local engine once — it self-generates its key and policy in ~/.lelu,
no account needed:
npx -y lelu-mcp start
Then create one shared instance and import it everywhere. With no arguments,
lelu() discovers that engine automatically:
import asyncio
from lelu import lelu
auth = lelu(actor="invoice_bot") # zero-config: finds the local engine
async def main():
result = await auth.authorize(tool="invoice:create")
if result.decision == "allow":
... # proceed
elif result.decision == "human_review":
# Queued for a human. Don't just wait for "approved" and then act —
# an approval is bound to the request it approved, so pass the same
# request back and let the engine confirm nothing changed.
outcome = await auth.wait_and_redeem(result, tool="invoice:create")
if not outcome.allowed:
raise PermissionError(outcome.reason)
... # proceed
else:
raise PermissionError(result.reason)
asyncio.run(main())
The instance exposes the full client as auth.api (tokens, review queue,
audit, policies): await auth.api.mint_token(...).
Option 2: Self-hosted or cloud engine
Point the same factory at any engine with explicit config — or set
LELU_BASE_URL / LELU_API_KEY and keep calling lelu() with no arguments:
auth = lelu(
base_url="https://your-engine.example.com",
api_key=os.environ["LELU_API_KEY"],
actor="invoice_bot",
)
LeluClient(...) from earlier versions keeps working unchanged — auth.api
is that same client.
API
| Method | Description |
|---|---|
authorize(req) |
Confidence-aware agent authorization (allow / deny / human_review / compute) |
agent_authorize(req) |
Deprecated — backward-compatible wrapper around authorize() |
wait_and_redeem(review, req) |
After human_review: wait for the reviewer, then redeem the approval against the same request (pass the decision or its review_id, not request_id) |
mint_token(req) |
Mint a JIT-scoped JWT |
revoke_token(token_id) |
Revoke a token immediately |
is_healthy() |
Health-check the engine |
License
MIT
Metadata
Release files for lelu-agent-auth-sdk 0.4.42
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| lelu_agent_auth_sdk-0.4.42.tar.gz | 70.6 kB | Without provenance | Details for lelu_agent_auth_sdk-0.4.42.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| lelu_agent_auth_sdk-0.4.42-py3-none-any.whl | Python 3 | none | any | Details for lelu_agent_auth_sdk-0.4.42-py3-none-any.whl |
Total release size: 122.2 kB
Release files / lelu_agent_auth_sdk-0.4.42.tar.gz
| Download URL | lelu_agent_auth_sdk-0.4.42.tar.gz |
|---|---|
| Size | 70.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ec49ce87e62e89732961f26bd9ccee9bc08e7ce2b8fed94db6aa8193daf962b0
|
|
BLAKE2b-256 checksum How to use checksums |
7af85e12d2b77ac5a4bdec888705f3ebfa328b45bc77e44938e506a68f3e5183
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Release files / lelu_agent_auth_sdk-0.4.42-py3-none-any.whl
| Download URL | lelu_agent_auth_sdk-0.4.42-py3-none-any.whl |
|---|---|
| Size | 51.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
857990816caf504b2b5c087cd308878f6ea59975ff2f51303aa9d09285a0005c
|
|
BLAKE2b-256 checksum How to use checksums |
1f8d95eff555a456df1e32fc15522e621bb0daa6405b8f1b27d35cbb3a7fc1b5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Security for lelu-agent-auth-sdk 0.4.42
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.