Skip to main content
isol8 exposes two main classes:
  • DockerIsol8 for local execution
  • RemoteIsol8 for remote HTTP execution
Both implement Isol8Engine.
Use DockerIsol8 for local in-process execution. Use RemoteIsol8 when execution is handled by an isol8 serve instance over HTTP.

Installation

DockerIsol8

Constructor options (Isol8Options)

'ephemeral' | 'persistent'
default:"ephemeral"
Execution mode. Ephemeral uses warm pool containers. Persistent reuses one container.
'none' | 'host' | 'filtered'
default:"none"
Network policy for execution container.
network: "host" gives untrusted code full network egress. Prefer none or filtered for most workloads.
{ whitelist: string[]; blacklist: string[] }
Filter rules used only when network is "filtered".
number
default:"1"
CPU limit as fraction/cores.
string
default:"512m"
Memory cap for container.
number
default:"64"
Maximum process count in container.
boolean
default:"true"
Mount root filesystem read-only.
number
default:"1048576"
Output truncation threshold in bytes.
Record<string, string>
default:"{}"
Secret env variables; values are masked in stdout/stderr post-processing.
number
default:"30000"
Default timeout applied when request timeout is omitted.
string
Override runtime image selection.
string
default:"512m"
Size of /sandbox tmpfs mount.
string
default:"256m"
Size of /tmp tmpfs mount.
boolean
default:"false"
Enable internal debug logs.
boolean
default:"false"
Keep container running after execution completes (debug/inspection use case).
boolean
default:"false"
Include network request logs in result when filtered mode is used.
SecurityConfig
Seccomp behavior (strict, unconfined, custom).
AuditConfig
Audit logging configuration.
'fast' | 'secure'
default:"fast"
Strategies for managing the ephemeral container pool.
  • fast: Dual-pool system (clean/dirty) with background cleanup. Use for high-throughput.
  • secure: Synchronous cleanup before every acquisition. Use for maximum isolation assurance.
number | { clean: number; dirty: number }
default:"{ clean: 1, dirty: 1 }"
Warm pool size config.

RemoteIsol8

RemoteIsol8.start() performs a /health check. RemoteIsol8.stop() deletes the remote session only when sessionId is set.
string
required
Base URL of remote server.
string
required
Bearer token for authentication.
string
Optional persistent session identifier.
Isol8Options
Engine options sent with remote execution requests.

Isol8Engine methods

Promise<void>
Initializes engine (or checks remote health). DockerIsol8 accepts optional startup prewarm settings, for example:
  • start({ prewarm: true }) to prewarm all runtimes
  • start({ prewarm: { runtimes: ["python", "node"] } }) to prewarm selected runtimes
Promise<void>
Stops local resources or deletes remote session if used.
Promise<ExecutionResult>
Runs code and returns full result.
AsyncIterable<StreamEvent>
Streams stdout, stderr, exit, and error events. For RemoteIsol8, automatically uses WebSocket transport with SSE fallback.
Promise<void>
Upload file into active persistent/session container.
Promise<Buffer>
Download file from active persistent/session container.
File methods require stateful execution context: local persistent mode or a remote client with sessionId.

ExecutionRequest fields

string
required
Source code to execute.
Runtime
required
Runtime selection.
number
Per-request timeout override.
Record<string, string>
Extra environment variables.
string
Optional script extension override.
string
Stdin payload.
Record<string, string | Buffer>
Files to inject before execution.
string[]
Files to retrieve after execution.
string[]
Runtime-specific packages to install pre-run.
string
Inline shell script executed before the main code. Runs as the sandbox user from /sandbox. Useful for cloning repos, creating files, configuring tools, etc.
string
default:"/sandbox"
Working directory for the main code execution. Must resolve to a path inside /sandbox.
Record<string, string>
Metadata to attach to audit records.

ExecutionResult fields

string
Captured standard output.
string
Captured standard error.
number
Process exit code.
number
Wall time for execution.
boolean
Whether output exceeded maxOutputSize.
string
Unique execution identifier.
Runtime
Runtime used for this execution.
string
ISO timestamp.
string
Container ID when available.
Record<string, string>
Base64 file map for requested outputPaths.
object
CPU/memory/network usage metrics (when enabled).
NetworkLogEntry[]
Request logs in filtered mode (when enabled).

Cleanup helper

number
Number of containers removed.
number
Number of removals that failed.
string[]
Error list for failed removals.

FAQ

Use DockerIsol8 for local workflows and single-node apps. Use RemoteIsol8 when execution is centralized behind isol8 serve, shared across services, or isolated from app hosts.
Yes. start() initializes the engine or verifies remote health; stop() ensures cleanup (and session deletion for remote clients with sessionId).
putFile and getFile require a persistent remote session. Set sessionId when constructing RemoteIsol8.

Troubleshooting quick checks

  • Remote server health check failed: verify host URL, server status, and API key.
  • File operations require a sessionId: set sessionId for RemoteIsol8 before using putFile/getFile.
  • No streamed events from executeStream: confirm server supports /execute/stream and the request is valid.
  • Unexpected truncation: increase maxOutputSize in constructor options.

Execution guide

Lifecycle, modes, streaming, and result semantics.

Option mapping

Map every library option to CLI, config, and API equivalents.

How to CLI

Command-line behavior and flag-by-flag details.

Troubleshooting

Diagnose runtime, network, and session issues quickly.