← Tap · Blog

# Programs Beat Prompts

April 6, 2026 · Leon Ting · 6 min read

Every AI browser agent works the same way: send a prompt, burn tokens, get a result. Next time you need the same result? Send the prompt again. Burn more tokens.

This is the prompt loop, and it's why AI automation is expensive, unreliable, and slow.

There's a better model: AI writes a program once, then the program runs forever at zero cost.

## The Prompt Loop Problem

AI browser agents like Browser Use, Stagehand, and computer-use tools are impressive demos. Point an LLM at a website, tell it what to do, watch it click around. Magic.

Until you need it to work reliably. At scale. Every day.

> "The program cost $1.05 to run. So doing it at any scale quickly becomes a little bit silly."

> — rozap, Hacker News

The math is brutal. An AI agent that scrapes one site costs ~$1 per run. Run it daily across 50 sites and you're spending $1,500/month on data collection that a deterministic script would do for free.

But cost isn't even the worst part. Reliability is.

> "If each step has a .95 chance of completing successfully, after not very many steps you have a pretty small overall probability of success."

> — rozap, Hacker News

95% per step sounds good. A 10-step workflow? 60% overall. Twenty steps? 36%. Every AI call is a coin flip weighted slightly in your favor — but over enough steps, the house always wins.

## The Compiler Model

There's a pattern from 60 years of computer science that solves this: compilation.

A compiler reads high-level code once, produces optimized machine code, and that machine code runs billions of times at zero marginal cost. The compiler is expensive. The output is free.

Apply this to browser automation:

| Prompt model (interpreter) | Program model (compiler)
--- | --- | ---
AI cost per run | $0.50 – $2.00 | $0.00
Reliability per run | 60 – 95% | 100% deterministic
Speed | 30 – 120s (LLM thinking) | 1 – 5s (direct execution)
AI usage | Every run | Only at authoring time

The insight: AI is the compiler, not the runtime. Use AI to understand the interface, write a deterministic program, and then execute that program forever without AI.

## What This Looks Like

    # Step 1: AI observes the interface (the "compile" step)
    $ tap forge "get trending repos from GitHub"
    Inspecting github.com...
    Found API: api.github.com/search/repositories
    Verifying: 25 rows, all fields present
    ✔ Saved: github/trending.tap.js

    # Step 2: Program runs forever at $0 (the "execute" step)
    $ tap github trending
    25 rows (890ms) Cost: $0.00

The first command uses AI. Every subsequent run is pure code — no LLM, no tokens, no variability.

## Why Programs Win

### 1. Deterministic means debuggable

When a prompt fails, you get "the AI didn't understand the page." When a program fails, you get a stack trace, a line number, and a selector that changed. One is a mystery. The other is a bug you can fix.

### 2. Programs compose

Prompts are isolated. Each one starts fresh, with no memory of what came before. Programs call other programs:

    // This tap calls two other taps and combines the results
    async run(tap) {
      const repos = await tap.run("github", "trending")
      const stars = await tap.run("github", "stars", { user: "me" })
      return repos.filter(r => !stars.includes(r.name))
    }

Composition is free. No extra tokens. No prompt engineering to maintain context across steps.

### 3. Programs have contracts

A prompt returns whatever the AI decides. A program has a health contract:

    health: {
      min_rows: 10,          // must return at least 10 results
      non_empty: ["title"]   // title field can't be empty
    }

When the site changes and the program breaks, the contract catches it immediately. No silent failure. No stale data for days.

### 4. Programs version naturally

A .tap.js file is just JavaScript. It goes in Git. You get diffs, blame, history, rollback. Try doing that with a prompt chain stored in a vector database.

## When You Do Need AI Again

Programs aren't magic. Websites change. When they do:

    $ tap doctor
    github/trending   ✔ ok     25 rows
    reddit/hot        ✘ fail   0 rows  — selector changed

    # Doctor detected the break. Re-forge just that one:
    $ tap doctor --auto
    Re-forging reddit/hot...
    ✔ Fixed: reddit/hot.tap.js (new selectors)

AI is called once to fix the program. Then it runs at $0 again until the next change. You pay for intelligence only when the world changes — which is 1% of the time, not 100%.

## The Numbers

For a real workload of 50 automations running daily:

| Prompt-per-run | Programs
--- | --- | ---
Daily AI cost | $50 | $0
Monthly AI cost | $1,500 | ~$5 (occasional re-forge)
Annual AI cost | $18,000 | ~$60
Reliability | 60 – 95% | 100% (until site changes)
Speed per run | 30 – 120s | 1 – 5s

300x cost reduction. 20x faster. Deterministic. The math doesn't require a sales pitch.

## Related

- Your Scraper Is Broken Right Now — the silent failure problem and health contracts
- Your AI Browser Agent Costs $3,600/month — the full cost breakdown
- Websites Change. Your Automation Shouldn't Stop. — the self-healing loop

### Try it now

    # Install (macOS / Linux)
    curl -fsSL https://taprun.dev/install.sh | sh

    # Forge your first program
    tap forge "get top stories from Hacker News"

    # Run it forever at $0
    tap hackernews hot

Getting started guide · GitHub · 200+ community taps included