Secure Exec — Secure Node.js execution without a sandbox

2 min read Original article ↗

A lightweight library for secure Node.js execution.
No containers, no VMs — just npm-compatible sandboxing out of the box.
Powered by the same tech as Cloudflare Workers.

Give your AI agent secure code execution

Expose secure-exec as a tool with the Vercel AI SDK. Your agent can execute arbitrary code without risking your infrastructure.

Why Secure Exec

Give your AI agent the ability to write and run code safely.

No infrastructure required

No Docker daemon, no hypervisor, no orchestrator. Runs anywhere Node.js, Bun, or an HTML5 browser runs. Deploy to Lambda, a VPS, or a static site — your existing deployment works.

Node.js & npm compatibility

fs, child_process, http, dns, process, os — bridged to real host capabilities, not stubbed. Run Express, Hono, Next.js, and any npm package.

Compatibility matrix

Built for AI agents

Give your AI agent the ability to write and run code safely. Works with the Vercel AI SDK, LangChain, and any tool-use framework.

Deny-by-default permissions

Filesystem, network, child processes, and env vars are all blocked unless explicitly allowed. Permissions are composable functions — grant read but not write, allow fetch but block spawn.

Configurable resource limits

CPU time budgets and memory caps. Runaway code is terminated deterministically with exit code 124 — no OOM crashes, no infinite loops, no host exhaustion.

Powered by V8 isolates

The same isolation primitive behind Cloudflare Workers for Platforms and every browser tab. Battle-tested at scale by the infrastructure you already trust.

Benchmarks

V8 isolates vs. sandboxes.

Secure Exec vs. Sandboxes

Not every workload needs a full OS. Secure Exec gives you V8-level isolation for code execution — no container required.

Secure Exec

Run untrusted code (Node.js, Python) inside your backend process

Native V8 performance

Granular deny-by-default permissions

Just npm install — no vendor account

Run on any cloud or hardware

No egress fees

No API keys to manage

Sandbox

Spin up a full OS with root access, system packages, and persistent disk

Native container performance

Coarse-grained permissions

Vendor account required

Hardware lock-in

Per-GB egress fees

API keys to manage

Need a full sandboxed operating system? We've got that too.

Sandbox Agent SDK

Run coding agents in sandboxes. Control them over HTTP.

Supports Claude Code, Codex, OpenCode, Amp, and Pi.

FAQ

For those about to execute, we salute you.

Install Secure Exec, create a runtime, and execute untrusted code. All in a few lines of TypeScript.

Read the DocsView on GitHub