Skip to main content

Python SDK for Lelu — framework-agnostic authorization engine for AI agents with confidence-aware controls, Docker deployment, and human-in-the-loop workflows

Project description

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: Use Hosted Engine (Recommended)

Connect to the hosted Lelu engine for instant setup:

import asyncio
from lelu import LeluClient, AgentAuthRequest, AgentContext

async def main():
    async with LeluClient(base_url="https://lelu-ai.com") as client:
        result = await client.agent_authorize(AgentAuthRequest(
            actor="invoice_bot",
            action="invoice:create",
            context=AgentContext(
                confidence=0.92,
                acting_for="user_123",
            ),
        ))
        print(result.allowed, result.reason)

asyncio.run(main())

Option 2: Run Locally

For development, you can run the engine locally:

import asyncio
from lelu import LeluClient, AgentAuthRequest, AgentContext

async def main():
    async with LeluClient(base_url="http://localhost:8082") as client:
        result = await client.agent_authorize(AgentAuthRequest(
            actor="invoice_bot",
            action="invoice:create",
            context=AgentContext(
                confidence=0.92,
                acting_for="user_123",
            ),
        ))
        print(result.allowed, result.reason)

asyncio.run(main())

Start the local engine with Docker:

docker compose up -d

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

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

lelu_agent_auth_sdk-0.3.63.tar.gz (30.2 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.3.63-py3-none-any.whl (27.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: lelu_agent_auth_sdk-0.3.63.tar.gz
  • Upload date:
  • Size: 30.2 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.3.63.tar.gz
Algorithm Hash digest
SHA256 43c2c2350d6f4c4d048f6b5bd2a83a16d85fe389ba25c76201b54781b5e7c576
MD5 cb7e3fd056e082c75cb9df9d4ef9acbe
BLAKE2b-256 0d311695db520b5b9b352e5968a229e2be95873d2355d9530bbbb75f68c48418

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lelu_agent_auth_sdk-0.3.63-py3-none-any.whl
Algorithm Hash digest
SHA256 ac35ced84b42bdc7a335772c350f723ad57bd925f52f32ac25d65b8b35ab3df6
MD5 45a74ed89483191a26ca16302b0e0c33
BLAKE2b-256 6fba3d83b932fcaed8382ac97c7ada979c5f1d47fa7ef3f70e428c9ba55c5495

See more details on using hashes here.

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