Sandbox
Section titled “Sandbox”Represents a Daytona Sandbox instance.
Exposes lifecycle controls and operation facades for process execution, file-system access, and Git.
Properties:
processProcess - Process execution interface for this Sandbox.fsFileSystem - File-system operations interface for this Sandbox.gitGit - Git operations interface for this Sandbox.computerUseComputerUse - Computer use (desktop automation) interface for this Sandbox.codeInterpreterCodeInterpreter - Stateful code interpreter for this Sandbox (Python).
Methods
Section titled “Methods”createLspServer()
Section titled “createLspServer()”public LspServer createLspServer(String languageId, String pathToProject)Creates an LSP server instance for the specified language and project.
Parameters:
languageIdString - language server to start (e.g. “typescript”, “python”, “go”)pathToProjectString - absolute path to the project root inside the sandbox
Returns:
LspServer- a newLspServerconfigured for the given language
start()
Section titled “start()”public void start()Starts this Sandbox with default timeout.
Throws:
DaytonaException- if the Sandbox fails to start
start()
Section titled “start()”public void start(long timeoutSeconds)Starts this Sandbox and waits for readiness.
Parameters:
timeoutSecondslong - maximum seconds to wait;0disables timeout
Throws:
DaytonaException- if start fails or times out
stop()
Section titled “stop()”public void stop()Stops this Sandbox with default timeout.
Throws:
DaytonaException- if the Sandbox fails to stop
stop()
Section titled “stop()”public void stop(long timeoutSeconds)Stops this Sandbox and waits until fully stopped.
Parameters:
timeoutSecondslong - maximum seconds to wait;0disables timeout
Throws:
DaytonaException- if stop fails or times out
waitUntilStopped()
Section titled “waitUntilStopped()”public void waitUntilStopped(long timeoutSeconds)Waits until Sandbox reaches stopped (or destroyed) state.
Parameters:
timeoutSecondslong - maximum seconds to wait;0disables timeout
Throws:
DaytonaException- if timeout is invalid, state becomes error, or timeout expires
delete()
Section titled “delete()”public void delete()Deletes this Sandbox with default timeout behavior.
Throws:
DaytonaException- if deletion fails
delete()
Section titled “delete()”public void delete(long timeoutSeconds)Deletes this Sandbox.
Parameters:
timeoutSecondslong - reserved timeout parameter for parity with other SDKs
Throws:
DaytonaException- if deletion fails
setLabels()
Section titled “setLabels()”public Map<String, String> setLabels(Map<String, String> labels)Replaces Sandbox labels.
Parameters:
labelsMap<String, String> - label map to apply
Returns:
Map\<String, String\>- updated labels
Throws:
DaytonaException- if label update fails
setAutostopInterval()
Section titled “setAutostopInterval()”public void setAutostopInterval(int minutes)Sets Sandbox auto-stop interval.
Parameters:
minutesint - idle minutes before automatic stop
Throws:
DaytonaException- if the update fails
setAutoArchiveInterval()
Section titled “setAutoArchiveInterval()”public void setAutoArchiveInterval(int minutes)Sets Sandbox auto-archive interval.
Parameters:
minutesint - minutes in stopped state before automatic archive
Throws:
DaytonaException- if the update fails
setAutoDeleteInterval()
Section titled “setAutoDeleteInterval()”public void setAutoDeleteInterval(int minutes)Sets Sandbox auto-delete interval.
Parameters:
minutesint - minutes before automatic deletion after stop
Throws:
DaytonaException- if the update fails
updateNetworkSettings()
Section titled “updateNetworkSettings()”public void updateNetworkSettings(UpdateSandboxNetworkSettings settings)Updates outbound network policy on the runner (block all, restore access, or CIDR allow list).
Parameters:
settingsUpdateSandboxNetworkSettings - request body; at least one of networkBlockAll or networkAllowList must be set
Throws:
DaytonaException- if the update fails
getUserHomeDir()
Section titled “getUserHomeDir()”public String getUserHomeDir()Returns home directory path for Sandbox user.
Returns:
String- absolute home directory path
Throws:
DaytonaException- if the request fails
getWorkDir()
Section titled “getWorkDir()”public String getWorkDir()Returns current working directory path.
Returns:
String- absolute working directory path
Throws:
DaytonaException- if the request fails
waitUntilStarted()
Section titled “waitUntilStarted()”public void waitUntilStarted(long timeoutSeconds)Waits until Sandbox reaches started state.
Parameters:
timeoutSecondslong - maximum seconds to wait;0disables timeout
Throws:
DaytonaException- if timeout is invalid, state becomes failure, or timeout expires
refreshData()
Section titled “refreshData()”public void refreshData()Refreshes local Sandbox fields from latest API state.
Throws:
DaytonaException- if refresh fails
experimentalFork()
Section titled “experimentalFork()”public Sandbox experimentalFork()Forks this Sandbox, creating a new Sandbox with an identical filesystem. Uses default timeout of 60 seconds.
Returns:
Sandbox- the forkedSandboxin started state
Throws:
DaytonaException- if the fork operation fails or times out
experimentalFork()
Section titled “experimentalFork()”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:
nameString - optional name for the forked Sandbox;nullfor auto-generatedtimeoutSecondslong - maximum seconds to wait for the forked Sandbox to start;0disables timeout
Returns:
Sandbox- the forkedSandboxin started state
Throws:
DaytonaException- if the fork operation fails or times out
experimentalCreateSnapshot()
Section titled “experimentalCreateSnapshot()”public void experimentalCreateSnapshot(String name)Creates a snapshot from the current state of this Sandbox. Uses default timeout of 60 seconds.
Parameters:
nameString - name for the new snapshot
Throws:
DaytonaException- if the snapshot operation fails
experimentalCreateSnapshot()
Section titled “experimentalCreateSnapshot()”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:
nameString - name for the new snapshottimeoutSecondslong - reserved timeout parameter for parity with other SDKs
Throws:
DaytonaException- if the snapshot operation fails
getId()
Section titled “getId()”public String getId()Returns Sandbox ID.
Returns:
String- Sandbox ID
getName()
Section titled “getName()”public String getName()Returns Sandbox name.
Returns:
String- Sandbox name
getState()
Section titled “getState()”public String getState()Returns Sandbox state.
Returns:
String- lifecycle state
getTarget()
Section titled “getTarget()”public String getTarget()Returns target region.
Returns:
String- target identifier
getUser()
Section titled “getUser()”public String getUser()Returns Sandbox OS user.
Returns:
String- OS user
getToolboxProxyUrl()
Section titled “getToolboxProxyUrl()”public String getToolboxProxyUrl()Returns toolbox proxy URL.
Returns:
String- proxy URL
getCpu()
Section titled “getCpu()”public int getCpu()Returns allocated CPU cores.
Returns:
int- CPU cores
getGpu()
Section titled “getGpu()”public int getGpu()Returns allocated GPU units.
Returns:
int- GPU units
getMemory()
Section titled “getMemory()”public int getMemory()Returns allocated memory in GiB.
Returns:
int- memory in GiB
getDisk()
Section titled “getDisk()”public int getDisk()Returns allocated disk in GiB.
Returns:
int- disk in GiB
getEnv()
Section titled “getEnv()”public Map<String, String> getEnv()Returns Sandbox environment variables.
Returns:
Map\<String, String\>- environment map
getLabels()
Section titled “getLabels()”public Map<String, String> getLabels()Returns Sandbox labels.
Returns:
Map\<String, String\>- labels map
getAutoStopInterval()
Section titled “getAutoStopInterval()”public Integer getAutoStopInterval()Returns auto-stop interval in minutes.
Returns:
Integer- auto-stop interval
getAutoArchiveInterval()
Section titled “getAutoArchiveInterval()”public Integer getAutoArchiveInterval()Returns auto-archive interval in minutes.
Returns:
Integer- auto-archive interval
getAutoDeleteInterval()
Section titled “getAutoDeleteInterval()”public Integer getAutoDeleteInterval()Returns auto-delete interval in minutes.
Returns:
Integer- auto-delete interval
getNetworkBlockAll()
Section titled “getNetworkBlockAll()”public Boolean getNetworkBlockAll()Returns whether all network access is blocked for this Sandbox.
Returns:
Boolean- block-all flag, or null if unknown
getNetworkAllowList()
Section titled “getNetworkAllowList()”public String getNetworkAllowList()Returns the comma-separated CIDR allow list, if any.
Returns:
String- allow list or null
getProcess()
Section titled “getProcess()”public Process getProcess()Returns process operations facade.
Returns:
Process- process interface
getFs()
Section titled “getFs()”public FileSystem getFs()Returns file-system operations facade.
Returns:
FileSystem- file-system interface
getGit()
Section titled “getGit()”public Git getGit()Returns Git operations facade.
Returns:
Git- Git interface