Let the agent write code. Never let it escape the boundary.
PROJECT
Agent Sandbox RunnerROLE
Sole EngineerA secure execution plane for model-written Python, with one policy path for API and agent callers, a fresh cloud microVM per run, explicit failure ownership, and a live audit console.
SYSTEM ARCHITECTURE
Generated code enters one controlled execution path.
PUBLIC CLIENT
React consoleTurnstile · visitor budget · SSEAUTHENTICATED CLIENT
Execution APIAPI key · rate limit · schemaBOUNDED AGENT
OpenRouter + execute_pythonstep · tool · token · time budgetsONE EXECUTION AUTHORITY
ExecutionServicepolicy · concurrency · classification · persistence · cleanupUNTRUSTED COMPUTE
The agent is a client, not an infrastructure authority. Every caller crosses the same validation, execution, and cleanup boundary.
EXECUTION LIFECYCLE
Cleanup is part of the result, not an afterthought.
The same lifecycle runs whether code came from a developer API request or the bounded AI agent.
Queue
Create a durable execution record and return 202 before the work begins.
Admit
Acquire a concurrency slot after policy and spend checks pass.
Create
Start one fresh E2B microVM with bounded retry and no network access.
Run
Upload code, execute with a hard timeout, and stream capped output events.
Destroy
Kill the sandbox in finally, including provider and user-code failure paths.
Classify
Separate user errors, timeouts, provider failures, and interruptions.
Persist
Store the result and cleanup evidence used by the API, agent, and console.
01 / TRUST BOUNDARY
One path from generated code to a sandbox.
The agent never talks to E2B directly. It is a bounded client of the same ExecutionService used by the API, so policy, concurrency, classification, persistence, and cleanup cannot be bypassed.
Fresh isolation
Each run creates a new cloud microVM. Sessions are never shared between users or agent runs.
Network denied
Sandbox internet access is off by default, and application secrets are never copied into the runtime.
Bounded resources
Wall-clock limits, capped output, concurrency control, and sandbox lifetime backstops constrain every execution.
Cleanup in finally
The service attempts destruction on every path and records the outcome instead of treating process exit as proof of cleanup.
02 / FAILURE OWNERSHIP
A timeout is not always the user's fault.
Provider exceptions overlap in ways that can mislabel an unavailable sandbox as slow user code. The service classifies the most specific infrastructure errors before generic timeouts.
User code error
A completed process with a failing exit belongs to the submitted program and is reported with bounded stderr.
Execution timeout
Only an active program that exceeds its allotted runtime is classified as a user-code timeout.
Sandbox unavailable
Creation, reachability, and provider failures remain infrastructure errors instead of being blamed on the code.
Stored evidence
Status, failure kind, timings, output metadata, and cleanup state are persisted for verification and debugging.
03 / BOUNDED AGENT
The model can propose and inspect. The service remains authoritative.
The agent gets one tool, execute_python, and a finite budget for steps, tool calls, tokens, and wall-clock time. Success comes from stored execution records, not the model's narration.
One typed tool
Invalid tool arguments return structured feedback so the model can repair a request without escaping the contract.
Pre-spend policy
Requests are validated before an LLM or sandbox provider is paid.
Bounded loop
Step, tool, time, and token ceilings prevent an open-ended autonomous run.
Verified completion
The final answer can reference only results produced by the shared execution path and stored by the application.
04 / PUBLIC OPERATIONS
A real demo with controlled cost and an honest trace.
The public console streams actual sandbox lifecycle events. Layered gates keep a no-sign-up demo available without turning provider credits into an unbounded public resource.
Live event stream
Sandbox creation, upload, stdout, stderr, exit, and destruction events arrive through SSE with replay for late connections.
Spend gates
Policy checks, Turnstile, visitor limits, a daily budget, recorded-run replay, and a provider credit limit contain cost.
Proxy-safe identity
Visitor limits trust Cloudflare's connecting IP and use the proxy-controlled end of forwarded chains.
Observable delivery
Structured logs, lifecycle metrics, CI checks, Docker builds, Render, Cloudflare, and uptime monitoring close the loop.
TECHNOLOGY
Generated code is untrusted input. The useful engineering begins at the boundary around it.