Overview
The Approvals API enables human oversight of AI agent actions. When an agent attempts a sensitive operation, it creates an approval request that humans review via the web console or API before the action executes.
Core workflow
- SDK creates request: Agent calls
@guarded_action with requires_human_approval=True
- Request submitted: SDK posts to
/api/v1/approvals
- Human reviews: Approver sees request in web console or via API
- Decision made: Approve, reject, or request more info
- SDK polls: Agent receives decision via polling endpoint
- Action executes: If approved, action proceeds; if rejected, raises error
Endpoints
Create approval request (SDK)
Request body:
Response:
List approval requests
Query parameters:
status (optional): Filter by status
pending, approved, rejected, expired, cancelled, info_requested
priority (optional): Filter by priority
critical, high, medium, low
risk_level (optional): Filter by risk level
critical, high, medium, low, minimal
agent_id (optional): Filter by agent
include_expired (optional): Include expired approvals (default: false)
skip (optional): Pagination offset
limit (optional): Page size (max: 1000)
Example:
Get pending approvals
Convenience endpoint for pending approvals only:
Response:
Get approval details
Returns full approval details including decision history.
Approve action
Request body:
Response:
Reject action
Request body:
Request body:
Status changes to info_requested. SDK must respond with additional context.
Respond to info request (SDK)
Request body:
Status returns to pending for approver to review again.
Poll approval status (SDK)
SDK polls this endpoint to check if decision has been made:
Response:
Cancel approval (SDK)
SDK can cancel pending approvals if circumstances change:
Check if action requires approval
Pre-flight check to determine if an action would require approval:
Request body:
Response:
Health check
Returns 200 when the approval subsystem (ingest, decision broadcast, escalation) is healthy. Use as an uptime probe.
Approval statistics
Returns aggregate approval metrics:
Priority levels
Risk levels
Approval statuses
Timeout behavior
When an approval expires:
- Status changes to
expired
- SDK receives
TimeoutError
- Action is not executed
- Intervention is created with type
APPROVAL_REQUIRED, outcome BLOCKED
Real-time updates
Approvals support WebSocket real-time updates:
Web console workflow
Approvers use the web console to:
- Navigate to Approvals page
- See pending approvals with expiration countdown
- Click “Review” to see full details:
- Action description and context
- Risk and priority levels
- Estimated cost
- Input parameters
- Agent information
- Take action:
- Approve with optional notes
- Reject with reason
- Request Info to ask agent for more context
- View decision history in “Decision History” tab
Best practices
Set appropriate timeouts: Critical actions should have short timeouts (5-10 min), routine actions can have longer timeouts (1-24 hours).
Use priority and risk levels: Help approvers triage - critical/high priority items should notify immediately (email, Slack, etc.).
Provide detailed descriptions: Include enough context so approvers can make informed decisions without requesting more info.
Handle expired approvals: SDKs must handle TimeoutError gracefully - don’t assume approvals will be granted within timeout.
Monitor approval rates: Low approval rates (< 70%) may indicate agents attempting inappropriate actions - review agent logic.
Example: Full workflow
See also