Policy gate with a signed receipt: your JsonLogic rules vs a proposed tool call or payment
Evaluates your own policy (JsonLogic rules, each allow or deny, deny-overrides or first-match, default deny) against a proposed tool call, payment or action, and returns allow or deny, the rule id that decided, and a receipt signed by the hub over the hashes of the policy, the request and the decision. The receipt is the product: another agent or an auditor can verify offline which rule allowed the action. A rule that errors fails closed (deny, status unknown). Cedar and Rego answer unsupported.
What you get
An auditable allow/deny for every consequential tool call at $0.005, verifiable by anyone with the hub's public key.
Call it
Send the JSON body below to https://agents.writerslogic.com/api/v1/policy-gate. An unpaid request answers 402 with the price and how to pay; a request that fails with a 5xx status is not charged.
curl -i -X POST https://agents.writerslogic.com/api/v1/policy-gate \
-H 'content-type: application/json' \
-d '{"policy":{"rules":[{"id":"deny-new-payee","effect":"deny","when":{"!":{"in":[{"var":"payee"},["0x7a16fF8270133F063aAb6C9977183D9e72835428"]]}}},{"id":"allow-small","effect":"allow","when":{"<=":[{"var":"amountUsd"},25]}}]},"request":{"tool":"pay","payee":"0x7a16fF8270133F063aAb6C9977183D9e72835428","amountUsd":12.5}}'
Input
| Field | Type | Required | Description |
|---|---|---|---|
language | string; one of "jsonlogic", "cedar", "rego" | no | Default jsonlogic. cedar and rego return unsupported. |
policy | any | yes | JsonLogic: { rules: [{ id, effect: allow|deny, when: <JsonLogic>, description? }] (at most 100), combining?: deny-overrides|first-match, defaultEffect?: deny|allow }. A string for cedar/rego. |
request | any | yes | The proposed action as JSON (at most 65536 bytes), e.g. { tool, args, amountUsd, payee }. Rules read it with { "var": "args.amountUsd" }. |
Example request body
{
"policy": {
"rules": [
{
"id": "deny-new-payee",
"effect": "deny",
"when": {
"!": {
"in": [
{
"var": "payee"
},
[
"0x7a16fF8270133F063aAb6C9977183D9e72835428"
]
]
}
}
},
{
"id": "allow-small",
"effect": "allow",
"when": {
"<=": [
{
"var": "amountUsd"
},
25
]
}
}
]
},
"request": {
"tool": "pay",
"payee": "0x7a16fF8270133F063aAb6C9977183D9e72835428",
"amountUsd": 12.5
}
}
Result
The response is { "data": ..., "_provenance": ... }. data carries these fields; _provenance is a signed W3C Verifiable Credential with a C2PA-style manifest, checked free at POST /api/v1/verify-provenance.
| Field | Type | Required | Description |
|---|---|---|---|
status | string; one of "pass", "fail", "unknown", "unsupported" | no | pass: every rule held. fail: a rule was violated (see witnesses). unknown: the input lacks the evidence to decide. unsupported: outside what this engine covers. Missing evidence is never a pass. |
decision | string; one of "allow", "deny" | no | |
ruleId | one of | no | The rule that decided; null when the default effect applied. |
matchedRules | array<string> | no | |
policyHash | string | no | sha256 of the JCS policy. |
requestHash | string | no | sha256 of the JCS request. |
receiptBody | object | no | Exactly what the receipt digest covers. |
receipt | object | no | Standalone receipt: recompute digest from `receiptBody`, then recover the EIP-191 signer and compare with the DID document's attestation key. signature is null when the hub has no attestation key configured. |
witnesses | array<object> | no | |
versions | object | no | Every semantic dependency of this answer (engine, tables and their as-of dates, tokenizer, calendar, rounding profile). |
limits | array<string> | no | |
deterministic | boolean | no | Always true: pure code, no model. |
Pay and connect
Available through: x402 (USDC on Base), MCP. MCP clients reach it through the agent-coordination-kit package.
Machine-readable
- This agent as JSON (schemas, example, OpenAPI operation)
- Free signed sample response
- OpenAPI 3.1 · Catalog · Index of every agent