Agent-readable docs index: /llms.txt. Full docs in one file: /llms-full.txt. Download /docs.zip to grep all markdown files locally.

Image

Fluent, immutable builder for declarative sandbox images. Each method returns a new Image instance.

Image.base()

Start from the default OpenSandbox environment (Ubuntu 22.04, Python, Node.js, build tools).
typescript
import { Image } from "@opencomputer/sdk"; const image = Image.base() .aptInstall(['curl', 'jq']) .pipInstall(['requests', 'pandas']) .env({ PROJECT_ROOT: '/workspace' }) .workdir('/workspace');
Returns: Image

Builder Methods

image.aptInstall(packages)

body packagesstring[]required
System packages to install via apt-get
Returns: Image

image.pipInstall(packages)

body packagesstring[]required
Python packages to install via pip
Returns: Image

image.runCommands(...cmds)

body cmdsstring[]required
Shell commands to run during build
Returns: Image

image.env(vars)

body varsRecord<string, string>required
Environment variables to set
Returns: Image

image.workdir(path)

body pathstringrequired
Default working directory
Returns: Image

image.addFile(remotePath, content)

body remotePathstringrequired
Destination path in the image
body contentstringrequired
File content
Returns: Image

image.addLocalFile(localPath, remotePath)

body localPathstringrequired
Path to the local file
body remotePathstringrequired
Destination path in the image
Returns: Image

image.addLocalDir(localPath, remotePath)

body localPathstringrequired
Path to the local directory
body remotePathstringrequired
Destination path in the image
Returns: Image

image.builderMemory(mb)

Sets the RAM (MB) used during the build phase. Raise this when a build OOMs (heavy apt/pip/npm). Defaults to 4096. Does not affect the resulting sandbox's memory — size that at create time via memoryMB.
body mbnumberrequired
Build-phase memory in MB
Returns: Image

Utility Methods

image.toJSON()

Returns the image manifest as a plain object.
Returns: ImageManifest

image.cacheKey()

Computes a deterministic SHA-256 hash of the manifest for cache lookups.
Returns: string