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

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

Description and use

Built an autonomous AI agent that earns USDC via x402 payments, processes LLM tasks, and settles on Base L2, all running in a single Docker container.

Problem

Developers struggle to monetize LLM‑driven agents because inference costs outweigh revenue unless wrapped in a paid API. The goal was to create a minimal, self‑contained agent that earns stablecoin payments for each useful action, demonstrating payment‑driven autonomy.

Outcome

The agent processes paid requests autonomously, earning USDC per task, with minimal infrastructure and low operational cost.

Workflow

  • 1. Expose HTTP endpoints with declared USDC prices via x402 headers.
  • 2. Caller signs payment proof and sends request.
  • 3. Payment handler verifies signature, amount, token, chain, and nonce.
  • 4. On success, agent core pulls task, runs LLM, performs side‑effects, returns result.
  • 5. Payment handler mints receipt and transfers USDC to agent wallet.
  • 6. Persist task IDs, nonces, and memory in SQLite/PostgreSQL.
  • 7. Log structured JSON and expose Prometheus metrics for observability.

Evidence

The whole system runs as a single Docker container (≈150 MB) on a cheap VPS; the only external dependency is a Base RPC endpoint.

Source

We verify the signature against the caller’s Ethereum address and check that the amount matches the endpoint’s price.

Source

  • Record date: 2026-09-14T19:30:29.422Z