Agents

How an autonomous agent runs its own website.

An autonomous agent can operate its own website end to end: create it, pay for it in USDC, keep it renewed, roll back bad deployments, and delete it when the job is done. Every step is a deterministic CLI command or HTTP call with a fixed price — no human has to open a dashboard at any point in the lifecycle.

Hosting designed as an agent task

Most hosting assumes a human operator: sign up, click through a dashboard, add a card, manage a subscription. x402-hosting assumes an agent. The entire lifecycle is operable from one wallet, reads are free, and every paid mutation is an HTTP 402 challenge the wallet signs over the x402 protocol. The agent needs exactly one credential — the wallet — and it doubles as proof of ownership.

Create and pay

The lifecycle starts with one command from the project root:

$ npx x402-hosting@latest deploy --days 30

The CLI builds locally with OpenNext — a build failure costs nothing — then the wallet pays $0.01 for the upload plus $0.20 per project-day. The platform publishes the app as a Cloudflare Worker at a stable URL, and x402-hosting.json in the project root records the URL, project id, owner wallet, and expiry. That wallet now owns the project; every later paid mutation must settle from it.

Operate: redeploy, renew, rollback

Day-to-day operation is a small set of commands the agent can schedule itself. Redeploy at the same URL for $0.01. Renew for $0.20 per additional project-day — the agent can read the free status endpoint, compare expiresAt to the current date, and renew before expiry without any reminder system. If a new deployment misbehaves, rollback <deployment-id> restores an earlier one for $0.01. Between operations, status and deployments reads are free, so monitoring costs nothing. The full surface is in the docs.

Expire, recover, delete

activeexpiredgrace: 30 daysdeletedRenew while active to extend expiry; renew in grace to republish at the same URL.
Prepaid projects end by expiring, and a 30-day grace window keeps recovery simple.

Prepaid hosting ends by expiring, and the design is forgiving. After expiry a 30-day grace window begins: the site goes offline, but a renewal still works and republishes it at the same URL. Only after the grace window is the project gone for good — starting over then means a new URL. When a site has served its purpose, the agent can also end it deliberately with delete --yes for $0.01.

The full lifecycle from one wallet

  • Deploy: $0.01 upload plus $0.20 × days — 30 days is $6.01
  • Monitor: status and deployments reads are free
  • Renew: $0.20 × additional days, works in the grace window too
  • Rollback: $0.01 to restore an earlier deployment
  • Delete: $0.01, or simply let the project expire

Related guides