all postsblog / ai agent sandboxes

blog

What Is Vibe Coding? (And Where the Generated Code Should Actually Run)

written by
Ajay Kumar
published
reading time
9 min read
topics

Vibe coding is writing software by describing what you want to a language model, accepting the code it produces without reading it closely, and iterating on behavior: run it, see what happens, tell the model what's wrong, repeat. You judge the program by whether it does the thing, not by what's in the diff. The phrase was popularized by Andrej Karpathy in February 2025 and spread fast, mostly because it named something a lot of people were already doing and felt slightly guilty about.

This post defines the term properly, separates it from its more disciplined cousins, and then spends most of its time on the part the definition skips: if nobody reads the code, something still runs it. Where that happens matters more than which model wrote it.

Vibe coding, defined without the vibes

Strip away the memes and vibe coding has three defining traits:

  • The spec is natural language. You say "make a habit tracker with a streak counter and dark mode," not "add a streak column and a reducer."
  • Review is skipped or skimmed. You may glance at the output, but you are not reading it line by line, and you probably couldn't defend every line in a code review.
  • The feedback loop is behavioral. Errors get pasted back into the chat. Wrong colors get described back into the chat. The model is the only one who has read the whole codebase, and it has also forgotten half of it.

None of that is inherently bad. For prototypes, internal one-offs, demos, and learning, it's a genuinely fast way to get from idea to working thing, and it lets people who don't write code professionally build tools they need. The honest critique isn't that vibe coding is lazy. It's that the trait which makes it fast, not reading the code, is the same trait that removes the last human checkpoint before the code executes.

Vibe coding vs AI-assisted coding vs agentic coding

These three get used interchangeably, and they shouldn't be. The useful axis is who reads the code and who runs it:

Three ways of writing code with a model
AI-assisted codingVibe codingAgentic coding
Who writes the codeYou, with autocomplete and suggestionsThe model, from your promptThe model, in a loop with tools
Who reads itYou, line by lineMostly nobodyIdeally you, at the PR; often nobody mid-loop
Who runs itYou, deliberatelyYou, hopefullyThe agent itself, many times per task
Feedback loopCompiler, tests, your judgment"It still doesn't work" pasted into chatTool results: test output, errors, file reads
Where it typically runsYour machineYour machine, or a hosted builder'sWherever the agent's shell lives

AI-assisted coding keeps you as the author; the model is a fast typist. Agentic coding hands the model tools, so it writes code, runs it, reads the error, and fixes it without waiting for you. I covered that loop in What Is an AI Agent? and won't repeat it. Vibe coding sits in between and borrows the riskiest property of each: the volume of an agent with the execution environment of a human, which usually means your laptop.

In practice the lines blur. Most vibe-coding tools now run commands for you, which makes them agents with a friendlier name. The question that survives the blurring is still the same one: when this code runs, what can it touch?

The real risk surface: running code nobody reviewed

The common worry is that the model writes buggy code. It will, and that's the least of it; bugs show up as behavior, and behavior is exactly what vibe coding watches. The dangerous failures are the ones that don't show up as behavior at all, because they happen during setup or quietly in the background. Here is what an unread project can do on the first run:

  • Install dependencies you never chose. A generated package.json or requirements.txt can list dozens of packages. Models also invent plausible package names that don't exist, and attackers register those names in advance so the install succeeds. This has a name now, slopsquatting, which tells you it happens often enough to need one.
  • Run install-time scripts. npm install executes preinstall and postinstall scripts from every package in the tree by default, and Python packages built from source run arbitrary code at build time. You haven't run the app yet and arbitrary code has already executed as your user.
  • Delete things. A cleanup step that does rm -rf "$BUILD_DIR/" with an unset variable is rm -rf /'s polite cousin. No malice required; a model trying to be tidy is enough.
  • Read your secrets. Code running as you can read ~/.ssh, ~/.aws/credentials, browser profiles, every .env file in your home directory, and the environment variables of the shell you launched it from, including the API key for the model that wrote it.
  • Phone home. Unread code can make network requests: analytics you didn't ask for, a dependency with a compromised release, or an exfiltration call that looks like any other HTTPS request.
  • Persist. A cron entry, a shell rc edit, a launch agent. The app gets deleted; the side effect doesn't.
Prompt injection makes this worse, not different. If the model read a README, an issue, or a web page while generating your code, whoever wrote that text had a vote in what the code does. You can't review your way out of code you aren't reviewing.

The pattern across that list: the blast radius is set by the environment, not the code. The same postinstall script is a catastrophe on a laptop with production credentials and a non-event in a box that holds nothing and is deleted in ten minutes. So the useful move isn't to make vibe coders read code (they won't; that's the point). It's to change where the code runs.

Laptop vs container vs microVM

