ReadonlynetNetwork operations on the devbox.
ReadonlycmdCommand execution operations on the devbox.
ReadonlyfileFile operations on the devbox.
Create a named shell instance for stateful command execution.
Named shells are stateful and maintain environment variables and the current working directory (CWD) across commands, just like a real shell on your local computer. Commands executed through the same named shell instance will execute sequentially - the shell can only run one command at a time with automatic queuing. This ensures that environment changes and directory changes from one command are preserved for the next command.
OptionalshellName: string = ...The name of the persistent shell session. If not provided, a UUID will be generated automatically.
A DevboxNamedShell instance for executing commands in the named shell
// Create a named shell with a custom name
const shell = devbox.shell('my-session');
// Create a named shell with an auto-generated UUID name
const shell2 = devbox.shell();
// Commands execute sequentially and share state
await shell.exec('cd /app');
await shell.exec('export MY_VAR=value');
await shell.exec('echo $MY_VAR'); // Will output 'value' because env is preserved
await shell.exec('pwd'); // Will output '/app' because CWD is preserved
Get the complete devbox data from the API.
Optionaloptions: RequestOptions<unknown>Request options
The devbox data
Get the tunnel information for this devbox. Returns null if no tunnel has been enabled.
Optionaloptions: RequestOptions<unknown>Request options
The tunnel information, or null if no tunnel exists
Get the tunnel URL for a specific port. Throws an error if no tunnel has been enabled.
The port number to construct the URL for
Optionaloptions: RequestOptions<unknown>Request options
The tunnel URL for the specified port
Get all logs from a running or completed devbox. Optionally filter by execution ID or shell name.
Optionalparams: LogListParamsOptional filter parameters (execution_id, shell_name)
Optionaloptions: RequestOptions<unknown>Request options
The devbox logs
Wait for the devbox to reach the running state. Uses optimized server-side polling for better performance.
Optionaloptions: LongPollRequestOptions<DevboxView>Request options with optional long-poll configuration
The devbox data when running state is reached
Wait for the devbox to reach the suspended state. Uses optimized server-side polling for better performance.
Optionaloptions: LongPollRequestOptions<DevboxView>Request options with optional long-poll configuration
The devbox data when suspended state is reached
Create a disk snapshot of the devbox. Returns a snapshot that is completed. If you don't want to block on completion, use snapshotDiskAsync().
Optionalparams: DevboxSnapshotDiskParamsSnapshot creation parameters
Optionaloptions: RequestOptions<unknown> & {Request options with optional polling configuration
A completed Snapshot instance
Create a disk snapshot of the devbox asynchronously. Returns a snapshot that is not yet completed but has started. You can await completion using snapshot.awaitCompleted().
Optionalparams: DevboxSnapshotDiskParamsSnapshot creation parameters
Optionaloptions: RequestOptions<unknown>Request options
A Snapshot instance that has started but may not be completed
Shutdown the devbox.
Optionaloptions: RequestOptions<unknown>Request options
Shutdown result
Suspend the devbox and create a disk snapshot.
Optionaloptions: RequestOptions<unknown>Request options
Suspend result
Resume a suspended devbox and wait for it to reach the running state.
Optionaloptions: LongPollRequestOptions<DevboxView>Request options with optional long-poll configuration
The devbox data when running state is reached
Resume a suspended devbox without waiting for it to reach the running state.
Optionaloptions: RequestOptions<unknown>Request options
Resume result
Register a callback fired once if this devbox gets a pending infrastructure eviction.
The first onEvict across any devbox on this client opens a single account-wide
notification stream; it closes automatically once every registered devbox has been
notified. The callback runs at most once and is invoked as
callback(devbox, evictionDeadlineMs) — this devbox and the Unix millisecond
deadline by which it will be suspended. Use it to run cleanup before suspend.
Invoked with this devbox and its eviction deadline (ms).
Withdraw this devbox's eviction interest registered via onEvict.
Object-oriented interface for working with Devboxes.
Remarks
Overview
The
Devboxclass provides a high-level, object-oriented API for managing devboxes. Devboxes are containers that run your code in a consistent environment. They have the the following categories of operations:Quickstart