Sailboxes vs. Modal: sandbox lifetime and memory pricing
A Sailbox has no fixed lifetime by default. It keeps its workspace when it sleeps. Modal limits each sandbox to 24 hours. Both platforms let memory use grow. Sail charges $0.008 per GiB-hour of RAM used. Modal charges about $0.024 per GiB-hour. Modal bills for the larger of two amounts: the RAM you request or the RAM you use.Create the Sailbox
Install the Sail Python SDK on the machine that runs your controller. Runpython -m pip install sail. Sign in with sail auth login. Create one Sailbox per session. This example saves its ID in a local file. In your application, store the ID with the agent session.
Transfer files
Modal’sfilesystem.write_text(text, path) takes the file contents first. Sail’s fs.write(path, data) takes the destination first. Run this code from the directory that contains worker.py and job.json. The example worker reads /tmp/job.json and writes /tmp/result.json inside the Sailbox. Use the paths your worker needs.
Run your existing worker
For commands that need only the final output, replaceSandbox.exec() with sb.run(). This call waits for the command to finish.