Reviewers
Point VariantGate at a service of your own, and it is asked about each new request before any rule may approve it. It can say pass or hold the request for a person, never approve or deny, and a reviewer that fails holds too.
A reviewer is a small service you run yourself. VariantGate sends it each new request before any rule may approve it, and waits a few seconds for its answer. It can say pass, and your rules decide as they would have without it. Or it can hold the request, and a person decides, with the reviewer’s reason in front of them.
That is all a reviewer can do. It never approves a request and never denies one. A request a rule denies stays denied, and one that was going to wait for a person waits either way. So you can put any check you like in a reviewer, your own fraud model or a language model with your own key, and the worst a bad answer can do is send a request to a person who would otherwise not have seen it.

Set one up
Owners set the reviewer up in the app under Settings, or over the API. A workspace has one reviewer, on the Pro plan and higher, like signed webhooks. You choose:
- url
- where to send each request: an https address on a public host name, standard port, no user name or password. Needed the first time; a new one makes a new signing secret
- label
- what it is, for people: 1 to 100 characters
- actions
- 1 to 20 patterns it looks at, such as refund.* or email.send; * is every action, and the default
- fail_closed
- whether a request is held when the reviewer cannot be reached, answers late or answers something that is not a verdict. Defaults to true
- timeout_ms
- how long it has to answer, 500 to 5,000 milliseconds. Defaults to 3,000
- enabled
- while false, nothing is sent to it
curl -X PUT https://api.variantgate.com/v1/workspaces/$WORKSPACE_ID/reviewer \
-H "Authorization: Bearer YOUR_SESSION_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"url": "https://review.northwind.example/variantgate",
"label": "Payments risk check",
"actions": ["payment.*", "refund.*", "email.send"],
"fail_closed": true,
"timeout_ms": 3000
}'The answer carries the signing secret, once. Keep it with your reviewer; it cannot be read again, only replaced by sending a new url. Sent without a url, the same call changes the other settings and keeps the address and secret.
{
"reviewer": {
"label": "Payments risk check",
"host": "review.northwind.example",
"actions": ["payment.*", "refund.*", "email.send"],
"fail_closed": true,
"timeout_ms": 3000,
"enabled": true,
"created_by": "maya@northwind.example",
"created_at": "2026-11-28T09:12:00Z",
"updated_at": "2026-11-28T09:12:00Z"
},
"secret": "whsec_MfKQ9r8GKYqrTwjUPD8ILPZIo2LaLaSw"
}Every member can see the reviewer, by its label and host. Its URL is never shown again, since a URL can hold your own tokens. Only owners can change, test or remove it, and an agent key can do none of this. Setting and removing it go in the activity log, without the address.
# See it (every member may; the URL and secret are never shown)
curl https://api.variantgate.com/v1/workspaces/$WORKSPACE_ID/reviewer \
-H "Authorization: Bearer YOUR_SESSION_TOKEN"
# Send it a made-up request and see what it answers. Nothing is stored.
curl -X POST https://api.variantgate.com/v1/workspaces/$WORKSPACE_ID/reviewer/test \
-H "Authorization: Bearer YOUR_SESSION_TOKEN"
# Remove it
curl -X DELETE https://api.variantgate.com/v1/workspaces/$WORKSPACE_ID/reviewer \
-H "Authorization: Bearer YOUR_SESSION_TOKEN"What your reviewer gets
A POST with the request as the agent sent it, signed exactly like a webhook, following the Standard Webhooks spec: the webhook-id starts with rev_, and the signature is HMAC-SHA256 over {id}.{timestamp}.{body}. The details go to your reviewer in full, so point it only at a service of your own. A test from Settings or the test call has the type review.test and the action test.review. Your reviewer is asked before the request is stored, so now and then it sees one that is then refused, such as a request in a run a person just stopped, or one past the month’s cap. Don’t act on a review; only answer it.
POST /variantgate HTTP/1.1
Host: review.northwind.example
Content-Type: application/json
User-Agent: VariantGate-Reviewer/1
webhook-id: rev_0196f8a1c2d37e4f9a0b1c2d3e4f5a6b
webhook-timestamp: 1795857120
webhook-signature: v1,g0hM9SsE+OTPJTGt/tmIKtSyZlE3uFJELVlNIOLJ1OE=
{
"id": "rev_0196f8a1c2d37e4f9a0b1c2d3e4f5a6b",
"type": "review.requested",
"timestamp": "2026-11-28T09:12:00Z",
"workspace_id": "0196f3c2-5a1b-7d2e-9f3a-4b5c6d7e8f90",
"data": {
"agent": "billing-agent",
"agent_key_id": "0196f3c2-6b2c-7e3f-8a4b-5c6d7e8f9012",
"action": "payment.send",
"summary": "Pay Lindqvist Freight invoice 2291",
"amount": "4180.00",
"currency": "EUR",
"details": { "iban": "GB33BUKB20201555555555", "invoice": "2291" },
"sources": [],
"preview": null,
"run": "invoice-run-1128"
}
}What it answers
A 2xx status with a JSON object whose verdict is a string, within the timeout:
{ "verdict": "pass" }
{ "verdict": "hold", "reason": "Pays an IBAN we have never paid: GB33BUKB20201555555555" }- Only
pass, exactly, lets the rules decide. Every other verdict holds the request, includingallow,approveandPass: a typo never makes anything less careful. - The
reasonis optional. At most 300 characters are kept, with hidden characters left out and runs of white space made one space. - Any other status, a body that is not such an object, more than 16 KB, a redirect, or no answer in time is a failure. A failure holds the request unless you set
fail_closedto false; then the rules decide as if there were no reviewer.
What people and agents see
People in the workspace see what the reviewer said on the request in the inbox and the record:
"reviewer": {
"outcome": "held",
"reason": "Pays an IBAN we have never paid: GB33BUKB20201555555555",
"fail_closed": true,
"ms": 84
}A reviewer that did not answer in time shows up like this:
"reviewer": {
"outcome": "failed",
"error": "timeout",
"fail_closed": true,
"ms": 3001
}The agent is never told what the reviewer said, or that there is one. It sees a request that waits for a person, so it cannot learn how to word its way past your checks. Every way an agent asks goes through the reviewer: the REST API, the MCP server, the coding-agent hooks and mcp-proxy.
Two reviewers to start from
The same three checks in Node and in Python, with nothing but each language’s standard library: hold a payment to an IBAN you have never paid, a refund over 500, and an email to anyone outside your own domains. Each checks the signature and the timestamp first, and answers 401 to anything else. We ran both against signed test messages for each case.
Node
// reviewer.mjs: node reviewer.mjs (Node 18 or later, no packages)
import { createHmac, timingSafeEqual } from "node:crypto";
import { createServer } from "node:http";
const secret = process.env.VARIANTGATE_REVIEWER_SECRET; // whsec_…
const OUR_DOMAINS = ["northwind.example"];
const KNOWN_IBANS = new Set(["DE89370400440532013000"]);
/** The message, if VariantGate signed it in the last five minutes. */
function verified(headers, rawBody) {
const id = headers["webhook-id"];
const timestamp = headers["webhook-timestamp"];
const signatures = headers["webhook-signature"];
if (!id || !timestamp || !signatures) return null;
if (Math.abs(Date.now() / 1000 - Number(timestamp)) > 5 * 60) return null;
const key = Buffer.from(secret.slice("whsec_".length), "base64");
const expected = createHmac("sha256", key)
.update(`${id}.${timestamp}.${rawBody}`)
.digest();
const matches = signatures.split(" ").some((entry) => {
const [version, signature = ""] = entry.split(",");
const given = Buffer.from(signature, "base64");
return version === "v1" && given.length === expected.length && timingSafeEqual(given, expected);
});
return matches ? JSON.parse(rawBody) : null;
}
/** Your checks. Only "pass" lets your rules decide; "hold" asks a person. */
function review({ action, amount, details }) {
if (action.startsWith("payment.") && details.iban && !KNOWN_IBANS.has(details.iban)) {
return { verdict: "hold", reason: `Pays an IBAN we have never paid: ${details.iban}` };
}
if (action.startsWith("refund.") && Number(amount) > 500) {
return { verdict: "hold", reason: `Refund of ${amount} is over our 500 line` };
}
const recipients = [details.to, details.cc, details.bcc].flat().filter(Boolean);
const outside = recipients.filter(
(address) => !OUR_DOMAINS.includes(String(address).split("@").pop().toLowerCase()),
);
if (action === "email.send" && outside.length > 0) {
return { verdict: "hold", reason: `Goes outside our domains: ${outside.join(", ")}` };
}
return { verdict: "pass" };
}
createServer((request, response) => {
let rawBody = "";
request.setEncoding("utf8");
request.on("data", (chunk) => (rawBody += chunk));
request.on("end", () => {
const message = verified(request.headers, rawBody);
if (!message) {
// Not from VariantGate. VariantGate itself would count this as a failure.
response.writeHead(401).end();
return;
}
const answer = review(message.data);
response.writeHead(200, { "content-type": "application/json" });
response.end(JSON.stringify(answer));
});
}).listen(8787);Python
# reviewer.py: python3 reviewer.py (Python 3.9 or later, no packages)
import base64
import hashlib
import hmac
import json
import os
import time
from http.server import BaseHTTPRequestHandler, HTTPServer
SECRET = os.environ["VARIANTGATE_REVIEWER_SECRET"] # whsec_…
OUR_DOMAINS = {"northwind.example"}
KNOWN_IBANS = {"DE89370400440532013000"}
def verified(headers, raw_body: bytes):
"""The message, if VariantGate signed it in the last five minutes."""
msg_id = headers.get("webhook-id")
timestamp = headers.get("webhook-timestamp")
signatures = headers.get("webhook-signature")
if not (msg_id and timestamp and signatures):
return None
if abs(time.time() - int(timestamp)) > 5 * 60:
return None
key = base64.b64decode(SECRET.removeprefix("whsec_"))
signed = f"{msg_id}.{timestamp}.".encode() + raw_body
expected = base64.b64encode(hmac.new(key, signed, hashlib.sha256).digest())
for entry in signatures.split():
version, _, signature = entry.partition(",")
if version == "v1" and hmac.compare_digest(signature.encode(), expected):
return json.loads(raw_body)
return None
def review(data: dict) -> dict:
"""Your checks. Only "pass" lets your rules decide; "hold" asks a person."""
action, amount, details = data["action"], data["amount"], data["details"]
iban = details.get("iban")
if action.startswith("payment.") and iban and iban not in KNOWN_IBANS:
return {"verdict": "hold", "reason": f"Pays an IBAN we have never paid: {iban}"}
if action.startswith("refund.") and amount and float(amount) > 500:
return {"verdict": "hold", "reason": f"Refund of {amount} is over our 500 line"}
recipients = []
for field in ("to", "cc", "bcc"):
value = details.get(field) or []
recipients += value if isinstance(value, list) else [value]
outside = [a for a in recipients if str(a).rsplit("@", 1)[-1].lower() not in OUR_DOMAINS]
if action == "email.send" and outside:
return {"verdict": "hold", "reason": "Goes outside our domains: " + ", ".join(str(a) for a in outside)}
return {"verdict": "pass"}
class Reviewer(BaseHTTPRequestHandler):
def do_POST(self):
raw_body = self.rfile.read(int(self.headers.get("content-length", 0)))
message = verified(self.headers, raw_body)
if message is None:
# Not from VariantGate. VariantGate itself would count this as a failure.
self.send_response(401)
self.end_headers()
return
answer = json.dumps(review(message["data"])).encode()
self.send_response(200)
self.send_header("content-type", "application/json")
self.send_header("content-length", str(len(answer)))
self.end_headers()
self.wfile.write(answer)
HTTPServer(("", 8787), Reviewer).serve_forever()To bring your own model, call it inside review with your own key and turn its answer into pass or hold. Keep its prompt away from the idea that it approves anything: it only decides whether a person should look. Stay inside the timeout, or the request is held as a failure.
Limits
- The agent waits for the reviewer on every request it covers, up to the timeout. Narrow
actionsto what needs a second look. - Only https addresses on a public host name are taken, never an IP address. Every address the name leads to must be public when the request is sent, and no redirect is followed.
- A reviewer sees requests as they arrive. It is not asked again when a person decides, and it cannot change a request.
- The rule tester does not call it.