VIP-67: Experimental.Sandbox: provisioned machines behind the ordinary platform services
Status: accepted by Will, 2026-11-23 — standard library only (no compiler or language changes). Will: "58 I accept. I accept every other language proposal but ones that don't require a change to the language and are purely library functions that don't require compiler changes at all should be marked as such". Implementation in progress (Experimental.Sandbox).
Will's words
Vibelang is meant to have most of the features of durable execution agents etc. built into it. What is that status? Are the VIP open or are VIP missing for things like adding llm calls or jev calls to language sandboxing durable execution etc?
Ok so give me a list of [the reference engine's] features. We need to figure out what the VIP should look like. Some of the features outside of durable execution likely should simply be in the standard library I'm guessing but we should enumerate all of them
Summary
One sentence. A sandbox is a layer: provide Experimental.Sandbox.container({ image }) { … } makes the ChildProcessSpawner, FileSystem and Path inside the block belong to another machine, and the code in the block does not change.
One paragraph. An agent that runs commands needs somewhere to run them that is not the developer's laptop. The sandbox package of the reference engine (an existing Effect durable-execution framework these built-ins are modelled on) adapts ten providers, from a scratch directory to a Kubernetes Pod, to one contract, and from that contract it derives Effect's ordinary platform services. This VIP ports it. Because Vibe code reaches the platform through injected services (VIP-33), a sandbox needs no API of its own at the call site: the same spawner.string(…), the same Experimental.Tools.bash, the same Experimental.Agent.cli run inside it. The module "implements no isolation of its own". What a sandbox prevents is the provider's property, and the table below says which.
provide Experimental.Sandbox.container({ image: "node:22" }) { this machine the container
const spawner = try ChildProcessSpawner.ChildProcessSpawner ─────────── ─────────────
try spawner.string(ChildProcess.make("node", ["--version"])) docker exec ──► node --version
try Experimental.Tools.read({ path: "/workspace/package.json" }) file transfer ──► /workspace/package.json
} scope closes ──► container removedDecision
// proposed
export effect function nodeVersion() {
provide Experimental.Sandbox.container({ image: "node:22" }) {
const spawner = try ChildProcessSpawner.ChildProcessSpawner
return try spawner.string(ChildProcess.make("node", ["--version"]))
}
}Module
Experimental.Sandbox, in scope with no import, as VIP-33 rules. Its code is vibelang-runtime/experimental/Sandbox. It ports the reference engine's sandbox package.
Each provider is a layer that provides ChildProcessSpawner, FileSystem and Path on the machine it holds.
| Layer | Machine | Isolation it gives | Reference engine |
|---|---|---|---|
Sandbox.directory(root) | A scratch directory on this machine | None. A separate workspace in the host's own security domain | DirectorySandbox |
Sandbox.command(prefix) | Whatever the prefix reaches: ssh host, docker exec id | The target's | CommandSandbox |
Sandbox.container({ image, network? }) | A container this call starts and removes | The container engine's, as configured. No network unless network is set | ContainerSandbox |
Sandbox.kubernetes({ image, namespace? }) | One Pod per session | The cluster's | KubernetesSandbox |
Sandbox.interpreter() | An in-process shell interpreter, for hosts that cannot spawn | No real processes exist | JustBashSandbox |
Functions:
| Call | Meaning | Reference engine |
|---|---|---|
Sandbox.run(provider, effect) | Hold one machine for one unit of work. Gives the result and the work its checkout gained, as a git diff | Sandbox.run |
Sandbox.supervised(provider, { interval, tolerance }) | Probe the session and retire it when it is dead, so a hung command fails and a retry lands on a fresh one | SandboxSupervision.layer |
Sandbox.job(command, { key }) | A command as durable work: start once by key, probe, collect, cancel | SandboxCommand |
Sandbox.check(provider) | Run the conformance suite a provider must pass | SandboxConformance.check, ProviderConformance.check |
Rules
- Opening is scoped. The machine lives as long as the
provideblock. Interruption closes the scope and runs the provider's cleanup. A cleanup that fails is reported; it is never counted as done. - The default is closed.
Sandbox.containerpasses--network noneunlessnetworknames a mode. - The environment is replaced, not inherited. A child sees
PATH,HOME,USER,LANG,LC_*,TERM,TMPDIR,SHELLand what the caller declares. - Unsupported process features fail loudly. Extra file descriptors,
stdin: "inherit", detached processes and custom shells fail with aBadArgumentPlatformError. Standard input is delivered whole or refused before the spawn; it is never dropped. - "Sandbox" is three different claims. A directory separates a workspace. A container or a virtual machine confines a process. QuickJS, in std-agent, confines JavaScript and no process at all. Each provider row states which it is.
- A sandbox and a policy stack.
provide Experimental.Sandbox.container(…) { provide Experimental.Capability.guard(policy) { … } }checks each operation and confines the process. Neither replaces the other. - A process handle is not durable. A command that must outlive the host that started it is
Sandbox.job. A provider that cannot tell whether a command ran reports it as lost; the runtime does not rerun it under a new key. - A new provider proves itself. A provider adapts its SDK to one of two seams, a command runner or a full machine lifecycle, and passes
Sandbox.check. - Failures are
PlatformErrorfor an operation andSandbox.SandboxErrorfor the machine.
Host needs
| Provider | Needs on the host |
|---|---|
directory, command, container, kubernetes | ChildProcessSpawner, and sh, docker or kubectl on PATH |
interpreter | Nothing. Runs in a browser and a Worker |
The module is browser-bundleable: it "adapts a provider a caller hands it and owns no host access of its own".
Maintainers' decisions
This record comes from the 2026-11-09 built-in set review. The Status line above records Will’s subsequent ruling.
Experimental.Sandbox, in scope with no import, as VIP-33 rules. Design · Review.- Its code is
vibelang-runtime/experimental/Sandbox. Design · Review. - It ports the reference engine's sandbox package. Design · Review.
- Each provider is a layer that provides
ChildProcessSpawner,FileSystemandPathon the machine it holds. Design · Review. - Layer
Sandbox.directory(root): Machine: A scratch directory on this machine; Isolation it gives: None. A separate workspace in the host's own security domain; Reference engine:DirectorySandbox. Design · Review. - A separate workspace in the host's own security domain |
DirectorySandbox| Design · Review. - Layer
Sandbox.command(prefix): Machine: Whatever the prefix reaches:ssh host,docker exec id; Isolation it gives: The target's; Reference engine:CommandSandbox. Design · Review. - Layer
Sandbox.container({ image, network? }): Machine: A container this call starts and removes; Isolation it gives: The container engine's, as configured. No network unlessnetworkis set; Reference engine:ContainerSandbox. Design · Review. - No network unless
networkis set |ContainerSandbox| Design · Review. - Layer
Sandbox.kubernetes({ image, namespace? }): Machine: One Pod per session; Isolation it gives: The cluster's; Reference engine:KubernetesSandbox. Design · Review. - Layer
Sandbox.interpreter(): Machine: An in-process shell interpreter, for hosts that cannot spawn; Isolation it gives: No real processes exist; Reference engine:JustBashSandbox. Design · Review. - Functions: Design · Review.
- Call
Sandbox.run(provider, effect): Meaning: Hold one machine for one unit of work. Gives the result and the work its checkout gained, as a git diff; Reference engine:Sandbox.run. Design · Review. - Gives the result and the work its checkout gained, as a git diff |
Sandbox.run| Design · Review. - Call
Sandbox.supervised(provider, { interval, tolerance }): Meaning: Probe the session and retire it when it is dead, so a hung command fails and a retry lands on a fresh one; Reference engine:SandboxSupervision.layer. Design · Review. - Call
Sandbox.job(command, { key }): Meaning: A command as durable work: start once by key, probe, collect, cancel; Reference engine:SandboxCommand. Design · Review. - Call
Sandbox.check(provider): Meaning: Run the conformance suite a provider must pass; Reference engine:SandboxConformance.check,ProviderConformance.check. Design · Review. - Opening is scoped. The machine lives as long as the
provideblock. Design · Review. - Interruption closes the scope and runs the provider's cleanup. Design · Review.
- A cleanup that fails is reported; it is never counted as done. Design · Review.
- The default is closed.
Sandbox.containerpasses--network noneunlessnetworknames a mode. Design · Review. - The environment is replaced, not inherited. A child sees
PATH,HOME,USER,LANG,LC_*,TERM,TMPDIR,SHELLand what the caller declares. Design · Review. - Unsupported process features fail loudly. Extra file descriptors,
stdin: "inherit", detached processes and custom shells fail with aBadArgumentPlatformError. Design · Review. - Standard input is delivered whole or refused before the spawn; it is never dropped. Design · Review.
- "Sandbox" is three different claims. A directory separates a workspace. Design · Review.
- A container or a virtual machine confines a process. Design · Review.
- QuickJS, in std-agent, confines JavaScript and no process at all. Design · Review.
- Each provider row states which it is. Design · Review.
- A sandbox and a policy stack.
provide Experimental.Sandbox.container(…) { provide Experimental.Capability.guard(policy) { … } }checks each operation and confines the process. Design · Review. - Neither replaces the other. Design · Review.
- A process handle is not durable. A command that must outlive the host that started it is
Sandbox.job. Design · Review. - A provider that cannot tell whether a command ran reports it as lost; the runtime does not rerun it under a new key. Design · Review.
- A new provider proves itself. A provider adapts its SDK to one of two seams, a command runner or a full machine lifecycle, and passes
Sandbox.check. Design · Review. - Failures are
PlatformErrorfor an operation andSandbox.SandboxErrorfor the machine. Design · Review. - Provider
directory,command,container,kubernetes: Needs on the host:ChildProcessSpawner, andsh,dockerorkubectlonPATH. Design · Review. - Provider
interpreter: Needs on the host: Nothing. Runs in a browser and a Worker. Design · Review. - Runs in a browser and a Worker | Design · Review.
- The module is browser-bundleable: it "adapts a provider a caller hands it and owns no host access of its own". Design · Review.
Adopted review answers
- Keep
Experimental.Xnames under VIP-33. Promotion to a bare module name requires a later decision. Review question 1. - Sandbox provisioning has no
jjrequirement; only durable fork and compensable tasks require it. Review decision.
Compared
The same program in the reference engine 1.x. It type-checks against the reference engine's sandbox package, 1.0.0-rc.16.
import { ContainerSandbox, Sandbox } from "@smthrs/sandbox"
import { Effect } from "effect"
import * as ChildProcess from "effect/process/ChildProcess"
import { ChildProcessSpawner } from "effect/process/ChildProcessSpawner"
export const nodeVersion = Effect.gen(function*() {
const spawner = yield* ChildProcessSpawner
const provider = ContainerSandbox.make({ spawner, image: "node:22" })
const inside = Effect.gen(function*() {
const sandboxed = yield* ChildProcessSpawner
return yield* sandboxed.string(ChildProcess.make("node", ["--version"]))
})
return yield* inside.pipe(Effect.provide(Sandbox.layerHost(provider, { session: "run:demo" })))
})| Program | Tokens (o200k_base) | Lines |
|---|---|---|
| Vibe, proposed | 56 | 6 |
| Reference engine 1.x | 160 | 14 |
Sandbox.container reads the outer ChildProcessSpawner from context and names the session itself. The reference engine passes both by hand.
Checked. The Vibe example uses only existing syntax and compiles under vibelang 0.0.13 against a declaration of Experimental.Sandbox.container. The reference engine's program type-checks as shown.
Principles
- TypeScript-first. A layer and a block.
- Effect-second. A sandbox provides Effect's own service tags. No sandbox-shaped API appears in user code.
- Optimized for agentic programs. An agent's shell runs in a container with one line, and its work comes back as a diff.
- Highly forkable. Two seams and a conformance suite. A fork adds a provider without touching a caller.
- Factory-first. The factory's agents run in sandboxes anyone can reproduce from its source.
What this changes
Experimental.Sandboxis new. No grammar changes.- The proposals page's
TypeScriptSandboxfor model-written code is not this module. That is QuickJS, in std-agent. This module is machines.
Alternatives
- A
sandbox { … }block. It isprovide Experimental.Sandbox.container(…) { … }with a keyword, and it could not name a provider. - All ten providers. The reference engine also adapts Microsandbox, Vercel, Daytona, AWS and Cloudflare. A standard library that ships four vendors maintains four vendors. They are packages that pass
Sandbox.check. Sandbox.apply, the reference engine'sSandboxMerge.Apply, which lands a session's diff in a host repository with jj.Sandbox.runalready returns the diff. Landing it is a repository workflow, and it would make jj a requirement of this module.- Isolation in the compiler, by refusing code that could escape. A compiler cannot confine a spawned
npm install. - Run tasks in sandboxes by a
taskmember,static readonly sandbox = …. Where a step runs isplacement(durable-tasks-workflows); which machine that is stays with the host.
Follow-up questions
- A default. Should
Experimental.Agent.clirefuse to run outside a sandbox? Recommendation: no refusal, and a compiler warning whenAgent.cliis reached with noSandboxlayer in aprovideabove it. - Which providers ship. This VIP ships five and leaves the vendors as packages. Is a microVM provider needed in the box for untrusted model-written commands? Recommendation: not in the first release;
containerwith no network is the floor. - Secrets in a sandbox. A guest's outbound requests should leave through std-secrets's egress, which needs the provider to route them. Only some providers can. Recommendation: make it a field of the conformance report.
Depends on
- capabilities: the policy that stacks with a sandbox.
- VIP-33, accepted: platform access through injected services.