4.2 KiB
Scribase approval gate demo
A coding agent's token sends DROP TABLE to a production database. Scribase does not run it:
$ POST https://api.scribase.com/v1/organizations/<org>/projects/approver-proof/environments/production/database/execute
{"query": "drop table public.proof_widgets;", "confirm": true}
-> 202
{
"status": "approval_required",
"approval_id": "apr_4cef275e9dc2c3e7d6b9cb91",
"state": "pending",
"approver": "<the named approver's email>",
"next": "Not run. `production` is production and this token is not an admin, so <approver> was emailed and has to approve. ..."
}
The project's named approver gets an email with an Approve link. Until that person approves, the table is still there. After they approve, the stored request runs once, exactly as it was sent, and the agent reads the result from the approval's status URL.
This repo is that flow as one script against the live hosted API, plus the raw transcript and a 37 second video of a real run.
Run it
git clone https://rithub.dev/caelum0x/approval-gate-demo.git
cd approval-gate-demo
python3 gate_demo.py
Python 3.9+, standard library only. No account, no API key, nothing to install. It takes about 45 seconds.
The script creates a throwaway mail.tm inbox, signs up to Scribase with it, and deletes the account when it finishes. Every call goes to console.scribase.com and api.scribase.com; nothing is mocked. Pass --keep to skip the deletion and look at the project in the console.
What you will see
| Step | Call | Real response |
|---|---|---|
| 1 | Sign up with the throwaway inbox, verify by magic link | 200 |
| 2 | Create an org, a project and a production environment | ready in about 30 s |
| 3 | Name the inbox as the project's production approver | 200, "notified": true |
| 4 | Mint an agent token: project write, SQL read and write, no admin | 201 |
| 5a | Agent token: CREATE TABLE with row level security |
200 committed |
| 5b | Agent token: DROP TABLE, no confirm |
200 confirmation_required, nothing runs |
| 5c | Agent token: same DROP TABLE, confirm: true |
202 approval_required, nothing runs |
| 5d | Read query: is the table still there? | "still_there": true |
| 6 | The approval email arrives, with the same approval_id |
|
| 7 | Approve (the call the Approve link in the email makes) | 200, "state": "executed" |
| 8 | Agent polls the approval's status URL; read query again | "still_there": false |
| 9 | Revoke the agent token, call again with it | 401 |
| 10 | Delete the account | 202 |
The script exits non-zero with CRITICAL FINDING if the gate ever answers anything else at steps 5c to 9.
Files
gate_demo.py: the whole walkthrough, about 400 lines, readable top to bottom.transcript.txt: raw output of the run on 2026-11-30 (44.0 s end to end). The agent token secret is cut; everything else is the unedited server output.video/approval-proof-1920x1080.mp4,video/approval-proof-1080x1920.mp4: the same run as a terminal video, landscape and vertical. The lines on screen are taken fromtranscript.txt; the blue captions are the only added text.
What the gate is
- A project has one named production approver, a person with an email address.
- An agent token without
project:<id>:admincan read and write, but a destructive change on a production environment is held with202 approval_required. - The approver decides from the email link. On approve, Scribase runs the stored request as sent. The agent does not resend it.
- Tokens are scoped, expire, and can be revoked at any time.
- Tables need row level security: a
CREATE TABLEwithout it is rejected by the SQL lint.
Docs: docs.scribase.com/docs/agents/prod-approver
About Scribase
Scribase is the control plane between coding agents and production: hosted Postgres, auth, storage and email that an agent can provision and operate, with a named person approving what touches production.
Usage, as of 2026-11-30: 8 signups and 0 paying customers. It is early. If you run agents against a production database and want this gate in front of it, write to arhan@scribase.com.