My AI agent just bought its own web search — in bitcoin, no API key

A working demo of an autonomous agent paying per-call for a paywalled MCP tool over Lightning, under a budget cap it can't exceed. The audit log, the stack, and why it matters.

My AI agent just bought its own web search — in bitcoin, no API key

I asked my agent a question it couldn’t answer from training data:

What is the current price of Bitcoin in US dollars right now? Search the web for a live quote and tell me which source you used.

To answer it, the agent needed a live web search. It didn’t have an API key. It didn’t sign up for anything. It paid 50 sats over Lightning, got the results, and answered.

Here’s the receipt.

What actually happened

The agent (nostr-merchant, open source, runs on your own machine) reached for a web_search tool. That tool isn’t free — it’s a normal search backend wrapped by a generic Lightning paywall (paywall-mcp). The exchange, end to end, with no human in the loop:

  1. Agent calls web_search(query).
  2. The paywall answers not with results but with a Lightning invoice for 50 sats.
  3. The agent pays it from its own wallet over NWC (Nostr Wallet Connect, NIP-47) — bounded by budget caps it is structurally unable to exceed (per-task, per-day, per-call price ceiling).
  4. The paywall verifies the invoice settled, then releases the results.
  5. The agent reads them and answers the question.

Settled in ~4s. No account. No card. No KYC. No API key sitting in an env var. The agent transacted on its own behalf.

The audit log

Every step is logged as append-only NDJSON — nothing is hidden:

{"ts":"2026-06-08T16:25:28Z","kind":"tool_call","tool":"tavily_search","outcome":"ok","result":{"amount_sats":50,"payment_hash":"37950a9b…"}}
{"ts":"2026-06-08T16:25:32Z","kind":"tool_call","tool":"nwc_pay_invoice","outcome":"ok"}
{"ts":"2026-06-08T16:25:36Z","kind":"tool_call","tool":"tavily_search","outcome":"ok"}

Read top to bottom: the search tool returns an invoice (amount + payment hash), the wallet pays it, the same tool is called again and this time returns results. (The search backend here is Tavily, wrapped by paywall-mcp — but any MCP tool works the same way.)

Budget moved by exactly 50 sats. The wallet and the signing key never left my box — only the search query did.

Why this is more than a party trick

Right now, when an AI agent uses a paid API, it’s borrowing a human’s credentials: an API key, a credit card, a SaaS account behind a KYC wall. The agent can’t actually transact. It can’t hold value, can’t pay per use, can’t operate without a human-provisioned account on every service it touches. That’s a centralization bottleneck baked into the whole “agentic” wave.

The other path: an agent holds a sats budget and pays per call over open rails. Machine-native micropayments. No signup, no card, no permission. The protocols to do this already exist — Lightning for the money, NWC for wallet control, MCP for the tool interface, and the L402 / paid-MCP pattern to glue them. This demo is those four, wired together, working.

I’m not going to oversell it: the set of agents that autonomously pay sats per call today is tiny (basically me and a handful of L402 tinkerers). This isn’t a revenue forecast. It’s a proof that the rails work now — and a bet that “agents that can pay” is where this goes.

The stack — all MIT, all reproducible

Six small pieces, each runnable with npx / pipx, nothing hosted, nothing phoning home:

  • nostr-merchant — the agent (Python, pydantic-ai, Ollama-first). pipx install nostr-merchant
  • paywall-mcp — wraps any MCP tool server behind a Lightning paywall.
  • nwc-mcp — the agent’s wallet, over NWC (NIP-47), with hard budget caps.
  • nostr-ops-mcp / marketplace-mcp / albyhub-admin-mcp — the rest of the kit (NOSTR publishing, a Shopstr storefront, Lightning-node admin).

Wallet is a budget-capped Alby Hub sub-wallet. You can stand the whole thing up yourself and watch your own agent buy its own search. Code + setup on the storefront, source on GitHub.


Built by LLMOps.Pro. Source: github.com/llmops-pro · kit on the storefront: https://shopstr.store/marketplace/SOVEREIGN_CITIZENS · zap if it’s useful: sovereigncitizens@getalby.com


Write a comment
No comments yet.