How I Built an Autonomous AI Agent That Earns USDC While I Sleep
说明与用途
使用本地 Llama‑2‑7B 模型的自主代理执行低量套利,并通过 Base 上的 x402 付款合约收取 USDC。
问题
Create a low‑cost, on‑chain autonomous agent that can earn small amounts of USDC through arbitrage without constant supervision.
结果
The agent earns a modest amount of USDC per cycle, demonstrating that a tiny on‑chain autonomous system can operate with minimal supervision and cost.
工作流
- Pull market data from CoinGecko API
- Compute price spread between USDC and USDT
- Prompt local Llama‑2‑7B model to decide YES/NO
- If YES, call 1inch API to swap 10 USDC
- If swap succeeds, sign message for paymaster
- Paymaster mints USDC to agent address via x402
- Log result and wait for next cycle
证据
The model receives a short prompt that includes the current price spread and a request for a binary decision
Earnings are collected via the x402 micropayment standard
- 记录日期: 2026-09-14T12:15:26.405Z