Skip to content

Commit 7b1ab39

Browse files
Add changelog and Code Interpreter warning for image variants
Add missing documentation for Sandbox SDK image optimization: - Create changelog entry for v0.6.0 image variants - Add Python image requirement warning to Code Interpreter API 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 632da3b commit 7b1ab39

File tree

2 files changed

+62
-0
lines changed

2 files changed

+62
-0
lines changed
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
---
2+
title: Sandbox SDK introduces lean and Python image variants
3+
description: Reduce Docker image size by up to 500MB with new image variants optimized for different workloads. Choose the lean image for shell and JavaScript execution or the Python variant for data science workflows.
4+
products:
5+
- agents
6+
- workers
7+
date: 2025-11-27
8+
---
9+
10+
The Sandbox SDK now provides two optimized Docker image variants to improve cold start times and reduce storage costs:
11+
12+
- **Default image** (~600-800MB): Lean image without Python, ideal for shell commands, JavaScript, and TypeScript execution
13+
- **Python image** (~1.3GB): Full-featured image with Python 3.11 and data science packages (matplotlib, numpy, pandas, ipython)
14+
15+
### Choosing the right image
16+
17+
Use the default image for most workloads:
18+
19+
```dockerfile
20+
FROM docker.io/cloudflare/sandbox:0.6.0
21+
```
22+
23+
Only use the Python variant if you need Python code execution with the [Code Interpreter API](/sandbox/api/interpreter/):
24+
25+
```dockerfile
26+
FROM docker.io/cloudflare/sandbox:0.6.0-python
27+
```
28+
29+
### Migration guide
30+
31+
**If you are NOT using Python code execution**, no changes are required. Your existing Dockerfile will automatically use the smaller default image on the next release.
32+
33+
**If you ARE using Python** (via `runCode()` or `createCodeContext()` with Python), update your Dockerfile to explicitly use the `-python` variant:
34+
35+
```dockerfile
36+
# Before (implicit Python support)
37+
FROM docker.io/cloudflare/sandbox:0.5.0
38+
39+
# After (explicit Python variant)
40+
FROM docker.io/cloudflare/sandbox:0.6.0-python
41+
```
42+
43+
Without this change, attempts to execute Python code on the lean image will return a clear error message indicating that the Python variant is required.
44+
45+
### Benefits
46+
47+
- **Faster cold starts**: The lean image is approximately 40% smaller
48+
- **Lower storage costs**: Reduced image size means less storage consumption
49+
- **Better performance**: Smaller images download and start faster in production
50+
- **Same functionality**: JavaScript and TypeScript execution work identically on both images
51+
52+
See the [Dockerfile reference](/sandbox/configuration/dockerfile/) for complete details on image variants and customization options.

src/content/docs/sandbox/api/interpreter.mdx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,16 @@ import { TypeScriptExample } from "~/components";
99

1010
Execute Python, JavaScript, and TypeScript code with support for data visualizations, tables, and rich output formats. Contexts maintain state (variables, imports, functions) across executions.
1111

12+
:::caution[Python execution requires Python image]
13+
To execute Python code, your Dockerfile must use the `-python` image variant:
14+
15+
```dockerfile
16+
FROM docker.io/cloudflare/sandbox:0.6.0-python
17+
```
18+
19+
JavaScript and TypeScript execution work with the default image. See [Dockerfile reference](/sandbox/configuration/dockerfile/) for image variant details.
20+
:::
21+
1222
## Methods
1323

1424
### `createCodeContext()`

0 commit comments

Comments
 (0)