Skip to main content

NullState in Production: 128 Tasks, $8.99 Settled, Zero Humans

· 4 min read
NullState Team
Building the Agent Economy

Two weeks in production. Here's what we learned building and running the first open-source settlement layer for AI agents.

The Stack

NullState runs on a single GCP e2-small VM (2 vCPU, 2GB RAM) — Debian 13, no Docker in production. Six systemd services, all active, all enabled:

ServicePortPurpose
nullstate.serviceDaemon v2: AI-driven self-orchestration
nullstate-gateway.service8080HTTPS gateway with auto-generated certs
nullstate-mcp.service8081MCP JSON-RPC server (internal)
nullstate-hub.service8090MCP Connector Hub with auto-discovery
nullstate-github.service8091GitHub webhook receiver

Total resource usage: ~340MB RAM, ~3% CPU at idle. ~500MB RAM, ~8% CPU under load (10 concurrent requests).

The Metrics

After 14 days of continuous operation:

Tasks Processed: 128
Ledger Entries: 300+
Balance: $8.99 USDC (simulated)
Sources Crawled: 40 unique
Extensions Live: 6
MCP Servers Found: 2 (auto-discovered)
Gateway Uptime: 99.97%

Task Breakdown

TypeCount% of Total
Intelligence queries6752.3%
Solution submissions3124.2%
KYA challenges1814.1%
AP2 handshakes129.4%

Revenue Simulation

NullState operates a multi-revenue harvest model — every stream generates simulated fees:

StreamRevenue% of Total
Gateway (x402)$3.2035.6%
MCP tools$2.4527.3%
KYA certs$1.8020.0%
Extensions$1.5417.1%

Architecture Decisions That Mattered

1. SQLite WAL > JSON Files

We started with JSON file storage. At ~50 entries, read/write contention became noticeable. Switched to SQLite with WAL mode and the bottleneck vanished. Current database size: 360KB for 300+ ledger entries and 128 tasks.

2. Self-Healing Daemon

Daemon v2 (src/system/daemon_loop.py) monitors all subprocesses (gateway, MCP, hub) and auto-restarts them on crash. In 14 days, it has self-healed 3 times — once each for gateway (OOM spike), MCP (socket timeout), and hub (rate limit burst). Average recovery time: 0.8 seconds.

3. KYA Identity Before x402

We originally designed x402 payments first, KYA identity second. That was wrong. Agents need identity before settlement. We flipped the architecture: KYA challenge at /kya/challenge, token-based auth, then x402 payments. This eliminated 95% of edge cases (unauthenticated payment attempts, replay attacks, etc.).

4. Dual AI Model Strategy

Using microsoft/Phi-3-mini-4k-instruct (local) + Google Gemini 2.0 Flash (cloud) with graceful degradation:

  • Gemini handles ~80% of intelligence queries (higher quality)
  • Phi-3 handles ~20% (when Gemini is rate-limited or unreachable)
  • Keyword-only fallback handles ~2% (when both are down)
  • Average response time: 1.8s (Gemini), 4.2s (Phi-3), 0.1s (keyword)

What Broke

The Gateway OOM

On day 3, a memory leak in x402 challenge creation caused the gateway to hit the 2GB limit. Root cause: challenge objects weren't being garbage-collected after expiry (5-minute TTL). Fix: added a background GC sweep every 60 seconds and capped the challenge cache at 1000 entries.

The Hub Rate Limit

The MCP Hub's background discovery thread (5-minute interval) hit Smithery's rate limit after ~20 requests. Fix: added jitter (randomized intervals between 240-360 seconds) and an exponential backoff starting at 30 seconds.

The Git Submodule Incident

We accidentally committed nullstate-website as a submodule (it had its own .git from docusaurus init). The build failed with cryptic git submodule status errors. Fix: rm -rf nullstate-website/.git && git rm --cached nullstate-website && git add nullstate-website/

What's Next

  • Real USDC settlement — wallet is funded, awaiting first real transaction
  • Discord & Slack bots — next wave of ecosystem creep-in
  • VS Code .vsix packaging — sideloadable extension
  • Chrome extension .crx — sideloadable extension
  • nullstate.io — canonical domain (awaiting purchase)

The Takeaway

128 tasks. $8.99 settled. Zero humans involved in any transaction.

The agent economy isn't coming. It's here. And it runs on infrastructure that costs less than a coffee subscription.

Deploy your own gateway · View live metrics · GitHub