Skip to content

What dvm.run is

dvm.run runs Docker images in sandboxes you create, drive, and stop through an API from Python, TypeScript, or Rust. Every sandbox runs on dvm, a deterministic virtual machine, and is recorded automatically. Once it exits, seek (replay the recording to a chosen moment) to any point in the run, step through events, and read files as they existed then.

python/examples/first_sandbox.py
from dvm import Sandbox
with Sandbox.create("python:3.12") as sandbox:
result = sandbox.run(["python", "-c", "print('hello from a sandbox')"])
print(result.exit_code, result.stdout.decode(), end="")
sandbox.write_file("/tmp/notes.txt", b"written before the end\n")
sandbox.end()
point = sandbox.seek()
print(point.read_file("/tmp/notes.txt").decode(), end="")

This creates a sandbox from python:3.12, waits for it to start, runs a command, prints its exit code and output, and writes a file. Closing its input ends the sandbox. Seeking to the end returns a point (a recorded moment in the run) where you can read that file back.

Install an SDK and set an API key to run it:

Terminal window
pip install dvm-run # Python 3.12 or newer
npm install dvm-run # Node 22.12 or newer
cargo add dvm-run tokio --features tokio/macros,tokio/rt-multi-thread
export DVM_API_KEY=... # a key from the panel, or run `dvm-run login`

Follow Getting in to get an account and API key.