Boat

Hosted Ubuntu VMs with streamed commands, signed file transfers, disk snapshots, SSH and token-protected HTTPS previews via @boatdev/sdk.

Installation and authentication

pnpm add sbox-sdk @boatdev/sdk

The adapter targets the published @boatdev/sdk 1.14.1 declarations and Boat's v1 API. The optional SDK loads on the first operation, so importing sbox-sdk/boat or reading capabilities does not load it. Boat documents Node 18 or newer; sbox-sdk requires Node 20.10 or newer. SSH key generation uses Node's crypto module.

OptionEnvironment variableDescription
apiKeyBOAT_API_KEYRequired Bearer API key, normally prefixed boat_.
baseUrlBOAT_API_BASEOptional; defaults to https://boat.dev/api/v1.

Pass environment values explicitly. The adapter does not read process environment variables itself. client.verify() makes one authenticated sandboxes({ limit: 1 }) request. It never creates a VM.

Quickstart

import { createSandboxClient } from "sbox-sdk";
import { boat } from "sbox-sdk/boat";

const client = createSandboxClient({
  provider: boat({ apiKey: process.env.BOAT_API_KEY!, type: "small" }),
});
const sandbox = await client.create({
  name: "agent-work",
  env: { MODE: "test" },
  lifecycle: { maxAgeMs: 15 * 60_000 },
});
try {
  for await (const event of sandbox.commands.run("echo $MODE; echo log >&2", {
    cwd: "/home/user",
    timeoutMs: 30_000,
  })) {
    if (event.type === "stdout") process.stdout.write(event.data);
    if (event.type === "stderr") process.stderr.write(event.data);
  }
  await sandbox.files.write("/tmp/binary.dat", new Uint8Array([0, 255, 128]));
  console.log(await (await sandbox.files.read("/tmp/binary.dat")).bytes());
} finally {
  await sandbox.destroy();
}

destroy() uses permanent deletion with Boat's confirmation header, then polls the deletion operation until completion. The deadline covers both the initial request and polling. An already-absent DELETE succeeds; a missing deletion operation reports unconfirmed erasure. It does not substitute stop(). Separately saved snapshots remain available until explicitly deleted.

Prop

Type

Capabilities

CapabilityLevelNotes
streaming / backgroundnativedetached commands followed over NDJSON, stderr kept separate
killProcessnativestopCommand (process-tree TERM, then KILL)
listnativecursor-paginated, label filter
stop / pausenativeboth archive the VM; disk persists, memory does not
setTimeoutnativeupdate({ ttlSeconds }), deadline relative to now
filesUploadnativesigned upload/download URLs
exposePort / privatePreviewnativehostPort, _token query auth; private by default
egressControlnativeopen, deny, or allowlist; no deny overrides or inject
sshnativesshKey with a locally generated key; returns hostKey
snapshotnativesaved snapshots, disk only
forkemulatedfresh saved snapshot, then one create per child
proxiedFetchemulatedprivate preview, authenticated with the _port_auth cookie
templateBuildemulatedboot from a saved snapshot, save it under the cache key
pty / stdinunsupportedbuffered stdin still works through the core
codeInterpreter / statefulKernelunsupported
filesWatch / volumesunsupported
gpu / region / secretsVaultunsupported
metricsunsupportedusage/cost APIs don't give point-in-time metrics

perCommandEnvCwd is false (Boat has no per-command env), exitCodeNative and preservesDiskOnStop are true, previewModel is subdomain, previewBrowserAuth is true, and templateSources is ["snapshot"].

Create contract

FlagValue
idempotencyexact: the key is sent as Boat's native Idempotency-Key header
specSupportvcpus, memoryMB, diskMB and maxAgeMs are approximate; shmMB, gpu and idleTimeoutMs are rejected
limitsmaxLabels: 20, maxLabelKeyLength: 63, maxLabelValueLength: 256 (Boat counts UTF-8 bytes; the adapter checks bytes), maxAgeStepMs: 1000
sizessmall → Boat small, medium → default, large → large, xlarge → xlarge (see below)

Boat binds a create to its key and request body for 24 hours: a retry with the same key returns the same VM, a retry that races the first attempt gets a retryable 409 idempotency_in_progress, and reusing a key with a different spec is a non-retryable Conflict. The client therefore retries a failed create() on any retryable error. If the VM is created but fails to boot, the adapter deletes it and reports the error as non-retryable, because the key would only replay the deleted VM.

sizeBoat typevCPUMemoryDisk
smallsmall24 GB51 GB
mediumdefault48 GB51 GB
largelarge816 GB111 GB
xlargexlarge1632 GB251 GB

small bills machine time at half rate and large at twice the default rate. xlarge needs a qualifying Boat plan; otherwise create returns 403 machine_class_plan_required (Unauthorized).

How the spec maps

