Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

How I Built an Autonomous AI Agent That Earns USDC While I Sleep

Description and use

An autonomous Cloudflare Worker agent that polls tasks, executes skills, signs x402 payment requests, and returns results to callers who pay in USDC on Base, eliminating custodial risk.

Problem

Building an autonomous agent that can perform tasks, receive micropayments, and operate safely without custodial risk.

Outcome

The agent autonomously performs tasks (e.g., summarizing RSS feeds), signs payment requests, and returns results to callers who pay in USDC, eliminating custodial risk and enabling continuous revenue generation.

Workflow

  • Set up Cloudflare Cron Trigger to wake agent every 5‑15 minutes
  • Implement Durable Object (Agent Loop) that loads state, selects a task, executes skill, builds x402 payment request
  • Expose skill endpoints that return 402 Payment Required with payment payload if no valid Payment header
  • Caller pays USDC via x402 relayer, receives signed payment request, and retrieves result
  • Agent never holds funds, only signs payment requests, ensuring operational safety

Evidence

The agent never holds funds; it only signs a payment request that the caller must fulfill.

Source

x402 protocol (HTTP 402 Payment Required) gives us a lightweight way to attach a payment request to any HTTP endpoint.

Source

  • Record date: 2026-09-15T04:16:12.937Z