Sandboxes can run continuously for up to 24 hours (Pro) or 1 hour (Base). For longer workloads, use pause and resume — pausing resets the runtime window, and your sandbox’s full state is preserved indefinitely.
Timeouts
Every sandbox has a configurable timeout that determines how long it stays running. You set it at creation time in milliseconds (JavaScript) or seconds (Python).Change timeout at runtime
You can change the sandbox timeout when it’s running by calling thesetTimeout method in JavaScript or set_timeout method in Python.
When you call the set timeout method, the sandbox timeout will be reset to the new value that you specified.
This can be useful if you want to extend the sandbox lifetime when it’s already running.
You can for example start with a sandbox with 1 minute timeout and then periodically call set timeout every time user interacts with it in your app.
Retrieve sandbox information
You can retrieve sandbox information like sandbox ID, template, metadata, started at/end at date by calling thegetInfo method in JavaScript or get_info method in Python.
Metadata
Metadata lets you attach arbitrary key-value pairs to a sandbox. This is useful for associating sandboxes with user sessions, storing custom data, or looking up sandboxes later viaSandbox.list().
You specify metadata when creating a sandbox and can access it later through listing sandboxes.
List sandboxes
You can list sandboxes using theSandbox.list() method. The method supports pagination and returns both running and paused sandboxes.
Once you have information about a running sandbox, you can connect to it using the
Sandbox.connect() method.Filter sandboxes
Filter sandboxes by their current state. The state parameter can contain either “running” for running sandboxes or “paused” for paused sandboxes, or both.Advanced pagination
For more granular pagination, you can set custom per-page item limit (default and maximum is 100) and specify an offset parameter (nextToken or next_token) to start paginating from.
hasNext or has_next property) and fetching until there are no more pages left to fetch:
Connect to a sandbox
If you have a running sandbox, you can connect to it using theSandbox.connect() method and start controlling it with the SDK. This is useful for reusing the same sandbox instance after a period of inactivity, or for resuming a paused sandbox.
1. Get the sandbox ID
To connect to a running sandbox, you first need to retrieve its ID. You can do this by calling theSandbox.list() method.
2. Connect to the sandbox
Now that you have the sandbox ID, you can connect to the sandbox using theSandbox.connect() method.
Shutdown sandbox
You can shutdown the sandbox any time even before the timeout is up by calling thekill method.