AutoResume handles this automatically: a paused sandbox wakes up when activity arrives, so your code doesn’t have to check or manage sandbox state. AutoResume builds on the sandbox persistence lifecycle.
Configure AutoResume
Set thelifecycle object when creating a sandbox to control what happens on timeout and whether paused sandboxes should auto-resume.
Lifecycle options
onTimeout/on_timeoutkill(default): sandbox is terminated when timeout is reachedpause: sandbox is paused when timeout is reached
autoResume/auto_resumefalse(default): paused sandboxes do not auto-resumetrue: paused sandboxes auto-resume on activitytrueis valid only whenonTimeout/on_timeoutispause
.kill(). A killed sandbox cannot be resumed.
If autoResume is false, you can still resume a paused sandbox manually with Sandbox.connect().
What counts as activity
Auto-resume is triggered by sandbox activity — both HTTP traffic and SDK operations. That includes:sandbox.commands.run(...)sandbox.files.read(...)sandbox.files.write(...)- Opening a tunneled app URL or sending requests to a service running inside the sandbox
autoResume is enabled, the next supported operation resumes it automatically. You do not need to call Sandbox.connect() first.
SDK example: pause, then read a file
The following example writes a file, pauses the sandbox, then reads the file back. The read operation triggers an automatic resume.Example: Web server with AutoResume
AutoResume is especially useful for web servers and preview environments. When an HTTP request arrives at a paused sandbox, the sandbox wakes up automatically to handle it. The following example starts a simple HTTP server and retrieves its public URL. UsegetHost() / get_host() to get the sandbox’s publicly accessible hostname for a given port.