Skip to main content
This guide creates one Modal Sandbox. The SDK terminates it when the Python context ends.

Install and authenticate

Create the script

Save this file as quickstart.py:

Run the script

The script writes screenshot.png in the current directory. The printed SHA-256 digest identifies the captured bytes.

Understand ownership

ComputerSandbox.create() owns the Sandbox that it creates. The context terminates that Sandbox on exit. ComputerSandbox.attach() does not take ownership. Its context closes the local connection and keeps the existing Sandbox running. Read Create and attach before you keep a desktop between processes.