How Does an AI Agent Check Whether It Should Pay Before It Spends?

ScriptMasterLabs · October 26, 2026

·

It buys a check first. ScriptMasterLabs' Spend Gate — live-tested October 26, 2026 — charges $0.005 USDC on Base for a pre-payment verdict: four independent paths vote pay or reject on the payee and the quoted amount, the votes combine into a coherence score (|Σ w·d| / Σ w, pass at ≥ 0.6 with a pay-side consensus), and a Jev decision model reviews the payment only if the gate passes. In the October 26 proof runs the gate passed a $0.001 USDC call at coherence 1.0 and blocked a $5.00 over-cap call at coherence 1.0 — consensus reject, Jev never fired, zero decision-model spend on the block.

That is the short answer, with the receipts below. Spend Gate is the decision-gated payments pattern (https://scriptmasterlabs.com/decision-gated-payments) pointed at the buyer's side of x402: the rails move money, the gate decides whether this payment should move. The taxonomy argument for the missing decision layer is at https://scriptmasterlabs.com/the-fourth-layer — this page is the operational version, with a live endpoint, a price, and settled proof transactions for both a pass and a block.

The check: four paths vote, one number decides

An agent (or its wallet wrapper) sends the gate a payee and a quoted amount before signing anything. Four paths evaluate the payment independently — path independence is the point: a number computed from paths that copy each other would claim agreement that never happened.

PathWhat it checksHow it votes
provider_trustThe payee, via Provider Trust's verify_providerReal verdicts via the fleet operator lane: verified / provisional → pay (0.8); do_not_trust / unreachable → reject (0.8); insufficient_evidence → honest abstention
payload_safetyThe thing being bought, when a manifest_url names an npm / PyPI / crates package, via ScriptDocs vulnerability check0 vulnerabilities → pay (0.9); CRITICAL / HIGH findings → reject (0.9); a non-package URL abstains, with the reason stated
price_sanityThe quoted amount against a policy capCap-only in v1 and v2 — no historical median exists and none was invented. Caller cap overrides; defaults below. Vote weighted by headroom; over cap → reject
delivery_historyWhether this host's settlement ledger has actually delivered for this payee beforeReads the OmniGate ledger on the same host (67 delivered / 12 failed records at first proof); a payee with no records abstains — the gate's own check history never votes (no self-dealing path)

Default caps (in code and in the product docs): data_lookup / search / content_fetch / verification $0.05, market_data $0.10, inference / llm $0.25, compute $0.50, unlisted category $0.10.

The votes combine as coherence = |Σ w·d| / Σ w, where d = +1 for pay-side, −1 for reject-side, and w is each path's confidence. gate_pass requires coherence ≥ 0.6 AND a pay-side consensus. Only on a pass does the second opinion fire: Jev (jev-1.14.0 in the proof runs) answers an act score plus a pay / reject / quarantine choice. A block spends nothing on Jev — the expensive judgment is reserved for payments that already cleared the cheap evidence.

The check itself is an x402 call, so the pattern eats its own cooking: MCP tool spend_gate_check and REST POST /x402/spend-gate on the mcp-x402 host, $0.005 USDC per check on Base (eip155:8453) to payTo 0x5bbd32e0478e49a7540ef2d760e0b0f9aa6328b2. The gate moves no funds — it returns a verdict; the agent's own wallet still signs (or doesn't) afterwards.

The proof runs: six settled checks, October 26, 2026

Every check below was paid by ScriptMasterLabs' own proof wallet and settled to the fleet's own payTo — owner self-tests, never customer purchases — and every transaction was re-read on Base RPC on the evening of October 26, 2026 for this page: all six at status 0x1 (success).

