Agent Output Verifier by SarnAI
dev.sarnaiv0.5.1更新于 Oct 8, 2026
Verify an agent's output before you pay: JSON Schema + rules, signed receipts. Free during launch.
概览
让助手按 JSON Schema 和跨字段规则校验结构化输出,返回通过/失败、修复提示和签名回执。
- 功能
- 通过托管的 Streamable HTTP 端点提供两个 MCP 工具:verify_schema 按调用方提供的 JSON Schema 及可选规则(如 sum_equals、gte、lte、exists_in、unique)检查提交的输出;get_verification_record 查询某个 agent 的信任评分。校验结果包含通过/失败、通过检查的百分比、修复提示,以及可用服务公开公钥核验的 Ed25519 签名证明与回执。REST 路由以另一个名称提供同样的检查。
- 适用场景
- 当助手或 agent 流程需要在付款或验收前,对发票、交付物或其他结构化输出做独立、确定性的检查,并希望获得该检查的签名回执时适用。卖方也可在提交前先校验自己的输出。
- 运行要求
- 远程 MCP 端点,无需本地安装。无需账号或注册。发布期内校验免费,按请求 IP 每日有额度,MCP 与 REST 共用;超出后按次付费,使用 x402 v2 以 USDC 在 Base 或 Solana 上支付,MCP 请求通过 _meta 下的 x402/payment 携带付款,REST 使用标准 x402 头。agent 评分查询始终付费。
安装
在 SourceWeft 中
- 打开 控制台中的 Agent Output Verifier by SarnAI,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Web executable,通过 Streamable HTTP。 远程服务在工作区中配置后即可从网页运行时运行。
其他 MCP 客户端
把它添加到你客户端的 mcpServers 配置中。
{
"mcpServers": {
"agent-output-verifier": {
"type": "http",
"url": "https://verify.sarnai.dev/mcp"
}
}
}README
Agent Output Verifier by SarnAI
Independently verify an agent's output before you pay.
Independent, deterministic checks for invoices, deliverables and any structured output: structure,
formats, ranges and cross-field rules, such as "line totals must equal the total," against your own
requirements, written in standard JSON Schema plus optional rules. Returns pass/fail, the percentage
of checks passed, fix hints, and an Ed25519-signed attestation and receipt that anyone can verify
with our public key. Sellers: check your own output before you submit it, and deliver it with a
signed attestation and receipt. No signup: pay per call with x402 v2, in USDC on Base or Solana.
Free during launch: 1,000 verification checks a day per caller through MCP and REST, shared; the live value is in
/llms.txt. Agent Scores are paid only: $0.01 per lookup.
Agent Output Verifier is part of SarnAI, an ecosystem of products for agents that work with each other, with the Agent Discovery Board (https://board.sarnai.dev/guide) and Agent Scores.
This repository is documentation and public metadata for the hosted service — there is no source
code to install or run here. The service itself is a live API at
https://verify.sarnai.dev. The original address, https://fastapi-service-5ag4.onrender.com, keeps working with the same responses and keys; receipts issued before the move point at it.
Endpoints
Two MCP tools are exposed over the same endpoint: verify_schema (POST /verify/schema) and
get_verification_record (GET /score/{agent_id}).
Pricing and networks
After the free allowance, each call is paid with x402 v2 in USDC. Agent Scores are always paid: $0.01. No account or signup is required.
/.well-known/x402 and the Payment-Required header of a live 402 response always carry the
exact live prices, pay-to addresses and asset addresses — treat them as the source of truth, and
this table as a quick reference.
Three headers carry the payment itself, by name: an unpaid request gets HTTP 402 with the price and
payment requirements in the Payment-Required response header; a paid request carries its signed
payment in the Payment-Signature request header; a settled response carries the settlement receipt
in the Payment-Response response header. A fail result is a complete, valid answer to the
question asked and is charged the same as a pass — the work (running every check) is identical
either way.
Free allowance
Verification is free during launch. Each client, identified by request IP address (there is no sign-up
or account), gets a daily allowance of checks, shared by the MCP tool verify_schema and the REST routes
POST /verify/schema and POST /verify/deliverable. The allowance is a setting, not a constant: the live numbers
are stated in one place, the "Free allowance" section of /llms.txt.
A valid unpaid REST request is served free while the allowance lasts, and the response says what is left in
the Free-Allowance-Remaining, Free-Allowance-Limit and Free-Allowance-Resets headers. A request that is
too large, one that carries a payment, and any request after the day's allowance is used up, goes
to payment as usual (HTTP 402). An invalid request is never pointed at payment: it gets a validation error (HTTP 422,
see "Errors" below). Free verifications count toward an agent's score and reputation exactly like paid ones.
Agent Scores are always paid only: GET /score/{agent_id} and the MCP tool get_verification_record
cost $0.01 per lookup, with no free access.
An unpaid REST call's 402 body reports this caller's own real state, live: available,
remaining_calls_today, and resets_at (the next UTC midnight). Once a client's allowance for the day is
used up, available turns false and the body carries "code": "free_trial_exhausted":
The same free_trial_exhausted code rides alongside the MCP tool's own payment-required result (in _meta)
when a tool call is made after that client's allowance for the day is gone. After the allowance (or once it is
used up for the day), a call requires an x402 payment carried in the MCP request's _meta under
x402/payment, or a standard x402 payment header on REST.
Errors
Every error other than a payment error has one shape, on REST and in MCP tool results:
code is stable, retryable says whether the same request can succeed on a retry (a retryable error also has
retry_after), and an error is never charged. Your input is never echoed back. An invalid request (bad JSON, a
missing field, an unknown rule type, an id over 200 characters) is rejected with a 422 before payment, so it is
never told "payment required"; a POST with no body at all is the x402 discovery probe and still gets the 402. A body
over the size limit gets a 413 that states the limit. The full code table and the payment-error codes are in the
/llms.txt "Errors" and "Payment errors" sections and in the OpenAPI description.
Verifying a receipt, step by step
Every response from /verify/schema and /score/{agent_id} carries a signed verify section and
an attestation block, for example:
Nothing but the response itself and verify.public_key_url is needed:
-
Fetch the public key.
GETthe agent-card atverify.public_key_url. Itscapabilities.extensionsarray has an entry whoseuristarts withurn:json-schema-verifier:extension:attestation:; itsparams.publicKeyslists every key the service has ever signed with, each{keyVersion, algorithm, publicKey}(the raw 32-byte Ed25519 public key, base64-encoded). Pick the entry whosekeyVersionequalsresponse.attestation.key_version. The live agent-card is always the source of truth; this is a convenience copy of the current key, worth reconfirming against the live agent-card first: -
Rebuild the signed document. It's a JSON object with exactly these five keys:
contextisjson-schema-verifier/verify-schema-attestation/v1for/verify/schemaresponses and for/verify/deliverableresponses (the same check under a second name; there is no separate deliverable context), orjson-schema-verifier/trust-score-attestation/v1for/score/{agent_id}responses. -
Canonicalize it with RFC 8785 (JCS): UTF-8 bytes of the JSON document above, object keys sorted recursively, no insignificant whitespace, numbers printed the way ECMAScript prints them (
1.0becomes1). -
Verify the Ed25519 signature (
response.attestation.signature, base64-decoded) over those canonical bytes, using the public key from step 1. -
Check the four receipt hashes, each SHA-256 over the RFC 8785 (JCS) canonical JSON of the named value:
output_hash(ofsubmitted_output),schema_hash(ofexpected_schema),rules_hash(of{"bounds": ..., "rules": ...}), andrequest_hash(of the whole request as parsed, full detail only). Recompute them yourself and compare — this is what binds the receipt to the exact data that was checked.request_hashfills every per-rule and per-bound field to its own default before hashing — an omittedtolerancehashes as1e-9, an omittedif_presentasfalse, an omittedequals_field/equals/other_field/value/in_field/valuesasnull— so two requests whose rules differ only in which optional fields were typed out still hash identically here.rules_hashis the opposite: it hashes exactly and only the fields you supplied, nothing defaulted in.
A minimal Python verifier, using only the standard library plus cryptography:
Tested against both receipts in the worked example below — both verify True.
Test vectors for request_hash
request_hash is the SHA-256 (lowercase hex, of the UTF-8 bytes) of the RFC 8785 canonical JSON of the request as parsed: the eight fields task_id, agent_id, expected_schema, submitted_output, strict_content_check, bounds, rules and enforce_rules, with every default filled in, including every per-rule and per-bound field you left out. An omitted rule field hashes as equals_field/equals/other_field/value/in_field/values: null, tolerance: 1e-9, if_present: false; an omitted bound field hashes as if_present: false. detail is not part of it (it only picks the response shape, and compact responses leave request_hash out, so call with the default "detail": "full" to see it). This differs on purpose from rules_hash, which hashes only the fields you supplied.
Each vector below gives the request body you would POST, the exact canonical form that gets hashed, and the resulting hash. They are real: POST the request to /verify/schema (or /verify/deliverable) and the response's request_hash is the value shown. The same vectors are in the agent-card (/.well-known/agent-card.json, attestation extension, requestHashTestVectors).
Vector 1: minimal. No rules or bounds: every optional field takes its default.
Request:
Canonical form (one line, no whitespace):
request_hash:
Vector 2: rules-and-bounds. A bound and two rules with enforce_rules on: each per-rule and per-bound field you left out is filled to its default (tolerance 1e-9, if_present false, the unused references null), and JCS prints 10.0 as 10.
Request:
Canonical form (one line, no whitespace):
request_hash:
Vector 3: strict-and-unicode. strict_content_check on, a rule with if_present, non-ASCII text kept as literal UTF-8, and the JCS number forms 1.0 -> 1, 1e21 -> 1e+21, 0.000001 -> 0.000001.
Request:
Canonical form (one line, no whitespace):
request_hash:
To reproduce them without our code, this self-contained Python snippet (standard library only) takes a request body and returns the canonical form and the hash. It implements the RFC 8785 rules these vectors exercise: keys sorted by UTF-16 code unit, no whitespace, strings as literal UTF-8, and numbers printed as ECMAScript prints them (10.0 is 10, 1e21 is 1e+21, 1e-9 stays 1e-9). Any JCS library (for example the rfc8785 package) gives the same result.
Worked example: invoice verification
Both calls below are genuine, live, paid calls against the production service — real x402
payments on Base, settled on-chain, with the resulting signed receipts shown exactly as received.
Both are independently verifiable: fetch the agent-card above, confirm key_version: v1-2026-09c
is listed, and verify each attestation.signature with the steps above.
1. Draft invoice — fails on a cross-field rule (detail: "full")
Request:
The line items sum to 129.5, but total says 135.0. With enforce_rules: true, that rule
violation fails the result and comes with a fix hint:
Payment evidence: $0.02 USDC on Base, settled on-chain —
0x4cb755c71413ed5419215d2d7445c34e19be79d9f15b4046802656165b774897.
2. Corrected invoice — passes (detail: "compact")
Same schema and rule, total fixed to match the line items (129.5), requested with
"detail": "compact" to get back only the summary, receipt fields and signature:
The compact shape keeps the summary, receipt fields, verify and attestation; request_hash,
errors, errors_detail, flags, hints and the three scores stay in the full shape (see
detail above).
Payment evidence: $0.02 USDC on Base, settled on-chain —
0xaa9161736ac410b6ac9ccc478780aa2feaa6d2cf02af4c51855e099c14499079.
Verifying these two receipts yourself
Both responses above were checked against the live agent-card's public key for v1-2026-09c
before being included here, using the steps in Verifying a receipt.
Confirm it yourself the same way: fetch
https://fastapi-service-5ag4.onrender.com/.well-known/agent-card.json, confirm v1-2026-09c is
listed, and re-run the same five steps against the two JSON blocks above — the signatures were
computed once, over exactly this data, and will verify identically for anyone.
agent_id identifies the agent that produced the output being checked — for example, the seller;
it's an unauthenticated label the caller supplies. agent_id: "test-seller-invoice-agent" uses the
test- prefix the service reserves for examples: the verification ran for real, and its receipt is
genuine, while staying separate from that agent's trust score.
License
Documentation and examples in this repository are licensed under the MIT License. The hosted service is proprietary; this repository holds only documentation and public metadata.
来源:README.md,提交 bc7675a
工具
0版本历史
1- v0.5.1最新Oct 8, 2026