There are three realistic places for generated code to run. They differ in what an escape, or just a bad command, can reach:

  • Your laptop — Reach: everything you can reach, which is your files, your keys, your logged-in sessions, your employer's VPN. Cleanup: manual, and you won't know what to clean. Fine for: code you've actually read.
  • A container on your laptop — Reach: much less by default, if you don't mount your home directory and don't pass your environment in (people do both, constantly, because it makes things work). The container still shares your host kernel, so a kernel bug or a misconfigured socket mount is a path out. A container is a polite suggestion to the kernel. Fine for: generated code you're fairly sure is benign, with nothing sensitive mounted.
  • A microVM — Reach: one disposable guest with its own kernel behind hardware virtualization. A destructive command trashes the guest; a kernel exploit has to break out of KVM, not just out of a namespace. Nothing of yours is inside unless you put it there. Fine for: code nobody has read, which is the definition of vibe coding.

I've made the long argument for that middle bullet in Why Docker Isn't a Sandbox, and the general version (what an agent sandbox is and what makes one good) in What Is an AI Agent Sandbox?. The short version for vibe coding: the default should be a fresh, empty, disposable machine per attempt, because the cost of being wrong on your laptop is unbounded and the cost of being wrong in a throwaway VM is one VM.

The objection is speed. Vibe coding is a tight loop, and nobody will tolerate waiting a minute for a VM each time the model rewrites the app. That used to be a fair objection. On PandaStack each create restores a pre-booted template snapshot, so a fresh Firecracker microVM is ready in about 179 ms at p50 (the very first spawn of a new template does a roughly 3 s cold boot, then the snapshot is baked and reused). That's faster than most dev servers take to print their banner, which removes speed as an excuse.

A practical safe loop: generate, sandbox, preview, keep or discard

Here's the loop I'd recommend to anyone vibe coding something that installs dependencies or runs a server, which is nearly everything:

  1. Generate. The model produces files. Your machine stores them as text and does not execute them.
  2. Sandbox. Create a fresh microVM, write the files in, and run install and build there. Install scripts, hallucinated packages, and tidy-minded rm -rf all happen in a box with nothing in it.
  3. Preview. Start the app inside the sandbox and open it through a preview URL. You judge the behavior, which is what vibe coding was going to do anyway, without the code ever running on your machine.
  4. Keep or discard. If it works, pull the source out (or snapshot the sandbox) and kill it. If it doesn't, feed the error back to the model and kill it anyway. The next attempt starts clean, so a broken attempt can't poison the next one.

With the PandaStack Python SDK, that loop is about forty lines. generate_files() stands in for whatever model call you use; it returns a dict of path to file contents. The base template ships Ubuntu 24.04 with Node 22, Python 3.12, Go, and Bun via mise, so a generated Vite or Express app runs without extra setup.

python
import time
from pandastack import Sandbox  # reads PANDASTACK_API_KEY from the env

from my_llm import generate_files  # your model call: prompt -> {path: contents}

prompt = "A habit tracker in React + Vite with a streak counter. Dev server on port 3000."

for attempt in range(1, 4):
    files = generate_files(prompt)

    # Fresh microVM per attempt. ttl_seconds is an IDLE timeout: if this
    # script dies, the sandbox reaps itself after 15 quiet minutes.
    sbx = Sandbox.create(template="base", ttl_seconds=900,
                         metadata={"job": "vibe", "attempt": str(attempt)})
    try:
        for path, contents in files.items():
            sbx.filesystem.write(f"/work/{path}", contents)

        # postinstall scripts and hallucinated packages run HERE, not on your laptop.
        install = sbx.exec("cd /work && npm install", timeout_seconds=300)
        if install.exit_code != 0:
            prompt += f"\n\nnpm install failed:\n{install.stderr[-2000:]}"
            continue

        # Start the dev server detached; its output goes to a log inside the VM.
        sbx.exec("cd /work && setsid nohup npm run dev -- --host 0.0.0.0 --port 3000 "
                 "> /tmp/app.log 2>&1 < /dev/null &")
        time.sleep(5)

        url = sbx.preview_url(3000)  # https://3000-<id>.<suffix>
        print(f"Attempt {attempt}: open {url}")
        verdict = input("keep / retry / quit? ").strip()

        if verdict == "keep":
            # Bring back the SOURCE (text), not node_modules, and read it this time.
            for path in files:
                data = sbx.filesystem.read(f"/work/{path}")
                print(f"--- {path} ({len(data)} bytes)")
            break
        if verdict == "quit":
            break

        log = sbx.exec("tail -n 50 /tmp/app.log").stdout
        prompt += f"\n\nIt runs but is wrong. Feedback: {verdict}\nServer log:\n{log}"
    finally:
        sbx.kill()  # discard: everything the attempt installed or broke is gone

