Every snippet on these pages is drop-in runnable. Set
PODFLARE_API_KEY
once (create one on the dashboard)
and each page has working code you can paste straight into your editor.What people actually build
Podflare sandboxes are hardware-isolated microVMs. That means each one is a full Linux box — you can install packages, spin up servers, mount filesystems, run ML inference, crawl websites, provision databases. In practice, five workflows come up over and over:Code-interpreter agents
Claude’s
code_execution tool, OpenAI Agents SDK’s function tools,
Vercel AI SDK’s tool(). One helper per framework, the same
isolated microVM underneath.Data & analytics
pandas / matplotlib chart-in-reply, DuckDB against remote CSVs and
parquet. No DB server, no infra per tenant.
Database work
Ephemeral Postgres per sandbox for testing generated SQL, RLS
policies, migrations. Local Supabase (Postgres + PostgREST +
Auth) for full-stack app testing.
Web automation
Headless Chromium via Playwright — scrape, screenshot, fill
forms. Boot a Next.js dev server and screenshot agent-generated
UIs.
Dev environments
Clone a branch, run tests, return results. Perfect drop-in for
PR-review bots and “run my test suite” agents.
Why a sandbox instead of running agent code locally
Four reasons that show up the moment you have real users:- Isolation. The agent is going to execute code that came from an LLM. You don’t trust the LLM with your production environment, your files, your credentials, or your network.
- Per-session state. Each user conversation gets its own
filesystem, installed packages, and process tree. No “did user A’s
pip installbreak user B’s session?” debugging. - Horizontal reset. When a session ends, the sandbox is gone — all state, all side effects. No cleanup scripts, no orphaned processes, no accumulated cruft.
- Speed. Warm-pool sandbox restore is ~12 ms on bare metal. The sandbox exists before your agent asks for one.
Pattern library
These are the small, composable patterns you’ll see in the examples. Most real agents are combinations of two or three of these:- One-shot exec — run a single snippet, return stdout/stderr/exit_code.
- Persistent REPL — keep the sandbox alive across agent turns; DataFrames and files survive.
- Fork-and-explore —
Sandbox.fork()spawns N copies of a running state so the agent can try N paths in parallel, then commit the winner back to the parent. - Upload / download — push input files in, pull output files out.
- Background services — boot Postgres / Next.js / an HTTP API inside the sandbox; tear down with the sandbox.

