Python client for Lelu — the confidence-aware authorization engine for autonomous AI agents.
Author: Abenezer Getachew
Maintainer: Abenezer Getachew
pip install lelu-agent-auth-sdkRun the local engine once — it self-generates its key and policy in ~/.lelu,
no account needed:
npx -y lelu-mcp startThen 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 — agent pauses, awaiting approval
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(...).
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.
| Method | Description |
|---|---|
agent_authorize(req) |
Confidence-aware agent authorization |
authorize(req) |
Human RBAC authorization |
mint_token(req) |
Mint a JIT-scoped JWT |
revoke_token(token_id) |
Revoke a token immediately |
is_healthy() |
Health-check the engine |
MIT