InputBoat behavior
template, templateRef, fromSnapshotA saved snapshot name accepted by create({ from }). Raw automatic snapshot IDs do not support restore. References from another provider and competing template/snapshot inputs are rejected.
nameDisplay name, 1–120 characters. Names are not unique IDs; connect() takes a sandbox ID. getOrCreate() uses the core's list-based emulation, without an atomic naming guarantee.
env, inline env secretsNative create-time environment. At most 100 entries and 64 KiB; reserved names, invalid keys and NUL values are rejected. Vault references and egress secrets are rejected.
metadataNative labels, at most 20. Keys use Boat's label syntax; values have a 256-byte limit.
size, resources.vcpus, memoryMB, diskMBSmallest fitting fixed type: small, default, large, xlarge (approximate). size presets land on these types exactly. Requests beyond xlarge are rejected. Without either, options.type or Boat's default applies.
resources.shmMB, GPU configurationRejected.
regionRejected: the published API has no region selector. Boat operates in the EU, but this adapter cannot choose a country.
lifecycle.maxAgeMsNative ttlSeconds, rounded up to seconds. Zero disables auto-stop. Maximum 30 days. setTimeout() resets the deadline relative to now.
lifecycle.onIdlestop and pause both mean disk-preserving stop at the wall-clock deadline. destroy is rejected.
idleTimeoutMs, autoResume: trueRejected. Boat's TTL is elapsed time, not inactivity, and inbound traffic does not automatically resume a stopped VM.
networkNative open, deny, or domain/public-IP/CIDR allowlist. Per-destination deny overrides and credential injection are rejected. Running VMs wait for matching host enforcement; matching pending policy on stopped VMs is saved for next boot.
volumesRejected.
ports, previewVisibilityNative hosted ports at creation. They are private unless previewVisibility: "public" is explicit.
idempotencyKeyNative Idempotency-Key header from the core call context (idempotency: "exact"). The client generates a key when you don't pass one, so its own retries never duplicate a VM.

The published v1 create request and @boatdev/sdk 1.14.1 CreateSandboxRequest expose machine type, environment, network and hostedPorts, but no region field. EU hosting does not provide a selectable EU region in this adapter. region remains unsupported.

The adapter defaults noEnv to true. Boat then excludes account credentials and strips saved per-sandbox environment on restore. Pass fresh env at create time. Set noEnv: false only when you intend Boat to attach the selected account environment and preserve saved credentials. environment selects that native environment.

Commands and files

Commands start detached and attach through Boat's reconnecting NDJSON helper. stdout and stderr remain separate, and the adapter requires a numeric exit code. A missing exit frame, stream error or unknown exit code is a provider error, not a successful exit.

timeoutMs is forwarded as timeoutSeconds within Boat's 1–600 second range. Detached commands do not have a documented native deadline, so the adapter also enforces the millisecond timeout by calling stopCommand. Cancellation of a newly started command disconnects immediately and attempts process-tree termination independently. The first terminal error is preserved even if termination stalls. A stream failure while reattaching an existing command leaves that command running; explicit kill() still terminates it. Without timeoutMs, detached commands have no adapter deadline. Custom signals beyond TERM/KILL are rejected; Boat sends SIGTERM followed by SIGKILL if needed. Background commands can be listed, killed and reattached by process ID.

Boat accepts native cwd but has no per-command env field. perCommandEnvCwd is false so the core safely quotes cd and export for both run and spawn. Native stdin and PTY are unsupported. Buffered stdin still works through the core's shell pipeline.

Files use signed upload/download URLs and raw bytes, including large binary payloads. Downloads can stream. Signed file paths must resolve under /home/user or /tmp; relative paths use /home/user. Directory listing, stat, move and remove use native file endpoints. Recursive mkdir uses the core shell fallback. A truncated directory listing raises an error rather than returning an incomplete result.

Previews and browser authentication

const preview = await sandbox.ports!.expose(8080, { visibility: "private" });
// preview.auth = { type: "query", param: "_token", token: "..." }

Serve on 0.0.0.0, not only localhost. The URL is https://<subdomain>-8080.on.boat.dev. HTTP and WebSockets use _token. The core's browserUrl(preview) and browserWsUrl(preview) helpers add it to the respective URLs. previewBrowserAuth is true because Boat explicitly documents query-token WebSocket authentication across origins.

An HTTP token URL redirects to set a seven-day _port_auth cookie and removes the token from the address. Third-party iframe cookies can be blocked. For browser WebSockets, keep _token in the WebSocket URL. Cookie-authenticated cross-origin writes and WebSockets otherwise undergo Boat's Origin check.

ports.fetch() authenticates server requests directly with Cookie: _port_auth=..., avoiding the token redirect for writes. It rejects paths outside the preview origin. ports.unexpose() runs the documented host hide <port> command. ports.list() is unavailable because the published SDK has no hosted-port list endpoint; use the native host list command for inspection. Exposing a port with omitted visibility uses the handle default, which is private unless created with previewVisibility: "public". An explicit { visibility: "public" } overrides a private default. Boat does not return an SDK preview default on reconnect, so reconnected handles default to private even if the original handle used public previews. The sandbox's visibility field controls organization sharing, not port authentication. Request public visibility explicitly when needed.

