Skip to main content Switch to mobile version lelu-agent-auth-sdk 0.5.0 Python SDK for Lelu — framework-agnostic authorization engine for AI agents with confidence-aware controls, Docker deployment, and human-in-the-loop workflows
pip install lelu-agent-auth-sdk==0.5.0 Copy PIP instructions
Python client for Lelu — the confidence-aware authorization engine for autonomous AI agents.
Author: Abenezer Getachew Maintainer: Abenezer Getachew
pip install lelu-agent-auth-sdk Requires Python 3.11+.
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.
Engines in their default configuration reject bare self-reported confidence numbers (CONFIDENCE_ALLOW_UNVERIFIED=false). Build a ConfidenceSignal from your LLM provider's response with LeluClient.signal_from (.openai, .bedrock, .local; .anthropic always returns None) so the engine extracts the score from the token/entropy data directly:
from lelu import AgentContext, LeluClient, lelu auth = lelu(actor="invoice_bot") resp = await openai_client.chat.completions.create( model="gpt-4o-mini", messages=messages, logprobs=True, ) signal = LeluClient.signal_from.openai(resp) # None if logprobs are absent result = await auth.authorize( tool="refund:process", context=AgentContext(confidence_signal=signal) if signal else None, ) When signal is None (for example, Anthropic models that expose no token log-probs), omit confidence_signal so the engine's MissingSignalMode decides rather than inventing a default score.
Mounting the approval handler (optional)
auth.handler is an ASGI app that exposes the engine's authorize and review queue to your own frontend. It acts with your engine credentials, so it only serves a caller your app has authenticated: without authenticate= it answers 403 for everything except GET /ok.
import os from lelu import HandlerCaller, lelu async def authenticate(scope): user = scope.get("user") # your session / JWT check if user is None: return None # -> 401 return HandlerCaller(reviewer=user.name if user.is_reviewer else None) auth = lelu( authenticate=authenticate, reviewer_key=os.environ["LELU_REVIEWER_KEY"], # one of the engine's LELU_REVIEWER_KEYS ) app.mount("/api/lelu", auth.handler) # FastAPI / Starlette Any authenticated caller may POST /authorize.
Only a caller with a reviewer name may list the queue, approve or deny. That name is recorded as the resolver; a resolved_by in the request body is ignored.
When the engine sets LELU_REVIEWER_KEYS, approvals need reviewer_key. To approve or deny from your own code, pass it directly: await client.approve_review(review_id, "alice", reviewer_key=...).
Released: Dec 1, 2026
Author: Abenezer Getachew
Maintainer: Abenezer Getachew
dev fastapi langchain langgraph strands
ai-agents audit-trail auth authorization crewai docker fastapi human-in-the-loop langchain langgraph permissions policy-engine risk-evaluation
Release files for lelu-agent-auth-sdk 0.5.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
Built distribution (wheel)
Total release size: 139.6 kB
Release files / lelu_agent_auth_sdk-0.5.0.tar.gz
Release files / lelu_agent_auth_sdk-0.5.0-py3-none-any.whl
Security for lelu-agent-auth-sdk 0.5.0
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.
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.
Release history Release notifications | RSS feed
Dec 1, 2026 2 release files No provenance
Nov 28, 2026 2 release files No provenance
Nov 27, 2026 2 release files No provenance
Nov 12, 2026 2 release files No provenance
Sep 4, 2026 2 release files No provenance
Sep 3, 2026 2 release files No provenance
Aug 1, 2026 2 release files No provenance
Jul 31, 2026 2 release files No provenance
Jul 13, 2026 2 release files No provenance
Jul 12, 2026 2 release files No provenance
Jun 16, 2026 2 release files No provenance
Jun 15, 2026 2 release files No provenance
Jun 4, 2026 2 release files No provenance
Jun 3, 2026 2 release files No provenance
Jun 1, 2026 2 release files No provenance
May 29, 2026 2 release files No provenance
May 27, 2026 2 release files No provenance
Mar 31, 2026 2 release files No provenance
Mar 27, 2026 2 release files No provenance
Mar 24, 2026 2 release files No provenance
Mar 11, 2026 2 release files No provenance
Mar 10, 2026 2 release files No provenance
Mar 7, 2026 2 release files No provenance
"PyPI", "Python Package Index", and the blocks logos are registered trademarks of the Python Software Foundation.
© 2026 Python Software Foundation
Deployed from 1875753











