Skip to content

Sandboxes: custom images and fail_reason (0.4.0) - #25

Merged
ats3v merged 3 commits into
mainfrom
sandbox-custom-images
Dec 2, 2026
Merged

ats3v merged 3 commits into
mainfrom
sandbox-custom-images

Conversation

@ats3v

@ats3v ats3v commented Dec 2, 2026

Copy link
Copy Markdown
Member

The sandbox API accepts image again (backend #8735, live on all of deepapi since 2026-12-02), so the SDK takes it back. 0.3.0 removed it while the server refused it.

Changes

  • Sandbox.create() / acreate() take image: a public image from Docker Hub, ghcr.io, quay.io, gcr.io, public.ecr.aws, mcr.microsoft.com or nvcr.io with /bin/sh. It is sent only when set. The server pins it to its linux/amd64 digest, which Sandbox.image reports.
  • With an image, wait_timeout defaults to 600 s instead of 300 s, for create() and start(). The server gives a first pull up to 480 s, so 300 s could time out on a sandbox that then starts and bills.
  • Sandbox.fail_reason, and SandboxFailedError.fail_reason, also in the error's message. Until now the error only said "entered state 'failed'"; for a custom image the reason is the useful part.
  • README section on custom images, CHANGELOG, version 0.4.0.

Validation

  • ruff check ., mypy and pytest tests (111 passed) on Python 3.9. The two new tests fail on main.
  • Live against production with this branch:
Check Result
README snippet, image="python:3.12-slim" sb.image = docker.io/library/python:3.12-slim@sha256:4a68…; run_python works
alpine:3.20 (no bash) running in 7.8 s; exec, fs, stop/start with /workspace kept
gcr.io/distroless/static-debian12 (no shell) SandboxFailedError after 12 s: entered state 'failed': Container failed to start (StartError), .fail_reason set

Release: after merge, a GitHub release v0.4.0 runs the PyPI workflow.

@ats3v
ats3v merged commit 299b4b5 into main Dec 2, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants