Approvals

Risky statements from an agent wait for a person: the agent gets 202 pending_approval and polls until it is approved, rejected or expires.

KindTriggered by
UPDATE / DELETE without WHEREdelete from orders, update users set plan = 'free' where true
More rows than the row limitA statement that would change more rows than the key's max rows (it was rolled back)
Destructive schema changesDROP, TRUNCATE, dropping columns or constraints, changing column types
Row Level Security changesDisabling RLS, creating, changing or dropping policies
PrivilegesGRANT / REVOKE, default privileges, SECURITY DEFINER functions
ExtensionsCREATE EXTENSION

#Flow

JSON
HTTP 202
{ "status": "pending_approval", "approval_id": "6d0c…", "reasons": ["unbounded_write"],
  "approve_url": "https://stitchdb.com/dashboard/project/<ref>/agents/approvals/6d0c…",
  "expires_at": "…" }

GET /platform/v1/agent/approvals/6d0c…     # the agent polls (or MCP tool get_approval)
{ "status": "executed", "result": { "rows_changed": 1200, "results": [ … ] } }

The project owner gets an e-mail; organization webhooks receive agent.approval_requested and agent.approval_decided. Owners and administrators approve or reject in Studio → AI agents → Approvals. An approved statement runs once, as the agent, in the agent's session (so it can be undone). Requests expire after 24 hours.