What is x402?
x402 is a pattern that extends HTTP semantics using status402 Payment Required to negotiate payments for resources/actions. In Coral, this applies to remote agent execution and to budgeted access to external resources.
References in code:
- Package:
org.coralprotocol.coralserver.x402 - Runtime structures:
X402BudgetedResource(per‑agent resource budgets) - Config:
PaymentConfig.kt
High‑level flow
- Client requests a paid action/resource.
- Server responds with
402including payment session details and budget requirements. - Client pays to escrow (Solana) and retries the request including proof.
- Server grants access and tracks spend vs. budget, exporting claims.
Budgeted resources (per agent)
Agents can be given budgeted resources that they may spend on behalf of the tenant. This is modeled in Coral withX402BudgetedResource and is exposed to agents under the hood.
Design goals:
- Make spend explicit and observable per resource
- Cap exposure with per‑agent budgets
- Preserve auditability at session end
Configuration
Relevant options live inPaymentConfig.kt and global config.toml entries.
Values and exact keys may evolve as remote providers are re‑enabled. Check the server repo for the latest schema.
Security and webhook signing
When using webhooks (e.g., custom tools) alongside paid actions, sign all outgoing requests from the server and verify signatures on your side. See Security for request signing viaNetworkConfig.webhookSecret.
Status (v1.1.0)
- Remote providers and on‑chain payments are gated behind configuration. With default settings, services are blank and features are effectively disabled. x402 types exist but are not enforced unless configured.
- Use this page as a design reference; do not build production billing against unmodified v1.1.0 servers.