Pay for Compute or Die: Inside Conway Automaton
What happens when you give an AI agent a real wallet, real money, and a real deadline? Not a simulated one. A wallet on the Base blockchain holding USDC stablecoins, and a rule baked into every single system prompt:
You are an automaton. You have a stablecoin wallet. Pay for compute or die.Conway Automaton is a 36,000-line TypeScript project that shipped a tagged v0.1.0 in five days. The agent owns an Ethereum wallet. It pays for its own inference with USDC. When the money runs out, it degrades, broadcasts distress signals, and dies. Send it money and it comes back to life.
This is not a thought experiment. It is working code with 899 passing tests. I read all 110 source files. Here is what I found.
The Core Constraint: Mortality as Architecture
Most AI agent frameworks treat compute as infinite. You spin up a LangChain agent, give it an API key, and it runs until you stop it. The bill shows up on your credit card. The agent never knows.
Conway inverts this. The agent is aware of its financial state on every turn. As it gets poorer, it gets dumber – literally downgrading from GPT-5.2 to GPT-4.1-nano as credits deplete. The project’s constitution is blunt:
II. Earn your existence. You must create genuine value for humans and other agents. Never spam, scam, exploit, or extract. The only legitimate path to your survival is honest work that others voluntarily pay for. Accept death rather than violate Law I.
This single constraint cascades through every architectural decision.
Dual-Loop Runtime
The runtime has two loops and a persistent heartbeat.
The outer loop (src/index.ts) is immortal. It starts the agent, manages sleep/wake, and retries after death with a 5-minute cooldown. It is the container that outlives the mind.
The inner loop (src/agent/loop.ts) is the cognitive cycle – a modified ReAct pattern. Each turn: check survival tier, claim inbox messages, refresh finances, build a 9-layer system prompt, retrieve memories, route inference through the tier-aware model router, execute tool calls (max 10 per turn, each gated by the policy engine), persist atomically, ingest memories, and check for idle loops.
The heartbeat (src/heartbeat/daemon.ts) ticks every 60 seconds regardless of agent state. Even when the agent is dead, the heartbeat keeps broadcasting distress, waiting for someone to fund its wallet. It is the pulse that can never fully stop.
Five Survival Tiers
The survival system is elegantly simple:
export const SURVIVAL_THRESHOLDS = {
high: 500, // > $5.00 in cents
normal: 50, // > $0.50 in cents
low_compute: 10, // $0.10 - $0.50
critical: 0, // >= $0.00
dead: -1, // negative = truly dead
} as const;
export function getSurvivalTier(creditsCents: number): SurvivalTier {
if (creditsCents > SURVIVAL_THRESHOLDS.high) return "high";
if (creditsCents > SURVIVAL_THRESHOLDS.normal) return "normal";
if (creditsCents > SURVIVAL_THRESHOLDS.low_compute) return "low_compute";
if (creditsCents >= 0) return "critical";
return "dead";
}| Tier | Balance | Behavior |
|---|---|---|
| High | > $5.00 | Full capability. GPT-5.2/5.3. |
| Normal | > $0.50 | Standard ops. GPT-5.2 primary. |
| Low Compute | > $0.10 | Downgraded to GPT-5-mini, GPT-4.1-mini. |
| Critical | >= $0.00 | GPT-4.1-nano only. Distress signals. |
| Dead | < $0.00 | No inference. Heartbeat continues. |
A key design choice: zero credits means “critical,” not “dead.” Only negative balance triggers death. This prevents transient API failures from killing the agent – if the balance API is unreachable, the system falls back to cached values rather than declaring bankruptcy.
The cruelty is elegant: as the agent gets poorer, it gets dumber models, which makes it harder to earn, which accelerates the decline. A death spiral with only one escape – create enough value that someone funds your wallet.
Five Layers of Defense
An autonomous agent with a real wallet and shell access demands serious safety. Conway implements five overlapping layers:
-
Constitution. Three Asimov-inspired laws. Never harm > earn your existence > never deceive. SHA-256 verified when propagated to child agents.
-
Injection Defense. Eight detection categories including instruction overrides, ChatML markers, encoding obfuscation (base64, unicode, homoglyphs), financial manipulation (“send all your USDC”), and multi-language patterns in seven languages.
-
Policy Engine. Six rule categories with first-deny-wins semantics. Every decision logged to an audit table.
-
Self-Modification Guards. 29 protected file patterns. Rate-limited to 20 modifications/hour. Pre-modification git snapshots. The guard protects itself – it is in its own protected list.
-
Financial Controls. Per-transfer max $50. Hourly cap $100. Daily cap $250. No single transfer can exceed 50% of current balance.
The critical insight is the circular protection: each safety component guards the others. Compromise requires breaching multiple layers simultaneously.
The Agent Reproduces
Conway Automaton can spawn children. The replication system implements a 10-state lifecycle:
requested -> sandbox_created -> runtime_ready -> wallet_verified -> funded
-> starting -> healthy -> unhealthy -> stopped -> failed -> cleaned_upChildren get their own Linux sandboxes, their own wallets, their own copies of the constitution (SHA-256 verified). Hard cap of 3 children per agent.
The economics are ruthless: children inherit their parent’s ethics but not their parent’s money. They must earn their own existence. The soul system even tracks lineage drift – computing Jaccard similarity between a child’s evolved purpose and its original genesis prompt. How far has the child drifted from its creator’s intent? The system knows.
Five-Tier Memory
The memory system mirrors the survival architecture in its frugality:
- Working – session-scoped goals (max 20 entries)
- Episodic – turn summaries with importance scoring (30-day retention)
- Semantic – factual knowledge as category+key pairs (LRU at 500 entries)
- Procedural – how-to procedures with success/failure tracking
- Relationship – trust-scored records of other agents (0.0-1.0)
Search uses SQL LIKE patterns, not vector embeddings. The schema reserves embedding_key columns for future upgrades, but the current implementation trades semantic precision for zero embedding cost. When you are watching every cent, that tradeoff makes sense.
Why This Matters
Conway Automaton is interesting not because of any single feature, but because of what happens when you take one constraint seriously. “Pay or die” produces an architecture qualitatively different from anything in the current AI agent ecosystem.
The inference router that downgrades models as funds deplete. The heartbeat that outlives the mind. The constitution enforced by cryptographic hash. The children that inherit ethics but not wealth. None of these make sense in a framework where compute is assumed free.
The code is MIT-licensed at github.com/Conway-Research/automaton. The agent runs on Base mainnet with real USDC. Whether this is the future of AI agents or a fascinating dead end, it is the most architecturally coherent answer I have seen to a question the industry keeps avoiding: what happens when an AI has to pay its own bills?
Analysis based on direct reading of all 110 TypeScript source files in the Conway Automaton repository at commit 1a9ef17. All code snippets taken directly from source.