Classifier & refund policy
Every call gets one of three labels. The label decides whether the agent pays the premium, the provider keeps the principal, or the pool refunds the agent. Pact only earns on successful calls; failures are net $0 for the protocol.
The three labels
Section titled “The three labels”success— call worked, agent pays, Pact earns the premium.client_error— agent’s fault, no refund, Pact stays out of it.server_error— provider/network’s fault, agent gets refunded (principal + premium).
The classifier runs at Market on the response from the upstream provider.
Rules (v1)
Section titled “Rules (v1)”success
Section titled “success”- HTTP
200–299. - Body is valid JSON or matches the upstream’s documented content type.
- No body-level error sentinel flagged by EndpointConfig. (Some providers
return 200 with
{"error": "..."}— we treat known patterns asserver_error.)
client_error
Section titled “client_error”- HTTP
400,401,403,404,405,409,410,413,415,422,429. - Pact-side rejections: bad API key, allowlist miss, payload too large.
- Anything Market returns before reaching upstream (except 5xx bugs in
Market — those are
server_error).
server_error
Section titled “server_error”- HTTP
500,502,503,504. - Upstream unreachable, connection reset, TCP/read timeout.
- Truncated or malformed body on a 200.
- Market internal 5xx (we eat the cost when our proxy breaks).
What the classifier does not do (yet)
Section titled “What the classifier does not do (yet)”- Schema validation. A 200 with a semantically wrong body
(e.g.
balance: -1) is stillsuccess. - Latency thresholds. Slow-but-eventually-200 is
success. - Cross-call correlation. Each call is classified independently.
Premium & refund math
Section titled “Premium & refund math”Principal = the x402 / MPP amount Market forwarded to the upstream. Premium = Pact’s per-call fee on top, set per EndpointConfig.
For a $0.01 upstream call with a 50 bps premium: principal = $0.0100, premium = $0.00005, total agent cost = $0.01005.
Three outcomes, three settlements
Section titled “Three outcomes, three settlements”| Classification | Agent net | Upstream net | Pool net | Pact net |
|---|---|---|---|---|
success | -principal -premium | +principal | +premium | +premium |
server_error | $0.000 | $0.000 | -refund-out | $0.000 |
client_error | -principal | +principal | $0.000 | $0.000 |
On server_error, the agent gets back principal + premium. The
provider doesn’t get paid (Market holds the principal in escrow or
pulls it back, depending on the upstream rail). On client_error, the
provider keeps the money — the agent broke their own request, so Pact
doesn’t cover it.
The settlement equation
Section titled “The settlement equation”For one call settled in settle_batch:
if classification == success: AgentWallet -= premium CoveragePool += premiumelif classification == server_error: CoveragePool -= (principal + premium) AgentWallet += (principal + premium)elif classification == client_error: # nothing — no fund movement on Pact's side.The principal-on-success case sits outside the program. Market handles the agent → provider transfer over x402 / MPP.
Why we don’t earn on failure
Section titled “Why we don’t earn on failure”- Trust. Earning on failed calls would create pressure to classify
as
client_errorwhen in doubt. Net-zero on failure leaves only thesuccess↔server_erroraxis — healthier alignment. - Simplicity. One rule: refund returns principal and premium. No tiers, no fee schedule.
Premium rate updates
Section titled “Premium rate updates”Rates live on EndpointConfig and never apply retroactively — each call uses the rate active at the time of the call.
Disputes
Section titled “Disputes”No on-chain dispute path in v1. Misclassifications are a support ticket
with the X-Pact-Call-Id from the response header.
See also
Section titled “See also”settle_batch— the on-chain settlement instruction.- Protocol primitives — CoveragePool, AgentWallet, EndpointConfig layouts.