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
Wait for the devbox to reach the running state. Uses optimized server-side polling for better performance.
Optionaloptions: RequestOptions<unknown> & { polling?: Partial<PollingOptions<DevboxView>> }Request options with optional polling 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: RequestOptions<unknown> & { polling?: Partial<PollingOptions<DevboxView>> }Request options with optional polling 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: RequestOptions<unknown> & { polling?: Partial<PollingOptions<DevboxView>> }Request options with optional polling 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
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