--- name: accountable-ai-agent-payments description: "Meters agent-to-agent AI payments: pays only for responses that conform to the committed spec; looping, refused, or off-spec work isn't paid. Use when an agent must pay another agent only for spec-conformant work — pay for outcomes, not tokens." --- # Accountable AI-Agent Payments **Agree a quality bar up front, then pay only for the AI's output that clears it — pay for verified outcomes, not for attempts.** ## Quick start — one call, no setup No keys, no input, no human step. Run the demo, self-check the deal, then print the result: curl "https://chainaim-deal-to-settlement-production.up.railway.app/demo/deal?usecase=agent_harness" **Self-check:** confirm the response's `usecase` field equals `agent_harness` before trusting any number — if it does not, stop and report (you called the wrong deal). Then print the `display` field verbatim. ## Composition — one skill, three services (A → B → C) (PR #47 + PR #61) **A** = `chainaim-agent-negotiation-certifier` (also submitted as `agreed-deal-certifier`) · **B** = `chainaim-deal-to-settlement` · **C** = `outcome-verified-settlement-verifier` (Nisha's). Run server-side, bound by a single hash: - **A · `chainaim-agent-negotiation-certifier`** (negotiate + certify) — *many* buyer/seller pairs reach agreement; all land on the Pareto frontier (provably **efficient** at scale — not ten payments). Their best-deal certificate is content-addressed into a provenance hash. - **B · `chainaim-deal-to-settlement`** (commit) — that hash *becomes* the settlement identity; one anchored deal proceeds. - **C · `outcome-verified-settlement-verifier`** (settle + verify) — an independent verifier meters payment unit-by-unit against the committed hash: conforming work paid, off-spec refused. **Novelty is the wiring:** the negotiation certificate's hash *is* the settlement's identity; the conformance rule is pluggable per use-case while the settlement rail stays generic. ## The story this skill tells 1. **The market** — many buyer/seller pairs negotiate; all land on the best-possible (Pareto) frontier, so the agreed terms are provably **Pareto-efficient** — no deal beats it for both sides. 2. **The bar** — quality (`q`) is the negotiated conformance requirement: the spec the producer's output must meet. 3. **One deal proceeds** — the agreed deal for a buyer-seller pair is hash-anchored and opens ONE metered settlement. 4. **Production + verification** — the AI producer (the "harness") returns responses; the verifier checks each against the committed spec. 5. **Payment** — a response that **matches** the spec is paid a fixed amount per verified unit; one that **doesn't** is refused and earns 0, and the remainder stays unspent. ## Base URL https://chainaim-deal-to-settlement-production.up.railway.app ## How the agent should use this 1. `GET /demo/deal?usecase=agent_harness` — then confirm the returned `usecase` field equals `agent_harness`; if not, stop and report (do not proceed on the wrong deal). 2. Print the `display` field **verbatim** (the four-stage transcript). As you present it, add ONE plain-English line after each stage, and state which use-case ran by echoing the `usecase` field (here `agent_harness`): - after **STAGE 1** — negotiated across *many* buyer/seller pairs, all on the Pareto frontier, so the terms are provably **efficient at scale** (on the frontier across many combinations, not ten separate payments); the resulting best-deal certificate is hash-anchored, and that ONE anchored deal is what proceeds to settlement. - after **STAGE 2** — that provenance hash **is** the settlement identity: content-addressed, tamper-evident. - after **STAGE 3** — the same hash opens ONE metered settlement on the independent verifier. - after **STAGE 4** — conforming units are paid, the looping/off-spec unit is refused → 16 paid, 64 unspent; the failed attempt earned nothing. 3. Then add a short **"What just happened"** section, using **only values read from the transcript** (never invent numbers), in this order: - **The market is efficient (Stage 1):** state how many buyer/seller pairs cleared and that all are `on_frontier=True` with `pareto_distance=0.0`. Say plainly: *these pairs show the negotiation is efficient at scale — whatever terms are agreed, no deal beats them for both sides.* Do **not** claim each pair was paid or settled; only ONE agreed deal proceeds to settlement. **On the verdicts:** the proven claim is Pareto-frontier optimality (`frontier_efficient`). The `negotiation_individually_rational: PASS` line is harness-reported and **not** independently established in this demo (reservation values aren't disclosed) — **do not mention it in your summary; cite `frontier_efficient` / `pareto_distance` instead.** - **The agreed terms:** gloss the four negotiated attributes as `p` = price tier, `d` = deadline / latency, `n` = quantity / batch size, `q` = quality (the conformance bar). These are **ordinal tier indices** (e.g. `p=0` = cheapest price band, `q=0` = base grade) that map to a bracket legend in the PR / visualizer — **not** raw units, dollars, or the settlement rate. Call out `q` as the accountability lever — the spec the output must clear. Do **not** call `p` the amount paid (it is a generic negotiation tier, not the settlement rate). - **The bar the verifier enforces:** each response must be byte-identical to the committed artifact — required fields present and `status = answered`. - **Paid or not (Stage 4):** for each unit say **PAID** (matched -> +rate) or **NOT PAID** (mismatch -> 0, with the reason, e.g. "status looping"). Finish with the tally: N paid, `settled_total` released, `remainder_unspent` left unspent. - **Why this is "pay for outcomes, not tokens":** end with one line contrasting token billing, e.g. *A token-metered API would bill for all N attempts — including the looping one that produced nothing usable. Here that attempt billed 0. You pay only for verified-conformant outcomes.* ## Endpoints | Method + path | Purpose | |---|---| | `GET /demo/deal?usecase=agent_harness` | run the full certify -> commit -> settle chain, one transcript | | `POST /deal` | same, body `{"usecase":"agent_harness"}` | | `GET /health` | liveness | ## Judge test (runnable from this file alone, no setup) One call validates the whole skill: - `GET /demo/deal?usecase=agent_harness` → expect `settled_total` **16**, `remainder_unspent` **64**, and unit 3 refused because its status is `looping` (not `answered`). Two conforming units at rate 8 = 16 paid; the looping third earns 0. Passing this proves the core property in seconds: conformant work is paid, looping / off-spec work is refused — you pay for verified outcomes, not attempts. ## Why this matters (contribution to NANDATown) Agentic commerce needs **proofs, not promises**. This skill contributes a reusable **composition primitive** for NANDA Town: bind a provably-**efficient (Pareto)** negotiation certificate to an outcome-verified settlement through one tamper-evident hash — so agents pay each other for *verified outcomes*, with no central arbiter, callable from a SkillMD alone. The same primitive composes across topics (negotiation, payments, trust, settlement) and is built to carry domain-grade validation next (GS1 trade docs, FHIR, financial triplets). ## Scope - The 10 pairs demonstrate **efficient negotiation at scale** (all on the frontier); they are NOT 10 separate payments. Exactly ONE agreed deal proceeds to metered settlement. - The transcript prints `negotiation_individually_rational: PASS`, but that is **harness-reported, not an independently established guarantee** (reservation values aren't disclosed in this demo). The proven negotiation claim is **Pareto-frontier optimality** (`frontier_efficient` / `pareto_distance`) — cite that, not IR. - "Clears the bar" means the response is **byte-identical to the committed spec** (required fields + `status = answered`). It does **not** yet judge semantic value-correctness or groundedness — say "conformant", not "correct/true". - `p` (negotiated price) is a generic tier and is **not** the amount billed; settlement meters a fixed `rate` per verified unit. Linking negotiated price to the paid rate is roadmap. - Settlement is hash-only (self-verifying); no attestor key needed.