Skip to content
View as Markdown

Represents a Daytona Sandbox instance.

Exposes lifecycle controls and operation facades for process execution, file-system access, and Git.

Properties:

  • process Process - Process execution interface for this Sandbox.
  • fs FileSystem - File-system operations interface for this Sandbox.
  • git Git - Git operations interface for this Sandbox.
  • computerUse ComputerUse - Computer use (desktop automation) interface for this Sandbox.
  • codeInterpreter CodeInterpreter - Stateful code interpreter for this Sandbox (Python).
public LspServer createLspServer(String languageId, String pathToProject)

Creates an LSP server instance for the specified language and project.

Parameters:

  • languageId String - language server to start (e.g. “typescript”, “python”, “go”)
  • pathToProject String - absolute path to the project root inside the sandbox

Returns:

  • LspServer - a new LspServer configured for the given language
public void start()

Starts this Sandbox with default timeout.

Throws:

  • DaytonaException - if the Sandbox fails to start
public void start(long timeoutSeconds)

Starts this Sandbox and waits for readiness.

Parameters:

  • timeoutSeconds long - maximum seconds to wait; 0 disables timeout

Throws:

  • DaytonaException - if start fails or times out
public void stop()

Stops this Sandbox with default timeout.

Throws:

  • DaytonaException - if the Sandbox fails to stop
public void stop(long timeoutSeconds)

Stops this Sandbox and waits until fully stopped.

Parameters:

  • timeoutSeconds long - maximum seconds to wait; 0 disables timeout

Throws:

  • DaytonaException - if stop fails or times out
public void waitUntilStopped(long timeoutSeconds)

Waits until Sandbox reaches stopped (or destroyed) state.

Parameters:

  • timeoutSeconds long - maximum seconds to wait; 0 disables timeout

Throws:

  • DaytonaException - if timeout is invalid, state becomes error, or timeout expires
public void delete()

Deletes this Sandbox with default timeout behavior.

Throws:

  • DaytonaException - if deletion fails
public void delete(long timeoutSeconds)

Deletes this Sandbox.

Parameters:

  • timeoutSeconds long - reserved timeout parameter for parity with other SDKs

Throws:

  • DaytonaException - if deletion fails
public Map<String, String> setLabels(Map<String, String> labels)

Replaces Sandbox labels.

Parameters:

  • labels Map<String, String> - label map to apply

Returns:

  • Map\<String, String\> - updated labels

Throws:

  • DaytonaException - if label update fails
public void setAutostopInterval(int minutes)

Sets Sandbox auto-stop interval.

Parameters:

  • minutes int - idle minutes before automatic stop

Throws:

  • DaytonaException - if the update fails
public void setAutoArchiveInterval(int minutes)

Sets Sandbox auto-archive interval.

Parameters:

  • minutes int - minutes in stopped state before automatic archive

Throws:

  • DaytonaException - if the update fails
public void setAutoDeleteInterval(int minutes)

Sets Sandbox auto-delete interval.

Parameters:

  • minutes int - minutes before automatic deletion after stop

Throws:

  • DaytonaException - if the update fails
public void updateNetworkSettings(UpdateSandboxNetworkSettings settings)

Updates outbound network policy on the runner (block all, restore access, or CIDR allow list).

Parameters:

  • settings UpdateSandboxNetworkSettings - request body; at least one of networkBlockAll or networkAllowList must be set

Throws:

  • DaytonaException - if the update fails
public String getUserHomeDir()

Returns home directory path for Sandbox user.

Returns:

  • String - absolute home directory path

Throws:

  • DaytonaException - if the request fails
public String getWorkDir()

Returns current working directory path.

Returns:

  • String - absolute working directory path

Throws:

  • DaytonaException - if the request fails
public void waitUntilStarted(long timeoutSeconds)

Waits until Sandbox reaches started state.

Parameters:

  • timeoutSeconds long - maximum seconds to wait; 0 disables timeout

Throws:

  • DaytonaException - if timeout is invalid, state becomes failure, or timeout expires
public void refreshData()

Refreshes local Sandbox fields from latest API state.

Throws:

  • DaytonaException - if refresh fails
public Sandbox experimentalFork()

Forks this Sandbox, creating a new Sandbox with an identical filesystem. Uses default timeout of 60 seconds.

Returns:

  • Sandbox - the forked Sandbox in started state

Throws:

  • DaytonaException - if the fork operation fails or times out
public Sandbox experimentalFork(String name, long timeoutSeconds)

Forks this Sandbox, creating a new Sandbox with an identical filesystem. The forked Sandbox is a copy-on-write clone of the original.

Parameters:

  • name String - optional name for the forked Sandbox; null for auto-generated
  • timeoutSeconds long - maximum seconds to wait for the forked Sandbox to start; 0 disables timeout

Returns:

  • Sandbox - the forked Sandbox in started state

Throws:

  • DaytonaException - if the fork operation fails or times out
public void experimentalCreateSnapshot(String name)

Creates a snapshot from the current state of this Sandbox. Uses default timeout of 60 seconds.

Parameters:

  • name String - name for the new snapshot

Throws:

  • DaytonaException - if the snapshot operation fails
public void experimentalCreateSnapshot(String name, long timeoutSeconds)

Creates a snapshot from the current state of this Sandbox. The Sandbox will temporarily enter a ‘snapshotting’ state and return to its previous state when complete.

Parameters:

  • name String - name for the new snapshot
  • timeoutSeconds long - reserved timeout parameter for parity with other SDKs

Throws:

  • DaytonaException - if the snapshot operation fails
public String getId()

Returns Sandbox ID.

Returns:

  • String - Sandbox ID
public String getName()

Returns Sandbox name.

Returns:

  • String - Sandbox name
public String getState()

Returns Sandbox state.

Returns:

  • String - lifecycle state
public String getTarget()

Returns target region.

Returns:

  • String - target identifier
public String getUser()

Returns Sandbox OS user.

Returns:

  • String - OS user
public String getToolboxProxyUrl()

Returns toolbox proxy URL.

Returns:

  • String - proxy URL
public int getCpu()

Returns allocated CPU cores.

Returns:

  • int - CPU cores
public int getGpu()

Returns allocated GPU units.

Returns:

  • int - GPU units
public int getMemory()

Returns allocated memory in GiB.

Returns:

  • int - memory in GiB
public int getDisk()

Returns allocated disk in GiB.

Returns:

  • int - disk in GiB
public Map<String, String> getEnv()

Returns Sandbox environment variables.

Returns:

  • Map\<String, String\> - environment map
public Map<String, String> getLabels()

Returns Sandbox labels.

Returns:

  • Map\<String, String\> - labels map
public Integer getAutoStopInterval()

Returns auto-stop interval in minutes.

Returns:

  • Integer - auto-stop interval
public Integer getAutoArchiveInterval()

Returns auto-archive interval in minutes.

Returns:

  • Integer - auto-archive interval
public Integer getAutoDeleteInterval()

Returns auto-delete interval in minutes.

Returns:

  • Integer - auto-delete interval
public Boolean getNetworkBlockAll()

Returns whether all network access is blocked for this Sandbox.

Returns:

  • Boolean - block-all flag, or null if unknown
public String getNetworkAllowList()

Returns the comma-separated CIDR allow list, if any.

Returns:

  • String - allow list or null
public Process getProcess()

Returns process operations facade.

Returns:

  • Process - process interface
public FileSystem getFs()

Returns file-system operations facade.

Returns:

  • FileSystem - file-system interface
public Git getGit()

Returns Git operations facade.

Returns:

  • Git - Git interface