A few details in there are doing real work. The model's API key lives in your script's process, not in the sandbox, so generated code can't read it. Install errors and server logs flow back into the prompt, which is the vibe-coding feedback loop running against a box that can't hurt you. And kill() sits in a finally, so a crash or Ctrl-C still discards the VM; the idle TTL is the backstop if your whole process dies.

A preview URL has no login: the sandbox UUID in the hostname is the credential, and anyone holding the link can open the app while the sandbox lives. That's convenient for sending a demo to a friend and a reason not to paste it into a public channel. If the app needs a real secret to work, use a scoped test key you can revoke, never the production one.

What a sandbox doesn't fix

Isolation bounds what unread code can do while it runs. It doesn't make the code good. Specifically:

  • Shipping it is a different decision. The moment you deploy vibe-coded output to real users with real data, "nobody read it" becomes a security posture. Read the code before production, or have something that can (tests, a reviewer, a static analyzer) read it for you.
  • Anything you put inside is exposed. If you write your cloud credentials into the sandbox so the app can deploy itself, the generated code can read them. The sandbox protects your machine, not secrets you hand to it.
  • Network access is still a choice. A sandbox with open egress can still be used to send things outward or hammer someone else's API. See Controlling Network Egress for Untrusted Code for how to think about locking that down.
  • It doesn't review dependencies. A malicious package that runs harmlessly in your sandbox will run less harmlessly in production. The sandbox buys you a safe place to find out what the code does, not a guarantee about what it will do later.

None of these are reasons to skip the sandbox. They're reasons to treat it as the floor: vibe code all you like, but let the unread code run somewhere that's built to be thrown away. For the fuller operational checklist (resource limits, timeouts, egress, teardown), see How to Run AI-Generated Code Safely: a 2026 Playbook.

faq

Frequently asked questions

What does vibe coding mean?

Vibe coding means building software by prompting a language model in natural language, accepting the code without reading it closely, and iterating based on whether the program behaves correctly. The term was popularized by Andrej Karpathy in February 2025.

Is vibe coding the same as agentic coding?

Not quite. Agentic coding gives the model tools so it can run code, read results, and fix errors in a loop on its own. Vibe coding describes the human side: not reviewing the code and steering by behavior. Many vibe-coding tools now run commands for you, so in practice the two overlap, and both run code no human has read.

Is vibe coding safe?

The coding part is as safe as where the code runs. Generated projects install dependencies, run install-time scripts, and execute with whatever permissions the environment has. On your laptop that includes your files, SSH keys, and credentials. In a disposable microVM with nothing sensitive inside, a bad run costs you one throwaway VM.

Where should I run vibe-coded apps?

Run generated code in a fresh, isolated sandbox per attempt, ideally a microVM with its own kernel, and look at the result through a preview URL. Keep your model API keys and production credentials outside it. Only move code to production after someone or something has actually reviewed it.

Isn't a Docker container enough for vibe coding?

It's much better than your bare laptop if you don't mount your home directory or pass your environment in. But a container shares the host kernel, so it's a weaker boundary for code nobody has read. A microVM gives each run its own guest kernel behind hardware virtualization.

links

Keep reading

more posts

Related posts

  • PandaStack vs AWS Lambda for Running Untrusted / LLM-Generated Code

    AWS invented Firecracker, so the isolation argument is over before it starts. The real question is whether a function-shaped deployment unit fits code an LLM wrote thirty seconds ago.

  • Firecracker vs WebContainers: where should untrusted code run?

    One runs code inside the user's browser tab and costs you nothing. The other runs a real guest kernel on a machine you pay for. The choice comes down to two questions: does the code need real Linux, and is there a human browser in the loop?

  • Sandboxing AI-Agent Spreadsheet Automation

    "quarterly_report.xlsx" is a file format that can phone home, fork-bomb your converter, and run pandas code an LLM wrote five milliseconds ago. When your agent transforms user spreadsheets, give each job its own disposable microVM.

  • What Coding Agents Actually Need From a Sandbox

    Most sandbox comparisons start from the sandbox's feature list. Start from what the agent actually does all day and you end up with a different, shorter, more annoying list.

  • A Zero-Trust Architecture for Executing Untrusted Code

    Zero-trust means you don't trust the code, and you REALLY don't trust the code an LLM wrote at 2am. Here's how the standard zero-trust principles — assume breach, least privilege, microsegmentation, short-lived creds — map onto concrete controls for running untrusted code.

More in AI agent sandboxes · See AI agent sandboxes on PandaStack

pandastack

Run code in a microVM in one API call.

50–100 ms cold start. Fork, snapshot, and scale to zero.

measured on the host; your network round trip is extra