python/sandbox/v0.1.16

opensandbox-group/OpenSandboxpython/sandbox/v0.1.16Aug 26, 2026by ninan-nn

AI Summary

Python SDK adds resilient HTTP transport, lifecycle hooks, background runs, and pool capacity back-pressure, along with performance improvements for sandbox startup.

Key Highlights

  • Resilient HTTP transport with backoff/retry
  • Sandbox lifecycle hooks support
  • Faster sandbox startup
  • Pool capacity back-pressure

New Features

  • Resilient HTTP transport
  • Sandbox lifecycle hooks
  • Background runs in isolated sessions
  • Runtime allocation and hardening visibility
  • Pool capacity back-pressure
  • Faster sandbox startup

Full Release Notes

## What's New

### ✨ Features

- **Resilient HTTP transport** — Async and sync clients now share a configurable retry transport with backoff, jitter, `Retry-After` handling, per-attempt timeouts, an overall deadline, and retry callbacks. Retries are enabled by default for idempotent requests on HTTP 429, 502, and 503; callers that require the previous fast-fail behavior can use `RetryPolicy.disabled()`. User-supplied transports remain untouched, and streaming SSE requests bypass replay. [#1372](https://github.com/opensandbox-group/OpenSandbox/pull/1372)
- **Sandbox lifecycle hooks** — `Sandbox.create` and `SandboxSync.create` now accept optional `preStart` and periodic lifecycle hooks, with stable Python models and server-aligned validation. Hook timeout ranges remain server-authoritative. [#1588](https://github.com/opensandbox-group/OpenSandbox/pull/1588) [#1605](https://github.com/opensandbox-group/OpenSandbox/pull/1605)
- **Background runs in isolated sessions** — Isolated sessions can start detached work and poll its status and incremental combined output. Active background runs suspend idle collection; read-only workspaces reject background execution because they cannot persist run logs. [#1456](https://github.com/opensandbox-group/OpenSandbox/pull/1456)
- **Runtime allocation and hardening visibility** — Sandbox responses can expose confirmed Pool allocation summaries, while isolated capabilities include execd init mode and hardening-layer state. These fields are additive and remain absent when the server cannot confirm the corresponding state. [#1481](https://github.com/opensandbox-group/OpenSandbox/pull/1481) [#1474](https://github.com/opensandbox-group/OpenSandbox/pull/1474)
- **Pool capacity back-pressure** — Compatible lifecycle servers can now surface exhausted Kubernetes Pool capacity as HTTP 429 with `KUBERNETES::POOL_CAPACITY_EXHAUSTED` and `Retry-After`, instead of eventually reporting a generic readiness timeout. Sandbox creation remains non-idempotent and is not automatically replayed on this status. [#1581](https://github.com/opensandbox-group/OpenSandbox/pull/1581)

### ⚡ Performance

- **Faster sandbox startup** — Async sandbox creation, connection, and resume resolve execd and egress endpoints concurrently, reducing the two management API lookups to one parallel wait. Failure propagation and create cleanup semantics remain unchanged. [#1531](https://github.com/opensandbox-group/OpenSandbox/pull/1531)
- **Bounded parallel Pool cleanup** — Idle sandbox release uses bounded concurrency while preserving best-effort cleanup and legacy public behavior. The measured 100-sandbox cleanup in the PR dropped from about 8.3 seconds to 0.8 seconds. [#1475](https://github.com/opensandbox-group/OpenSandbox/pull/1475)

### 🐛 Bug Fixes

- **Standards-compliant SSE parsing** — Command and isolated execution streams now use SSE-specific framing, preserving Unicode separators inside JSON strings while remaining compatible with legacy bare-JSON frames. [#1444](https://github.com/opensandbox-group/OpenSandbox/pull/1444)
- **Reliable background command completion** — Background command streams stop after `execution_complete`, preventing false `RemoteProtocolError` failures when the peer closes before the final HTTP terminator. Foreground streaming behavior is unchanged. [#1532](https://github.com/opensandbox-group/OpenSandbox/pull/1532)
- **Endpoint cache race fix** — Completing an older endpoint fetch no longer removes a newer replacement inflight fetch in async or sync clients. [#1567](https://github.com/opensandbox-group/OpenSandbox/pull/1567)
- **More useful API errors** — Unstructured 4xx and 5xx response bodies are included in exception messages and remain available as raw `response_body` bytes. HTTP 429 responses use `SandboxRateLimitException` and expose parsed `retry_after` when present. [#1496](https://github.com/opensandbox-group/OpenSandbox/pull/1496) [#1372](https://github.com/opensandbox-group/OpenSandbox/pull/1372)
- **Cleaner readiness diagnostics** — Readiness timeout messages retain timing, connection context, and the last health-check error without suggesting deployment-specific network fixes that may not apply. [#1493](https://github.com/opensandbox-group/OpenSandbox/pull/1493)

### 📦 Misc

- Regenerated lifecycle models, bumped the package fallback version to `0.1.16`, and aligned async and sync default User-Agent strings with the release. [#1622](https://github.com/opensandbox-group/OpenSandbox/pull/1622) [#1623](https://github.com/opensandbox-group/OpenSandbox/pull/1623)

### 👥 Contributors

- @Pangjiping
- @bcfre
- @cwj2001
- @hpliStartAgain
- @jianpingpei
- @mameikagou
- @ninan-nn
- @wakqasahmed
- @zpzjzj