Skip to main content
Supply files before a command and read its output from the process result. For saved files, the Inspect API lists directories, reads contents, and downloads artifacts without starting a VM. Session file methods can also read a running VM when using a lazy session. A regular session’s inspect() reads its selected saved image without starting a VM. A lazy session reads its active VM, or its saved image when no VM is running. Pending staged files can cause a lazy read to start a VM, and live reads can observe concurrent writes. Use inspect_snapshot() for a stable image: it saves active work and stops the VM. Staged files must first be applied by a command to appear in that snapshot.

Generate and retrieve

Complete the Python quickstart setup. This complete program starts from an available Alpine image, supplies binary input, saves the result, and verifies the downloaded bytes:
Expected output: Downloaded and verified result.bin. This example selects a regular session so the command saves before returning. A disposable regular-session run leaves the previous image selected; it cannot supply its generated files for post-execution inspection. The result object contains process output and state, while session.image_uuid identifies the selected saved filesystem. Use absolute guest paths. In files, strings and Path objects name local files; bytes supply contents directly. The SDK reuses uploads by content hash. stage_files() retains attachment references for a later command; it does not itself modify an image. Directory sources expand into regular files, omitting empty directories.

Large files and output

Use download_file() or iter_file() for large files; read_file() buffers the entire file. Close a file iterator when stopping early. The download helper replaces the local destination after the complete transfer; its parent directory must exist. Captured stdin, stdout, and stderr each default to 1 MiB and can be set up to 10 MiB with truncate_output_at on a regular-session run. Check stream truncated fields when completeness matters. These caps apply to recorded streams, not stdin delivery. Store large or binary output as a file and validate its size or digest after download. If a saved artifact read fails, retry inspection using the recorded artifact_image_uuid before executing the producer again. Confirm required upload, download, image-size, deletion, and retention limits with the Sandboxes team. Keep credentials out of inputs, logs, and retained images. See Security and data handling and Generate and download a binary artifact.