Skip to content

Agent Approval Protocol v1

Defines how AI agents request permission for sensitive actions and how users grant or deny them securely.

Design principles:

  • Server-side truth: approval stored server-side, client gets opaque request ID
  • Action binding: exact action/payload hashed at creation, verified at execution
  • Single-use, short-lived
  • Defense in depth
ToolDescription
request_approvalCreate an approval request (actions, risk level, Standard/Strong)
get_approval_cardApproval card data for a request
check_approval_statusPoll the decision status (pending / approved / rejected / expired)
create_trusted_session30-min trusted session after a Strong approval

The decision itself is not a tool call: the user approves or denies on the approval card or at auth.anuka.pro/approve/<token>, and the decision is recorded server-side from the user’s own session. Agents learn the outcome via check_approval_status.

action_hash = SHA-256(canonical_json(actions)) at creation. Server validates selected_action_ids ⊆ actions[].id. Re-verified at execution.

consumed_at set on first decision. Subsequent attempts → “Already consumed”.

Risk-based TTL: critical 15m, high 1h, medium 4h, low 24h.

Token is single-use opaque (128-bit). token_hash stored, raw token never persisted.

Only pending → approved/rejected transitions. Atomic status update.

Approval bound to user_id + project_id at creation. Execution context must match.

Max 5 attempts per approval → auto-lock. Rate limit: 10 pending per user.

Auto-escalate to Strong Approval when:

  • Unusual hour (0–5 AM)
  • Burst activity (5+ approvals/hour)
  • High or critical risk level

Each decision generates HMAC-signed receipt: base64(payload).hex(signature). Provides cryptographic proof of who approved what and when.

Critical approvals require 10-minute delay after approval before execution. Protects against accidental clicks.

ThreatMitigation
Token theftShort TTL, single-use, HTTPS only
Code brute-force5 attempts → lock
Payload substitutionaction_hash verification
Replayconsumed_at, single-use token
Race conditionAtomic transitions
Confused deputyuser_id + project_id binding
DB direct writeRLS, edge-function-only