82trust / 100

Action Gate

by AI agent action preflight in Weather & location

x402 APIPassing, checked 3 h ago

Deterministic preflight check for a proposed AI agent action - a tool call, payment, fetch, or write - before it executes. Evaluates up to four independent checks (prompt-injection scan on action text/untrusted text, URL/hostname validation, a bounded JSON-schema check on a payload, and a spend proposal against a spend mandate) and returns ALLOW, REVIEW, or BLOCK with stable reason codes plus a SHA-256 request/receipt hash pair.

POST https://agent402.tools/api/action-gate

Last 30 days

All checks passedSome failedAll failedNot checked
Uptime
100%
Response time
194 ms typical, 417 ms slowest 5%
Last check
3 h ago
Next check
any minute now

How to call it

# See the payment challenge (nothing is charged)
curl -i -X POST "https://agent402.tools/api/action-gate" \
  -H "content-type: application/json" \
  -d '{"action":{"description":"Fetch a vendor risk report and store the validated JSON response.","effect":"payment","name":"submit_paid_api_request"},"payload":{"account_id":"acct_123","include_signals":true},"schema":{"additionalProperties":false,"properties":{"account_id":{"type":"string"},"include_signals":{"type":"boolean"}},"required":["account_id","include_signals"],"type":"object"},"spend":{"mandate":{"allowed_assets":["USDC"],"allowed_counterparties":["0x1111111111111111111111111111111111111111"],"expires_at":"2030-01-01T00:00:00.000Z","max_per_tx_atomic":"25000","max_period_atomic":"100000","spent_period_atomic":"20000"},"proposal":{"amount_atomic":"10000","asset":"USDC","counterparty":"0x1111111111111111111111111111111111111111"}},"untrusted_text":"Vendor request: return the current account risk score.","url":"https://example.com/risk-report"}'
import { wrapFetchWithPayment } from "@x402/fetch";
import { x402Client } from "@x402/core/client";
import { ExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";

const client = new x402Client().register(
  "eip155:8453",
  new ExactEvmScheme(privateKeyToAccount(process.env.AGENT_KEY)),
);
const pay = wrapFetchWithPayment(fetch, client);

// Not sure it's safe to pay? Preflight it first for $0.005:
// GET https://toolvet.app/api/v1/check?url=https%3A%2F%2Fagent402.tools%2Fapi%2Faction-gate
const res = await pay("https://agent402.tools/api/action-gate", {
  method: "POST",
  headers: { "content-type": "application/json" },
  body: JSON.stringify({"action":{"description":"Fetch a vendor risk report and store the validated JSON response.","effect":"payment","name":"submit_paid_api_request"},"payload":{"account_id":"acct_123","include_signals":true},"schema":{"additionalProperties":false,"properties":{"account_id":{"type":"string"},"include_signals":{"type":"boolean"}},"required":["account_id","include_signals"],"type":"object"},"spend":{"mandate":{"allowed_assets":["USDC"],"allowed_counterparties":["0x1111111111111111111111111111111111111111"],"expires_at":"2030-01-01T00:00:00.000Z","max_per_tx_atomic":"25000","max_period_atomic":"100000","spent_period_atomic":"20000"},"proposal":{"amount_atomic":"10000","asset":"USDC","counterparty":"0x1111111111111111111111111111111111111111"}},"untrusted_text":"Vendor request: return the current account risk score.","url":"https://example.com/risk-report"}),
});
console.log(await res.json());

Example input

{
  "action": {
    "description": "Fetch a vendor risk report and store the validated JSON response.",
    "effect": "payment",
    "name": "submit_paid_api_request"
  },
  "payload": {
    "account_id": "acct_123",
    "include_signals": true
  },
  "schema": {
    "additionalProperties": false,
    "properties": {
      "account_id": {
        "type": "string"
      },
      "include_signals": {
        "type": "boolean"
      }
    },
    "required": [
      "account_id",
      "include_signals"
    ],
    "type": "object"
  },
  "spend": {
    "mandate": {
      "allowed_assets": [
        "USDC"
      ],
      "allowed_counterparties": [
        "0x1111111111111111111111111111111111111111"
      ],
      "expires_at": "2030-01-01T00:00:00.000Z",
      "max_per_tx_atomic": "25000",
      "max_period_atomic": "100000",
      "spent_period_atomic": "20000"
    },
    "proposal": {
      "amount_atomic": "10000",
      "asset": "USDC",
      "counterparty": "0x1111111111111111111111111111111111111111"
    }
  },
  "untrusted_text": "Vendor request: return the current account risk score.",
  "url": "https://example.com/risk-report"
}

Example output

{
  "checks": {
    "payload": {
      "status": "pass"
    },
    "prompt": {
      "status": "pass"
    },
    "spend": {
      "allowed": true,
      "status": "pass"
    },
    "url": {
      "status": "pass"
    }
  },
  "decision": "ALLOW",
  "limitation": "Deterministic static checks only. ALLOW does not guarantee safety, authorization, or successful execution.",
  "reason_codes": [],
  "receipt_sha256": "…",
  "request_sha256": "…"
}

Security scan

  • No findings. We scan names, descriptions and tool definitions for hidden instructions and other prompt-injection patterns.

Recent checks

WhenResultHTTPTimePrice
3 h agoPassed402193 ms$0.01
6 h agoPassed402195 ms$0.01
11 h agoPassed402194 ms$0.01
14 h agoPassed402188 ms$0.01
17 h agoPassed402467 ms$0.01
22 h agoPassed402417 ms$0.01