Operations for managing sidecar containers that run alongside the Sandbox's main container.
EXPERIMENTAL: the API is subject to change.
Create a token for making HTTP connections to the Sandbox.
Optionalparams: SandboxCreateConnectTokenParamsDisconnect from the Sandbox, cleaning up local resources. The Sandbox continues running on Modal's infrastructure. After calling detach(), most operations on this Sandbox object will throw.
Optionalparams: SandboxExecParams & { mode?: "text" }Get tags (key-value pairs) currently attached to this Sandbox from the server.
Check if the Sandbox has finished running.
Returns null if the Sandbox is still running, else returns the exit code.
Set tags (key-value pairs) on the Sandbox. Tags can be used to filter results in client.sandboxes.list.
Snapshots and creates a new Image from a directory in the running sandbox.
The resulting Image is retained for ttlMs (default: 30 days),
as a hard cutoff measured from creation — usage does not extend
the lifetime. Pass ttlMs: null to retain indefinitely.
The call has an overall timeoutMs budget (default: 55000). If it
elapses before a snapshot completes, the call is cancelled and an
error is thrown.
The path of the directory to snapshot
Optionalparams: SandboxSnapshotDirectoryParamsOptional parameters; see SandboxSnapshotDirectoryParams.
Promise that resolves to an Image
Snapshot the filesystem of the Sandbox.
Returns an Image object which can be used to spawn a new Sandbox with the same filesystem.
The call has an overall timeoutMs budget (default: 55000). If it
elapses before a snapshot completes, the call is cancelled and an
error is thrown.
Optionalparams: SandboxSnapshotFilesystemParamsOptional parameters; see SandboxSnapshotFilesystemParams.
Promise that resolves to an Image
Get Tunnel metadata for the Sandbox.
Raises SandboxTimeoutError if the tunnels are not available after the timeout.
A dictionary of Tunnel objects which are keyed by the container port.
Unmounts an Image previously mounted at a path in the Sandbox filesystem.
The mount path to unmount
Wait until the Sandbox readiness probe reports the Sandbox is ready.
This method only works for Sandboxes configured with a readiness probe.
Maximum total time to wait, in milliseconds.
A promise that resolves once the Sandbox is ready.
TimeoutError If readiness is not reported before timeoutMs.
Sandboxes are secure, isolated containers in Modal that boot in seconds.