Risky statements from an agent wait for a person: the agent gets 202 pending_approval and polls until it is approved, rejected or expires.
| Kind | Triggered by |
|---|---|
| UPDATE / DELETE without WHERE | delete from orders, update users set plan = 'free' where true |
| More rows than the row limit | A statement that would change more rows than the key's max rows (it was rolled back) |
| Destructive schema changes | DROP, TRUNCATE, dropping columns or constraints, changing column types |
| Row Level Security changes | Disabling RLS, creating, changing or dropping policies |
| Privileges | GRANT / REVOKE, default privileges, SECURITY DEFINER functions |
| Extensions | CREATE 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.