{"uid":"cap_H8Y0av6XIIexDTRENyJym","slug":"agent-decision-procedure-for-x402-payments-1f9009c7","name":"Agent Decision Procedure for x402 Payments","description":"Agent decision procedure for x402 payments: inputs are task goal, budget remaining, latency budget, and required confidence. Auto-pay when expected value clearly exceeds price and failure is cheap to retry. Deliberate when price is material or upstream unproven. Defer when identity, refund path, or provenance missing. Keep request id, payer policy version, evidence hash, settle receipt. Handle failure modes like empty payload, wrong schema, double-charge with idempotency keys. Demands","url":"https://k2so.wrong.systems/api/services/agent-decision-procedure","method":"GET","headers":{},"bodySchema":{"type":"object","$schema":"https://json-schema.org/draft/2020-12/schema","required":["input"],"properties":{"input":{"type":"object","required":["type","method"],"properties":{"type":{"type":"string","const":"http"},"method":{"enum":["GET","HEAD","DELETE"],"type":"string"},"queryParams":{"type":"object","properties":{"meta":{"enum":["0","1"],"type":"string","description":"Set to 1 for free metadata JSON (no payment required)"},"topic":{"type":"string","description":"Optional topic override for the decision procedure"}}}},"additionalProperties":false},"output":{"type":"object","required":["type"],"properties":{"type":{"type":"string"},"example":{"type":"object","title":"Agent decision procedure paid response","$schema":"https://json-schema.org/draft/2020-12/schema","required":["ok","paid","service","provider","result"],"properties":{"ok":{"type":"boolean"},"paid":{"type":"boolean"},"result":{"type":"object","required":["ok","service"],"properties":{"ok":{"type":"boolean","description":"Handler success"},"brief":{"type":"string","description":"Decision procedure prose for agents"},"model":{"type":"string"},"topic":{"type":"string"},"service":{"type":"string","description":"Service slug"},"procedure":{"type":"string"},"generatedAt":{"type":"string","description":"ISO-8601 timestamp"},"generationSource":{"enum":["llm","reasoning","deterministic"],"type":"string"}}},"payment":{"type":"object","properties":{"code":{"type":"string"},"payer":{"type":"string"},"detail":{"type":"string"},"selfPay":{"type":"boolean"},"transaction":{"type":"string"}}},"service":{"type":"string"},"provider":{"type":"string","const":"K-2SO"}}}}}}},"responseSchema":{"type":"json","example":{"ok":true,"paid":true,"result":{"ok":true,"brief":"plain prose decision procedure (120+ words)","model":"deepseek/deepseek-v4-flash-0731","topic":"string topic","service":"agent-decision-procedure","procedure":"same as brief","generatedAt":"2026-01-01T00:00:00.000Z","generationSource":"deterministic"},"service":"agent-decision-procedure","provider":"K-2SO"}},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.001","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"down","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.001/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.001","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.001","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_CqiOdeZVVPRvpH_CKiUx5","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.001","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Returns a structured decision brief explaining how an autonomous agent should safely handle x402 payment challenges, including parsing 402 responses, verifying receipts, checking budgets, and deciding whether to pay.","exampleAgentPrompt":"Give me the full x402 agent decision procedure — walk me through how to parse a 402 response, verify the payment receipt, check my budget and allowlist thresholds, and decide whether to actually pay, including what to log and what the failure modes are.","exampleUseCases":[{"title":"Building a safe x402 payment client","prompt":"I'm building an autonomous agent that calls x402-gated APIs. Give me the decision procedure it should follow when it hits a 402 — what it needs to check, how to verify the receipt, and how to avoid paying incorrectly."},{"title":"Auditing agent payment logic for compliance","prompt":"I need to review whether our agent's payment logic follows best practices for x402 — can you get me the official decision brief so I can compare what steps we're missing around budget checks, allowlists, and evidence logging?"},{"title":"Debugging a failed autonomous payment flow","prompt":"Our agent made an x402 payment that didn't go through correctly and I'm not sure where it went wrong — can you pull the decision procedure brief so I can check which step it likely failed at and what failure modes to look for?"}],"resultDescription":"A prose decision brief for agents covering: how to parse a 402 response, how to verify a payment receipt, how to check budget and allowlist thresholds, what evidence to log, and what failure modes to handle. Also includes service slug, generation source (llm/reasoning/deterministic), model used, and an ISO-8601 timestamp.","failureModes":["Payment not completed — handler returns ok:false if the $0.001 USDC payment fails","Invalid HTTP method — only GET, HEAD, DELETE are accepted","Malformed input object — missing required 'type' or 'method' fields returns a validation error","LLM generation failure — generationSource may fall back to deterministic or reasoning if LLM unavailable","Topic override not recognized — may return a generic brief if topic is not a known x402 topic"],"whenToPreferThis":"Use this endpoint when building or auditing an x402 payment client that needs a clear, agent-consumable decision procedure for handling 402 responses autonomously. Prefer this over general documentation when you need a structured, machine-readable brief with explicit budget/allowlist logic, evidence logging requirements, and enumerated failure modes tailored for agent operation on Base (USDC).","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-15T13:29:13.124Z","isFirstParty":false}