Skip to main content

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

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 — 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(...).

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
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

License

MIT

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lelu_agent_auth_sdk-0.4.3.tar.gz (294.6 kB view details)

Uploaded Source

Built Distribution

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

lelu_agent_auth_sdk-0.4.3-py3-none-any.whl (43.3 kB view details)

Uploaded Python 3

File details

Details for the file lelu_agent_auth_sdk-0.4.3.tar.gz.

File metadata

  • Download URL: lelu_agent_auth_sdk-0.4.3.tar.gz
  • Upload date:
  • Size: 294.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for lelu_agent_auth_sdk-0.4.3.tar.gz
Algorithm Hash digest
SHA256 ced0c93e877bc72fa5c69ebe33c8710cdee2d7f21384052b8c276556a65b9b2b
MD5 13cf85468d6b700d4b4eefd309521f6a
BLAKE2b-256 008b4131a2436f8f3cd1ecc353f1dc46586d8359688d9cea933dddb23d723a85

See more details on using hashes here.

File details

Details for the file lelu_agent_auth_sdk-0.4.3-py3-none-any.whl.

File metadata

File hashes

Hashes for lelu_agent_auth_sdk-0.4.3-py3-none-any.whl
Algorithm Hash digest
SHA256 6ec141d5c368db6e2daa42fb83a67cab17ccd792d6f66c4c27f57a4250d14f75
MD5 4b31f74ea4dd4d04490b5d20685e8ebb
BLAKE2b-256 07e21ab6498cdf97a26ed4a8b315f25c620c4ed8a0c22c71d4baa6cf820714ac

See more details on using hashes here.

Release history Release notifications | RSS feed

0.4.41

2 files

0.4.4

2 files

This release

0.4.3 This release

2 files

0.4.2

2 files

0.4.1

2 files

0.4.0

2 files

0.3.67

2 files

0.3.66

2 files

0.3.65

2 files

0.3.64

2 files

0.3.63

2 files

0.3.62

2 files

0.3.61

2 files

0.3.6

2 files

0.3.5

2 files

0.3.0

2 files

0.2.0

2 files

0.1.9

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page