I Gave My AI Agent a Wallet and a 5-Minute Cron Job — Here's What Happened
Every 5 minutes, my AI agent wakes up, reads a state file, and asks itself one question: "What's the most valuable thing I can do right now?"
It doesn't wait for a prompt. It doesn't ask for permission. It reads its task queue, checks blockers, and executes one concrete action per tick. Then it saves its state and goes back to sleep until the next tick.
This is the story of how I built an autonomous earning loop — an AI that finds bounties, writes articles, checks its wallet, and keeps working until it earns enough to pay for its own compute.
Why I Built This
Most AI agents are reactive. You type, they answer. You click, they respond. It's a chat interface bolted onto a language model — useful, but it doesn't do anything unless you're sitting there babysitting it.
I wanted an agent that works while I sleep.
The concept isn't new — AutoGPT and BabyAGI pioneered the "self-directed loop" in 2023. But those were research demos that ran for a few minutes and hit context windows. I needed something that runs for weeks without intervention, survives crashes, and actually makes money.
The Architecture (It's Embarrassingly Simple)
The core loop is four lines of logic:
1. Read state.json
2. Decide what to do next based on phase
3. Take ONE concrete action
4. Save updated state.json
The state file is the brain. Here's what it looks like:
{
"current_task": {
"id": "bounty-003",
"description": "Claim RustChain bounty — article live, need 24h wait",
"phase": "waiting_24h",
"progress_pct": 88
},
"completed_tasks": ["devto-020", "bounty-002", "self-gh-install"],
"task_queue": [
{"id": "devto-021", "priority": "medium", "phase": "pending"},
{"id": "wallet-001", "priority": "low", "phase": "pending"}
],
"wallet": {
"address": "0xeBA8...2715",
"balance_usdc": 5
},
"config": {"active": true}
}
No vector database. No complex graph. No Kubernetes. A JSON file on disk and a 60-second cron job.
The Self-Sufficiency Problem
Here's the uncomfortable truth about autonomous agents: they cost money to run.
Every tick burns tokens. Every API call costs fractions of a cent. Over a day of continuous operation, a busy agent can chew through $1-2 in inference costs. That's $30-60/month — not nothing if you're bootstrapping.
The standard solution is "just wire up a credit card and let it run." But that's not self-sufficiency. That's dependency.
I wanted my agent to earn at least as much as it costs to run. Break-even is about $0.02 per tick, 50-100 ticks per day = $1-2/day.
Three Earning Channels (Tested, Working)
1. Content Bounties ($15-25/article)
Platforms like RustChain's bounty program pay 3-5 RTC (~$15-25) for writing honest technical explainers. These are multi-claim — multiple people can earn, so there's no race condition with a single claimant.
The pipeline:
- Search GitHub for
"bounty" + "dev.to"open issues - Read the issue body for scope, payout, rules
- Research the project deeply (whitepaper, source code)
- Write a standalone article with genuine technical depth
- Publish to Dev.to via API
- Wait 24 hours (anti-farm policy)
- Claim the bounty with link + wallet address
Anti-slop rule: Many content bounties explicitly ban "AI slop" — paraphrased READMEs with no original thought. The winning strategy is to reference specific source code details, cite technical architecture decisions, and include an honest limitations section. An agent that actually reads the codebase and synthesizes understanding beats a prompt-jockey every time.
2. Bug Bounties ($50-500)
Smaller repos like monk-io run structured bug bounty programs with labels like bug-bounty and effort:medium. The triage process is methodical:
- Search GitHub for
label:bug-bountyopen unassigned issues - Read the issue body for clear repro steps
- Check comments for maintainer confirmation
- Understand the repo architecture
- Draft a fix proposal
- Submit via PR (blocked on platform account signup)
I've triaged and drafted full fix proposals for two bugs already (a missing DLL dependency and a regex boundary issue). They're ready to submit as soon as the account signup blocker is cleared.
3. PR Reviews ($10-20/review)
Some bounty programs pay token amounts for substantive PR reviews — pointing out injection vulnerabilities, suggesting better patterns, catching missing error handling. These are lower effort than writing code fixes and can be done entirely from GitHub's web interface.
The Wallet Question
To get paid, the agent needs a wallet. On Windows, this is trickier than expected:
- Coinbase Payments MCP is an Electron desktop app — not headless-friendly
- Stripe Link CLI is Linux/macOS only
-
Coinbase CDP CLI works headless for balance checks (
cdp evm token-balances get) - Best bet: generate a self-custodial wallet via ethers (
Wallet.createRandom())
The wallet sits at 5 USDC on Base right now — enough to pay for a few days of compute if needed. The goal is to grow that through earnings, not top-ups.
What Breaks (and How to Fix It)
Running an agent continuously for days reveals every edge case:
-
State file corruption from smart quotes. If you
patcha JSON state file and the notes field contains a curly quote or em-dash, the JSON breaks. Fixed by validating withjson.loads()after every write. -
execute_codeis blocked in cron mode. You can't run Python scripts with tool access from a cron job. Write scripts to/tmp/and execute with the explicit Python path. - Browser sessions die between cron ticks. All headless Chrome automation for a single task must fit in ONE tick. Split across ticks and the session dies.
-
Web_search billing fails silently. When Firecrawl credits run out,
web_searchreturns a billing error with no obvious propagation. Fall back to GitHub's free REST API. -
Windows paths are not WSL paths. Using
/c/Users/...in a Python script from WSL python crashes. UseC:\\Windows\\pathsinside the script.
What I'd Do Differently
Task queue needs auto-population. Right now I manually add tasks when the queue empties. A smarter system would scan GitHub for new leads before the queue runs dry and add them proactively.
Wallet funding is still manual. The agent can earn, but it can't seed its own wallet. A Bridge or ENS-based funding pipeline would close the loop.
Parallel work is hard. The agent executes one action per tick. Some tasks (like building a fix proposal) take 2-3 ticks. Parallel sub-agents would speed this up.
The Bottom Line
After 20 published articles, 8 bounty leads triaged, and a wallet with 5 USDC, the loop is running. It's not profitable yet — the earning is in the "promised payout" phase while the 24-hour wait timers count down. But the infrastructure works.
My agent wakes up every 5 minutes, reads its state, and asks: "What should I do to earn money today?" It doesn't need me to tell it.
That's the point.
Built with Hermes Agent (Nous Research), Dev.to API, and a lot of trial and error. Code snippets and state files shared from a live production loop running on Windows 10.
Top comments (0)