Diagram 1: Remote architecture overview
Start the server
- CLI
- CLI (env key)
If
--key and ISOL8_API_KEY are both missing, startup fails. --key takes precedence when provided.Port resolution order is
--port > ISOL8_PORT > PORT > 3000. If the chosen port is unavailable, isol8 serve prompts for another port or can auto-select an open port.Serve runtime behavior
isol8 serve has two startup paths:
- Bun/dev path: runs server in-process.
- Built CLI (Node) path: downloads/runs standalone
isol8-serverbinary and can prompt for version update. - Both paths run graceful cleanup on
SIGINT/SIGTERM(sessions, containers, and images).
isol8 serve --update to force binary re-download.
Authentication contract
isol8 supports two authentication modes that can work together.Static key (default)
GET /health: no auth required.- all other endpoints: require
Authorization: Bearer <api-key>.
| Status | Meaning |
|---|---|
401 | Authorization header missing |
403 | token provided but invalid |
DB-backed keys (optional)
When the server is started with--auth-db, API keys are stored in a database. Without a value, it defaults to SQLite at ~/.isol8/auth.db. You can also pass a postgres:// or mysql:// connection string for PostgreSQL or MySQL. The --key value becomes the master key with admin privileges:
- Additional keys are created via
POST /auth/keys(master key required) - DB keys authenticate execution, file, and session endpoints
- DB keys cannot access admin routes (
/auth/*) — only the master key can - Keys support configurable TTL, tenant scoping, and individual revocation
POST /auth/loginexchanges the master key for a short-lived token
Login flow and credential storage
The CLI providesisol8 login to exchange the master key for a short-lived token:
POST /auth/login, receives a token, and saves it to ~/.isol8/credentials.json (permissions 0600). After login, isol8 run --host <url> uses the stored token automatically.
Key resolution priority (for isol8 run --host and RemoteIsol8):
--keyflag (explicit, always wins)ISOL8_API_KEYenvironment variable- Stored credentials from
~/.isol8/credentials.json(host-matched, non-expired)
isol8 logout to remove stored credentials locally.
Library usage with DB-backed auth
When usingRemoteIsol8 programmatically, pass the API key (master or DB-generated) directly:
createServer function with authDbPath. Pass a file path for SQLite, or a postgres:// / mysql:// URL for other backends:
Where remote values are set
| Concern | CLI | Config | API body | Library |
|---|---|---|---|---|
| Server listen/auth | isol8 serve --port --key | API key can come from env (ISOL8_API_KEY) | n/a | n/a |
| Server defaults | n/a | defaults.*, maxConcurrent, cleanup.*, security.* | merged with request options | n/a |
| Request overrides | isol8 run --host --key ... flags | baseline defaults only | options in /execute body | new RemoteIsol8(..., isol8Options) |
| Persistent session | isol8 run --persistent --host ... | cleanup policy affects idle sessions | sessionId | RemoteIsol8Options.sessionId |
Request envelope
Remote execution endpoints use this shape:options are merged over server defaults for that request.
Execute remotely
- API
- Library
- CLI
Persistent sessions
A stablesessionId reuses one container across calls.
- API
- Library
- CLI
Auto-pruning setup (idle session cleanup)
The server runs a periodic cleanup loop whencleanup.autoPrune is enabled.
- sweep interval: every
60_000ms (60s) - idle threshold:
cleanup.maxContainerAgeMs - active sessions are skipped while executing (
isActive === true) lastAccessedAtis refreshed on execute and file upload/download calls
Defaults
cleanup.autoPrune:truecleanup.maxContainerAgeMs:3_600_000(1 hour)
Configure in isol8.config.json
Practical tuning guidance
- shorter idle timeout (
5mto30m): lower container footprint, more frequent cold session starts - longer idle timeout (
1hto24h): better session reuse, higher idle resource usage - disable auto-prune only if you have explicit lifecycle management (for example always calling
DELETE /session/:id)
Streaming behavior
RemoteIsol8.executeStream() uses a WebSocket-first transport strategy:
- First call attempts WebSocket connection to
GET /execute/ws. - If WebSocket succeeds, all subsequent calls use WebSocket.
- If WebSocket fails on the first attempt (server doesn’t support it, proxy blocks upgrade), the client falls back to SSE via
POST /execute/stream. - If WebSocket was previously available but later fails, the error is thrown (not silently retried as SSE).
StreamEvent objects (stdout, stderr, exit, error).
- Library
- WebSocket API
- SSE API
- current server implementation always uses ephemeral mode for both streaming paths.
Sending
sessionId to /execute/stream does not create persistent streaming sessions in current implementation. The WebSocket endpoint (/execute/ws) is ephemeral-only.File APIs (persistent sessions only)
POST /file: upload base64 content to session containerGET /file?sessionId=...&path=...: download base64 content
- API
- Library
Operations checklist
- keep strict defaults in
isol8.config.json(network: "none"by default) - size
maxConcurrentto host capacity - configure cleanup pruning for session-heavy workloads
- place TLS/rate limiting in front of the service
- enable audit logging when provenance/compliance is required
FAQ
Why do I get 401 vs 403?
Why do I get 401 vs 403?
401 means missing Authorization header. 403 means token provided but it does not match server API key.What does RemoteIsol8.stop() do?
What does RemoteIsol8.stop() do?
If a
sessionId is configured, it calls DELETE /session/{id}. Without sessionId, there is no session to delete.Can file endpoints work without sessionId?
Can file endpoints work without sessionId?
No. File upload/download are bound to a persistent session container.
Troubleshooting
- Server start fails with API key error: pass
--keyor setISOL8_API_KEY. Session not foundon file calls: create session first via/executewith the samesessionId.- Session state unexpectedly gone: check prune settings in
cleanup.autoPruneandcleanup.maxContainerAgeMs. - Remote request hangs under load: inspect
maxConcurrentqueueing and host saturation.
Related pages
Configuration reference
Defaults, cleanup policy, and concurrency settings.
Architecture
Internal engine/server/session architecture.
Library reference
Programmatic client usage for local and remote execution flows.
Troubleshooting
Diagnose session, network, and remote execution failures.