Skip to main content

Import

Examples

API

Sandbox.create()

Create a new sandbox session. Claims a warm pod or creates a new one. Returns: Promise<Sandbox>

Sandbox.get(id, )

Reconnect to an existing sandbox session. Returns: Promise<Sandbox>

Sandbox.attach(attachment)

Attach to an already-known sandbox session and endpoint without a reconnect lookup. Returns: Sandbox

Sandbox.list()

List sandbox sessions with optional pagination. Returns: Promise<SandboxListResult>

Sandbox.createLazy()

Create a lazily-provisioned sandbox session with automatic heartbeats. Returns: LazySandbox

sandbox.executeCommand(command, options)

Execute a bash command in the sandbox and return buffered result. Returns: Promise<ExecResult>

sandbox.executeStream(command, options)

Execute a bash command with streaming output (NDJSON). Returns: AsyncGenerator<ExecStreamEvent>

sandbox.readFile(path)

Read a file from the sandbox workspace. Returns: Promise<string>

sandbox.writeFiles(files)

Write files to the sandbox workspace. Returns: Promise<void>

sandbox.startBackgroundCommand(command, options)

Start an async background command in the sandbox. Returns: Promise<BackgroundCommand>

sandbox.getBackgroundCommand(commandId)

Get the status of an async background command. Returns: Promise<BackgroundCommand>

sandbox.getBackgroundCommandOutput(commandId)

Get the output of an async background command. Returns: Promise<BackgroundCommandOutput>

sandbox.listBackgroundCommands()

List all background commands in the sandbox. Returns: Promise<BackgroundCommand[]>

sandbox.cancelBackgroundCommand(commandId)

Cancel an async background command. Returns: Promise<BackgroundCommand>

sandbox.heartbeat()

Send a heartbeat to prevent idle timeout. Returns: Promise<void>

sandbox.close()

Close the sandbox session and mark for deletion. Returns: Promise<void>

sandbox.id

Get the session ID. Returns: string

sandbox.url

Get the sandbox endpoint URL. Returns: string

Type Reference

SandboxOptions

Options for creating a sandbox session.

ExecResult

Result of a command execution: stdout, stderr, and exit code.

ExecStreamEvent

Streaming event emitted during command execution.

Exports

Functions

Classes

Types

Constants