When an agent is about to execute a sensitive tool (shell commands, deployments, payments, file deletions), PraisonAIUI pauses the run and asks a human to Approve or Deny — inline inside the chat thread and in the built-in Approvals page (builtin.approvals).
builtin.approvals
1. The agent runtime or backend submits an approval request (POST /api/approvals).
POST /api/approvals
2. Connected browsers receive it live over SSE (GET /api/approvals/stream) and show an inline approval card in chat plus an entry on the Approvals page.
GET /api/approvals/stream
3. Pair with aiui.push_notification(..., action={"label": "Review now", "page": "approvals"}) so operators also get an immediate toast + unread badge in the header Notification Bell on the same dashboard.
aiui.push_notification(..., action={"label": "Review now", "page": "approvals"})
4. A reviewer clicks Approve (POST /api/approvals/{id}/approve) or Deny (POST /api/approvals/{id}/deny), optionally updating reusable policy rules (PUT /api/approvals/policies).
POST /api/approvals/{id}/approve
POST /api/approvals/{id}/deny
PUT /api/approvals/policies
5. The agent resumes or aborts cleanly, and the decision is recorded in GET /api/approvals/history.
GET /api/approvals/history
<ComponentPreview title="Human-in-the-Loop Approval Queue (click Approve or Deny)">
[
{
"type": "stat_group",
"stats": [
{"type": "metric", "label": "Pending Approvals", "value": "1"},
{"type": "metric", "label": "Approved Today", "value": "14", "delta": "+3"},
{"type": "metric", "label": "Denied", "value": "2"}
]
},
"type": "callout",
"variant": "warning",
"title": "Action Required — deploy_release (High Risk)",
"content": "release-agent paused before deploying v0.4.0 to production. A matching alert was pushed to the header Notification Bell."
release-agent
"type": "diff_viewer",
"title": "Proposed Production Change",
"before_label": "Current",
"after_label": "Proposed",
"before": "release: v0.3.183\nreplicas: 2\napproval_gate: strict",
"after": "release: v0.4.0\nreplicas: 4\napproval_gate: strict"
"type": "button_group",
"buttons": [
{"label": "Approve & Resume Agent", "action": "approve_release", "variant": "primary"},
{"label": "Deny & Halt", "action": "deny_release", "variant": "destructive"}
}
</ComponentPreview>
Run the complete combined Python + YAML example locally (no API key needed):
See 34-hitl-approvals-and-notifications and Notification Center.
All routes sit behind the server's active auth middleware (R8).
| Method & Path | Purpose |
|---|---|
| GET /api/approvals | List all approvals (or GET /api/approvals/pending for open items) |
GET /api/approvals
GET /api/approvals/pending
| POST /api/approvals | Create a new approval request |
| POST /api/approvals/{approval_id}/approve | Approve a pending request |
POST /api/approvals/{approval_id}/approve
| POST /api/approvals/{approval_id}/deny | Deny a pending request |
POST /api/approvals/{approval_id}/deny
| GET /api/approvals/history | Audit log of past decisions |
| GET / PUT /api/approvals/policies | Inspect or update automatic approval policies |
GET
| GET /api/approvals/stream | Real-time SSE stream of approval events |
Approvals are enabled by default in the app shell. To hide the built-in Approvals page and disable its routes: