Core Concepts

Human-in-the-Loop

When an AI agent attempts an action with a confidence score that falls into the "requires approval" range, Lelu automatically pauses the execution and queues the request for human review.

The Approval Workflow

1. Agent Requests Authorization

The AI agent calls the Lelu Engine with its intended action, resource, and confidence score.

2. Policy Evaluation

Lelu evaluates the request against your Rego policies. If the confidence score is too low for automatic approval, the request is flagged as requires_approval.

3. Request Queued

The request is added to the pending queue. The agent receives a response indicating it must wait, along with a requestId.

4. Human Review

A human operator reviews the request in the Lelu UI (or via API) and either approves or denies it.

5. Agent Resumes

The agent polls the status of the request (or receives a webhook). Once approved, it proceeds with the action.

Reviewing Requests in the UI

The Lelu Platform provides a built-in UI for reviewing pending requests. Operators can see the agent's reasoning, the requested action, and the confidence score before making a decision.

Built-in Approval Dashboard

Navigate to the "Policies" or "Queue" section in the Lelu UI to view and manage pending authorization requests.

Handling Approvals via API

You can also build custom approval workflows (e.g., Slack integrations) using the Lelu API.

bash
# Approve a request
curl -X POST http://localhost:8083/v1/queue/req_12345/approve \
  -H "Authorization: Bearer YOUR_API_KEY"

# Deny a request
curl -X POST http://localhost:8083/v1/queue/req_12345/deny \
  -H "Authorization: Bearer YOUR_API_KEY"