Skip to main content
isol8 provides a unified execution engine accessible through three interfaces: a CLI for local development, a TypeScript Library for application integration, and an HTTP API for remote services.

Execution Lifecycle

Every execution request follows a strict pipeline to ensure security and isolation.

Pipeline Overview

In ephemeral mode, simple requests can skip file injection and execute inline (for example python -c, node -e, bun -e, bash -c) when no stdin, files, outputPaths, or package installs are requested. The agent runtime always uses file injection and passes the code as a prompt to the pi coding agent.

Execution Modes

isol8 supports two execution modes, determined by your use case.

Selecting a Mode

Use the --persistent flag to enable persistent mode.
In CLI persistent mode, the container is tied to the CLI process. To reuse a persistent container across multiple CLI commands, you would need to use the API or Library.

Inputs & Outputs

You can pass code, environment variables, and files into the sandbox.

1. Source Code

The core of every request.
Pass a file path, an inline string, or pipe from stdin.

1.1 Remote Code URLs

isol8 can fetch source code from a URL before execution.
code and codeUrl are mutually exclusive. Provide only one per request.
Remote URL execution is controlled by:
  • request fields: codeUrl, codeHash, allowInsecureCodeUrl
  • CLI flags: --url, --github, --gist, --hash, --allow-insecure-code-url
  • config policy: remoteCode.* in isol8.config.json
URL fetching is disabled by default. Enable and tune remoteCode policy in config first. For full policy fields and security guidance, see Remote code URLs.

2. Environment Variables

Inject configuration or secrets.
Security Note: Environment variables are visible to the running process. For sensitive data, use the “Secrets” feature to ensure values are masked in logs and output.
The CLI only supports Secrets via --secret. These are injected as environment variables but their values are masked in stdout/stderr.

3. Files

Inject files before execution and retrieve them after.
The CLI supports file injection for the agent runtime via --files <dir>, which recursively copies a local directory into /sandbox. For other runtimes, use the Library or API for generic file injection (files) or retrieval (outputPaths). All runtimes support --out to capture stdout to a file.

Streaming Output

Real-time output is essential for long-running tasks or LLM code generation.
Streaming is enabled by default. Use --no-stream to wait for completion.
When using RemoteIsol8, executeStream() automatically selects the best available transport: WebSocket (/execute/ws) with automatic SSE (/execute/stream) fallback. See the WebSocket endpoint reference for protocol details.

StreamEvent reference

Each value yielded by executeStream is a StreamEvent: Use phase to distinguish setupScript output from main code output when both are present:
If a setupScript exits non-zero, executeStream yields an error event then an exit event (both with phase: "setup") and stops — no phase: "code" events follow. See Setup scripts for full details.

Resource Limits & Safety

isol8 enforces strict limits to contain untrusted code.

Output Truncation

If a script produces excessive output, isol8 truncates it to prevent memory issues.
  • result.truncated will be true.
  • The output will end with a truncation message.

Secret Masking

If you provide secrets (via CLI --secret or Library config), isol8 scans stdout and stderr and replaces occurrences of secret values with ***.

Troubleshooting

The code ran longer than timeoutMs.
  • Fix: Increase limit via --timeout or optimize the code.
  • Note: Infinite loops are a common cause.
The script printed more data than maxOutputSize allowed.
  • Fix: Reduce logging or increase the limit via --max-output.
Remember that the code runs in an isolated container.
  • It cannot see files on your host machine unless you explicitly inject them (Library/API).
  • CLI users should pipe data via stdin or use inline strings for simple inputs.

FAQ

Use request.timeoutMs when you want a per-execution timeout. Use options.timeoutMs as a baseline engine default for a client/session.
Use codeUrl for pinned remote artifacts (for example immutable GitHub raw URLs). Keep code for direct inline or generated source. Never set both in one request.
CLI runs are process-scoped. For durable cross-call state, use a stable sessionId through the API or RemoteIsol8.

Option mapping

Exact option mapping across CLI, config, API, and library.

Runtime reference

Runtime-specific behavior, extensions, and package semantics.

Setup scripts

Run shell commands before execution — streaming output, phase events, and early-exit on failure.

Remote code URLs

URL-based source fetching policy and integrity controls.

Troubleshooting

Symptom-based fixes for execution and session issues.