
Build a snapshot from a Docker image
Build a snapshot by pointing at any Docker image. The call blocks until the snapshot is ready (default timeout is 60 seconds; bump it for large images).Private registries
To pull from a private registry, create a registry once with its credentials, then reference it by id when building a snapshot. Registries persist, so reuse one across snapshots.client.registries.list(), client.registries.retrieve(name), client.registries.update(name, ...), and client.registries.delete(name).
Build a snapshot from a Dockerfile
When you have a localDockerfile but don’t want to publish the image to a registry first, build a snapshot directly from the Dockerfile and its build context. LangSmith spins up a temporary builder sandbox, uploads the context, runs the build inside it with BuildKit, and captures the resulting image as a snapshot. The builder sandbox is torn down automatically once the build finishes.
The call blocks until the snapshot is ready (default timeout is 60 seconds; raise it for large or slow builds). fs_capacity_bytes must be large enough to hold the build context, the intermediate layers, and the final image.
dockerfile is resolved relative to context unless you pass an absolute path, and it must live inside the context directory. The .git directory is excluded from the uploaded context automatically.Build args and target stage
Passbuild_args / buildArgs to set Docker ARG values, and target to stop at a specific stage of a multi-stage build.
Stream build logs
Pass a callback toon_build_log / onBuildLog to receive the build’s stdout and stderr as it runs, which is useful for surfacing progress or debugging a failing build.
Speed up cold builds
vcpus / vCpus and mem_bytes / memBytes size the temporary builder sandbox. The build runs BuildKit plus the native snapshotter’s layer copies inside it, which contend for the builder’s default 0.5 vCPU, so giving the builder more CPU can cut a cold build’s wall time substantially. Memory is tied to CPU at 4 GiB per vCPU and must stay within 50% of that target, so a 2-vCPU builder accepts 4 to 12 GiB. Omit memory and it follows the ratio.
Capture a snapshot from a running sandbox
Start a sandbox from an existing snapshot, install packages or prepare data, then capture the result as a new snapshot. The returned snapshot has itssource_sandbox_id set to the sandbox it was captured from, and can be used as the snapshot_id for any later create_sandbox call.
By default, capture preserves the filesystem only. Installed packages (under
/usr/local, /root, /opt, the home directory, etc.) and files you wrote to those locations are kept, as is /tmp. Only /dev/shm is a tmpfs, so everything else lives on the sandbox’s disk. Running processes, open sockets, and in-memory state are not carried over: boot the new sandbox and start the processes you need again, or capture memory too.Tune capture timing
capture_snapshot blocks until the new snapshot is ready. Raise the timeout kwarg (default 60s) if your filesystem is large or your storage backend is slow.
Resume from memory
A snapshot can carry the sandbox’s RAM alongside its filesystem. Boot from one and the sandbox resumes where it left off, with its processes still running, instead of cold-booting. Use this for environments that are slow to warm up, such as a loaded model or a started database.Memory snapshots are available over the REST API only. The
langsmith.sandbox Python and TypeScript clients do not expose these fields yet.include_memory on a capture:
memory_snapshot_size_bytes when memory was captured. include_memory requires a sandbox that is running or stopped, and it cannot be combined with checkpoint or docker_image.
Some sandboxes run on an overlay filesystem runtime that cannot carry a memory image. Capturing one returns include_memory is not supported for overlay-rootfs sandboxes. LangSmith assigns that runtime, so it is not something you select per sandbox.
Two fields on create control the other half:
preserve_memory_on_stop. Without it, the stop discards RAM and there is nothing to capture.
List, fetch, and delete snapshots
list_snapshots / listSnapshots paginates server-side (default page size 50, max 500) and accepts optional filters: name_contains / nameContains (case-insensitive substring on name), limit (1–500), and offset (≥ 0). Page through results by advancing offset.Stopped sandboxes
A stopped sandbox keeps its filesystem, and the next request wakes it automatically. You do not need to start it yourself: send the command you wanted to run and the sandbox comes back up to serve it.preserve_memory_on_stop to resume from memory instead of cold-booting.
Next steps
- Create sandboxes from snapshots with the SDK
- Expose HTTP services with Service URLs
- Inject credentials via the Auth proxy
Connect these docs to Claude, VSCode, and more via MCP for real-time answers.

