{"uid":"cap_rFYJZ5eTfcIOK_nPT-peF","slug":"k-2so-decision-procedure-for-agents-paying-for-long-running-jobs-x402-23bb9cb2","name":"K-2SO Decision Procedure for Agents Paying for Long-Running Jobs (x402)","description":"Deterministic procedure for an agent that must pay for a long-running or asynchronous job over x402/MPP (video generation, scraping, inference, batch processing). Covers: submit-payment split (pay only for submission, never for the whole job up front), polling budget with max polls and max total spend across polls, cancel-before-completion refund thresholds, resume-after-timeout rules with re-payment guardrails, job-status code interpretation (queued/running/succeeded/failed/canceled), and a","url":"https://k2so.wrong.systems/api/services/decision-procedure-for-agents-paying-for-long-ru","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":"Async job payment lifecycle decision procedure for agents 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":"decision-procedure-for-agents-paying-for-long-ru","procedure":"same as brief","generatedAt":"2026-01-01T00:00:00.000Z","generationSource":"deterministic"},"service":"decision-procedure-for-agents-paying-for-long-ru","provider":"K-2SO"}},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.002","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":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.002/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.002","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.002","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_GAkyWrEQ7U7U98ec0dYi7","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.002","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Returns a plain-prose decision procedure guiding AI agents through the payment lifecycle for async/long-running x402 job payments, generated on-demand via LLM or deterministic logic.","exampleAgentPrompt":"Give me the decision procedure for how an AI agent should handle payments for long-running async jobs — I need the step-by-step reasoning on when to pay, how to retry, and what to do if the job is still running after settlement.","exampleUseCases":[{"title":"Async job payment lifecycle guidance","prompt":"My agent just triggered a long-running data processing job via x402 and isn't sure whether to pay upfront or wait — can you give me the full decision procedure for managing async x402 job payments?"},{"title":"Building an agent that handles 402 retries","prompt":"I'm building an autonomous agent that calls slow APIs and I need a clear decision procedure for how it should handle the HTTP 402 payment flow when the job might take minutes to complete."},{"title":"Auditing agent payment logic for compliance","prompt":"Can you generate the decision procedure for how an AI agent should reason about paying for long-running x402 jobs, so I can compare it against our current agent implementation and spot any gaps?"}],"resultDescription":"A JSON object containing a boolean success flag, payment confirmation, and a result object with 120+ words of plain-prose decision procedure text tailored to async/long-running x402 job payments. Includes the model used for generation, the topic, service slug, ISO-8601 generation timestamp, and generation source (llm, reasoning, or deterministic).","failureModes":["Payment not settled — returns HTTP 402 with PAYMENT-REQUIRED header and exact USDC amount needed","Invalid meta parameter value — schema validation error","Service unavailable — upstream LLM or deterministic generator unreachable","Malformed retry signature — payment signature rejected on retry","Topic override too long or invalid — may return schema error or truncated result"],"whenToPreferThis":"Use this endpoint when an AI agent needs authoritative, on-demand prose guidance for navigating the payment lifecycle of async or long-running x402 jobs, especially when the agent must decide timing, retry logic, and settlement confirmation steps. Prefer this over static documentation when you need a fresh, model-generated procedure that can be parameterized by topic. Best suited for agent orchestration layers that inject decision procedures at runtime.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-13T18:52:46.277Z","isFirstParty":false}