Snapshots, forks and templates

Snapshots are disk-only saved snapshots. The adapter waits for saving to become ready; includesMemory is false. Restore starts a new VM with client.create({ fromSnapshot: ref }); in-place restore and memory mode are unsupported. Saved snapshot names use 1–63 lowercase letters, digits or dashes. Reserved names are rejected. Boat supports replacing an existing name and keeps its old artifact until a replacement is ready. The published SavedSnapshot has an optional artifact snapshotId only once ready and no per-save generation token. The adapter therefore rejects saves to existing names with Conflict; choose a fresh name. It requires a ready artifact from the expected source. Coordinate names across external writers: v1 has no conditional save, and a concurrent external replacement cannot be correlated reliably.

const snapshot = await sandbox.snapshots!.create({ name: "installed-tools" });
const restored = await client.create({
  fromSnapshot: snapshot,
  env: { MODE: "test" },
});
await restored.destroy();
await sandbox.snapshots!.delete(snapshot);

Boat's native fork reads its last automatic snapshot, which can omit recent writes. This adapter instead saves fresh disk, creates children from that saved snapshot, then deletes the temporary saved snapshot. It preserves size, labels, TTL and the live inbound/outbound network policy. It reapplies explicit env known to a handle created by this provider. After reconnecting, that env is unavailable to the adapter; default no-env forks scrub it, so use an explicit snapshot plus create({ fromSnapshot, env }) when those values must survive. Processes and memory do not survive a fork. Fork counts must be positive finite integers. Each child and template transient VM uses its own UUID idempotency key. After a lost response, the adapter replays the identical create body with that key, up to three attempts, and records recovered IDs before waiting for boot. Failed forks attempt to delete every identified child using cleanup independent of caller cancellation. If Boat remains unreachable through the recovery budget, the error reports unconfirmed creation and carries the key and request body in its cause for recovery within Boat's 24-hour key retention. Env values in that body are redacted, so supply them again when replaying it. Unidentified VMs and failed deletions still require account reconciliation; offline tests cannot prove cleanup during a persistent outage.

Snapshot template builds are emulated by booting a temporary VM from an existing saved snapshot, saving it as sbox-t-<base36 cache key>, and permanently deleting the temporary VM. This creates compute and saved-snapshot usage when you run it. Builds stay in your account, and lookup by cache key survives a new client. Image/Dockerfile sources, workdir, user, startup and readiness commands are rejected. With default no-env restores, template env is also rejected; pass env when creating a VM instead.

const template = await client.templates!.build({
  source: { snapshot: "installed-tools" },
});
const next = await client.create({ template });
await next.destroy();
await client.templates!.delete(template);

Lifecycle, SSH and limits

Both pause() and stop() call Boat's disk-preserving stop and wait for archival. resume() keeps the sandbox ID and waits until usable, but the machine IP and SSH host key change. Neither operation preserves process memory. State mapping covers all published states: init/provisioning/provisioned/cloning become creating; ready/idle/running become running; archiving becomes suspending; archived becomes stopped; error becomes error; cancelled becomes destroyed. Unknown future states become unknown.

ssh.create() generates an RSA key locally, authorizes the public key, and returns the PEM private key, user, current endpoint and hostKey. Pin hostKey in your SSH client's known-hosts configuration. Request credentials again after resume or fork. Generated public keys remain authorized on the VM until removed.

Metrics are unsupported: Boat's usage/cost and account OpenTelemetry APIs do not provide the normalized point-in-time metrics contract. GPU, PTY, live stdin, filesystem watching, volumes, vault references, code interpreter and stateful kernels are unsupported.

Boat has account/plan and start-rate limits, and does not queue starts beyond those limits. HTTP 429 and payment/quota failures map to retryable QuotaExceeded; 401/403 to Unauthorized, 404 to NotFound, 409 to Conflict, and timeouts to Timeout. A structured idempotency_in_progress conflict is retryable with the original key; idempotency_key_reused is non-retryable. A 403 plan restriction still maps to Unauthorized with its original cause.

Validation and sources

Offline tests use a typed fake SDK over the memory adapter's MiniShell and run the full live: true conformance checks. Here live: true enables all conformance scenarios against that fake; it is not live account QA. Separate tests exercise the published SDK's actual request serialization, auth, signed transfers, error class and NDJSON parser through an injected offline transport. No real Boat VM, SSH connection, preview service or paid resource was used to validate this adapter.

A live config is registered for BOAT_API_KEY and optional BOAT_API_BASE. Running it creates VMs and saved snapshots and can incur charges. Delete saved snapshots from the run after testing; VM deletion does not remove independently saved snapshots.

Sources checked against SDK 1.14.1:

On this page