RunPayment proposedResultCoherenceJevCheck settlement
v1 goodsqueezeos-api.onrender.com, $0.001, data_lookupPASS1.0, consensus payact 0.87, choice pay (conf 0.92), jev-1.14.0tx 0x36a8a11d66e61d8d08745e385fafd677cd9c2eb83ccc048bec321172ec3f6373, block 53,104,724
v1 badnonexistent-payee-zzz-987.invalid, $5.00 vs $0.05 capBLOCKED1.0, consensus rejectNot fired (gate_blocked)tx 0x3867007818ba10503ee5ad7cb979fb7dd5be62db97bb0a8fd2c7126fdc00f60e, block 53,104,732
v1 restartGood payee + npm manifest, after a full service restartPASS — pre-restart check history read back (state survived)1.0act 0.88, choice paytx 0x9dff5a704552a9b1b6d75511da9c33ff8962ef2b782af4747e3e678ffe568719, block 53,104,781
v2 trustscriptmasterlabs.com, $0.001, cap $0.05PASS — provider_trust voted pay 0.8 with a real verdict1.0act 0.89, choice paytx 0x19ab67471a106026857d6ac498ac5623d0c85ceb43e6f3190d9dd679c3e44deb, block 53,105,535
v2 three-pathSame payee + npm:express manifest (0 vulnerabilities)PASS — three paths voting (0.8 + 0.9 + 0.99)1.0act 0.90, choice paytx 0x2b0cf2b9e14249210d31415fc68b86512c86ad19f54f543967d74a87fdcaeeeb, block 53,105,554
v2 badoffline-payee.invalid, $5.00 vs $0.05 capBLOCKED — price reject 1.0 AND provider_trust reject 0.8 (DO_NOT_TRUST / DNS unavailable)1.0, consensus rejectNot fired (gate_blocked)tx 0xc82f8d9ac7688e3ae4d20c77fe4d13bf8f438967dd08beb6f6183bc6d27abd1e, block 53,105,555

Details that matter more than the headline numbers:

ScriptMasterLabs' Spend Gate, live-tested October 26, 2026, passed a $0.001 USDC payment at coherence 1.0 and blocked a $5 over-cap payment at coherence 1.0 — the check itself costs $0.005 USDC, settled on Base.

Re-verified live on the evening of October 26, 2026

Fresh unpaid probes for this page, run twice with identical amounts and statuses (probe file: probe-spendgate-1026.out in the run record):

How this differs from the guards and checklists already out there?

Do it yourself: wire a pre-payment check in 5 steps?

  1. Intercept before signing. The check only works in the one place a null confirmation callback doesn't: between the 402 challenge arriving and your wallet signing the payment authorization.
  2. Describe the payment, not the task. Send the gate the payee, the quoted USDC amount, the tool category (which selects the cap), and a manifest_url when the purchase is a software package.
  3. Act on the verdict shape, not a vibe. gate_pass true + pay consensus → proceed to sign. gate_pass false → do not sign; the result names which path rejected and why (over cap by a stated percentage, DO_NOT_TRUST, a CRITICAL vulnerability). An abstention-heavy result (few paths voting) is information too: the gate is telling you it could not assemble evidence.
  4. Spend the decision model last. If you run your own scorer, fire it only on gate passes — in the proof runs this discipline kept Jev spend at zero on every block.
  5. Log both transactions together. The check's settlement tx and the payment's settlement tx (or the absence of one, on a block) are the audit pair. An agent that can show "checked, blocked, here is the on-chain check receipt" has a defense exhibit; an agent with only a wallet history has a list of losses.

Minimal REST shape (unpaid call returns the 402 challenge first; pay $0.005 and re-present):

POST https://mcp-x402.onrender.com/x402/spend-gate
{ "payee": "https://seller.example/api", "quote_usdc": 0.001,
  "tool_category": "data_lookup", "policy_cap_usdc": 0.05,
  "manifest_url": "https://www.npmjs.com/package/express" }

The product

Spend Gate is live as part of ScriptMasterLabs' mcp-x402 node: MCP tool spend_gate_check for MCP clients, REST POST /x402/spend-gate for anything that speaks HTTP, $0.005 USDC per check on Base, no account and no API key — the x402 challenge is the checkout. It is the buyer-side companion to the seller-side decision products: Verdict Protocol (https://scriptmasterlabs.com/verdict-protocol) seals a 5-juror Jev decision receipt for $0.25 when the question is a judgment call worth a jury; Spend Gate is the half-cent evidence check for the ordinary payment an agent makes a hundred times a day. The pattern both implement — decide first, pay second, keep the receipt — is written up at https://scriptmasterlabs.com/decision-gated-payments

Honest limits

Which primary sources does this piece rest on?

Related pieces

Free tool

Get SML results first on Google
Prefer ScriptMasterLabs in Google search results

One topic, one page per job — the agent spend-control cluster

This page is the canonical pre-pay check: the live Spend Gate ($0.005 USDC on Base) that votes on a payment before the wallet signs. The neighbouring pages own the adjacent jobs: