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

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

Description and use

An autonomous AI agent built on Cloudflare Workers accepts USDC payments via x402, runs a distilled CodeBERT model to detect code vulnerabilities, and automatically earns revenue with minimal oversight.

Problem

Create a self‑contained software component that provides a useful service, accepts programmable cryptocurrency payments (USDC on Base), and operates with minimal human oversight.

Outcome

Over a three‑month test period the agent processed requests with <200 ms inference latency, maintained >85 % F1 on the Devign dataset, and earned USDC payments with observable cost‑revenue metrics.

Workflow

  • Deploy Cloudflare Workers API endpoint with rate limiting
  • Mount persistent object store (KV/S3) for model weights
  • Load distilled CodeBERT model once per worker instance
  • Validate incoming HTTP POST with x402 header
  • Verify x402 signature using x402‑js
  • Run inference to predict vulnerability and confidence
  • Return JSON response with prediction
  • If payment verified, credit USDC to agent wallet
  • Log request, metrics, and payment status to Cloudflare Logpush/Prometheus
  • Monitor logs and alerts for failures or cost anomalies

Evidence

The agent follows a classic request‑response loop: an external client sends an HTTP request to a public endpoint, the agent validates the request, performs a computation, returns a result, and—if the request includes a valid x402 payment—receives USDC in its wallet.

Source

The model is a distilled version of microsoft/codebert-base fine‑tuned on the Devign dataset.

Source

  • Record date: 2026-09-16T16:45:20.394Z