For coding agents
If you are a coding agent writing code against dvm.run, this page gives you everything you need to start. Each step links to the full guide.
1. Install an SDK
Section titled “1. Install an SDK”pip install dvm-run # Python 3.12 or newer; imports as `dvm`npm install dvm-run # Node 22.12 or newer; ES modules onlycargo add dvm-run tokio --features tokio/macros,tokio/rt-multi-thread2. Authenticate without a browser
Section titled “2. Authenticate without a browser”Export the API key your user provides:
export DVM_API_KEY=...Every SDK reads DVM_API_KEY when no key is passed in code. Do not run
dvm-run login without a person present to approve it in a browser: it
blocks waiting for approval. If you do not have a key, ask your user to
create one on the panel’s API keys page;
their account must be off the waitlist first (Getting in).
Do not print the key, and never pass it into a sandbox.
3. Start a sandbox and read its output
Section titled “3. Start a sandbox and read its output”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="")import { Sandbox } from "dvm-run";
await using sandbox = await Sandbox.create("python:3.12");const result = await sandbox.run(["python", "-c", "print('hello from a sandbox')"]);console.log(result.exitCode, new TextDecoder().decode(result.stdout));
await sandbox.writeFile("/tmp/notes.txt", new TextEncoder().encode("written before the end\n"));await sandbox.end();
const point = await sandbox.seek();console.log(new TextDecoder().decode(await point.readFile("/tmp/notes.txt")));#[tokio::main]async fn main() -> dvm_run::Result<()> { let client = dvm_run::Client::from_env()?; let sandbox = client.create_sandbox("python:3.12").await?; sandbox .scope(async |sandbox| { let result = sandbox .run(["python", "-c", "print('hello from a sandbox')"]) .await?; print!( "{} {}", result.exit_code, String::from_utf8_lossy(&result.stdout) ); sandbox .write_file("/tmp/notes.txt", b"written before the end\n") .await?; Ok(()) }) .await?;
let point = sandbox.seek_end().await?; let notes = point.read_file("/tmp/notes.txt").await?; print!("{}", String::from_utf8_lossy(¬es)); Ok(())}Key behaviors to rely on:
runreturns the exit code along with stdout and stderr as bytes. A nonzero exit code is a normal result, not an error; a command killed by a signal exits with128 + signal.- A string runs as a shell script (
/bin/bash -lcif the image includes bash, otherwise/bin/sh -c); a list runs directly as argv with no shell. - Commands run as root in the image’s environment and working directory.
Create a sandbox with no
commandand noentrypoint, as above, to start a session (a sandbox that accepts commands); pass either to run a one-program sandbox instead. - End every sandbox when finished: use a
withblock,await using,scope, orend(). A sandbox left running continues consuming credit until it hits its time limit. - When the API rejects a request, the SDK raises an error containing the service’s reason: read it (Errors).
- Images must be public; pulls are anonymous.
4. Read the docs as Markdown
Section titled “4. Read the docs as Markdown”- /llms.txt: overview of dvm.run and every page’s Markdown URL.
- /llms-full.txt: all documentation pages in one Markdown file.
- /llms-small.txt: the same content with asides and extra whitespace stripped.
- Any individual page: append
.mdto its URL. For example, this page ishttps://docs.dvm.run/start/agents.md, and the home page ishttps://docs.dvm.run/index.md.
The SDK source code and Rust API types (dvm-api) are in
github.com/deterministic-machines/sdk.