From aeadd0809fe259ff6c0fbb3a7361d5219b5eabd4 Mon Sep 17 00:00:00 2001 From: Mish Ushakov <10400064+mishushakov@users.noreply.github.com> Date: Fri, 5 Jun 2026 15:08:21 +0200 Subject: [PATCH 1/5] docs: document building the template with build_prod.py Rename the customizing section, add an env-vars step, and document building the production template via template/build_prod.py. Co-Authored-By: Claude Opus 4.8 --- template/README.md | 41 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 38 insertions(+), 3 deletions(-) diff --git a/template/README.md b/template/README.md index 31f89a90..34f1beb9 100644 --- a/template/README.md +++ b/template/README.md @@ -1,4 +1,4 @@ -# Using custom sandbox with Code Interpreter SDK +# Customizing the Code Interpreter template If you want to customize the Code Interpreter sandbox (e.g.: add a preinstalled package) you can do that by creating a [custom sandbox template](https://e2b.dev/docs/template/quickstart). @@ -40,13 +40,19 @@ Template.build( ) ``` -3. Build the template: +4. Set your environment variables in a `.env` file (loaded by `load_dotenv()`): + +``` +E2B_API_KEY=e2b_*** +``` + +5. Build the template: ``` python build.py ``` -4. Use the custom template: +6. Use the custom template: ```python from e2b import Sandbox @@ -56,6 +62,35 @@ execution = sbx.run_code("print('Hello, World!')") print(execution.logs.stdout) ``` +## Building the production template + +To build the official `code-interpreter-v1` template from this repo, use +`template/build_prod.py`. This is the script CI and releases run. + +1. Install the build dependencies: + +``` +pip install -r template/requirements-dev.txt +``` + +2. Provide your credentials in `template/.env`: + +``` +E2B_API_KEY=e2b_*** +``` + +3. Build the template: + +``` +python template/build_prod.py +``` + +Set `SKIP_CACHE=true` to force a clean rebuild that ignores the layer cache: + +``` +SKIP_CACHE=true python template/build_prod.py +``` + ## Debugging a server that won't start The template runs Jupyter and the code-interpreter server as **systemd** From 023fd0fc86a8e5198b02791e6891950940edf6b4 Mon Sep 17 00:00:00 2001 From: Mish Ushakov <10400064+mishushakov@users.noreply.github.com> Date: Fri, 5 Jun 2026 15:12:03 +0200 Subject: [PATCH 2/5] Update README.md --- template/README.md | 62 +++++++++++++++++++++++----------------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/template/README.md b/template/README.md index 34f1beb9..c5d45bdd 100644 --- a/template/README.md +++ b/template/README.md @@ -1,8 +1,37 @@ -# Customizing the Code Interpreter template +# Code Interpreter + +## Building the production template + +To build the official `code-interpreter-v1` template from this repo, use +`template/build_prod.py`. This is the script CI and releases run. + +1. Install the build dependencies: + +``` +pip install -r template/requirements-dev.txt +``` + +2. Provide your credentials in `template/.env`: + +``` +E2B_API_KEY=e2b_*** +``` + +3. Build the template: + +``` +python template/build_prod.py +``` + +Set `SKIP_CACHE=true` to force a clean rebuild that ignores the layer cache: + +``` +SKIP_CACHE=true python template/build_prod.py +``` If you want to customize the Code Interpreter sandbox (e.g.: add a preinstalled package) you can do that by creating a [custom sandbox template](https://e2b.dev/docs/template/quickstart). -## Step-by-step guide +## Creating a custom template 1. Install E2B SDK @@ -62,35 +91,6 @@ execution = sbx.run_code("print('Hello, World!')") print(execution.logs.stdout) ``` -## Building the production template - -To build the official `code-interpreter-v1` template from this repo, use -`template/build_prod.py`. This is the script CI and releases run. - -1. Install the build dependencies: - -``` -pip install -r template/requirements-dev.txt -``` - -2. Provide your credentials in `template/.env`: - -``` -E2B_API_KEY=e2b_*** -``` - -3. Build the template: - -``` -python template/build_prod.py -``` - -Set `SKIP_CACHE=true` to force a clean rebuild that ignores the layer cache: - -``` -SKIP_CACHE=true python template/build_prod.py -``` - ## Debugging a server that won't start The template runs Jupyter and the code-interpreter server as **systemd** From 4497bc82be9123fbcddd000a90784186a05a646b Mon Sep 17 00:00:00 2001 From: Mish Ushakov <10400064+mishushakov@users.noreply.github.com> Date: Fri, 5 Jun 2026 15:13:07 +0200 Subject: [PATCH 3/5] Update README.md --- template/README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/template/README.md b/template/README.md index c5d45bdd..a6c1aeb9 100644 --- a/template/README.md +++ b/template/README.md @@ -8,10 +8,10 @@ To build the official `code-interpreter-v1` template from this repo, use 1. Install the build dependencies: ``` -pip install -r template/requirements-dev.txt +pip install -r requirements-dev.txt ``` -2. Provide your credentials in `template/.env`: +2. Provide your credentials in `.env`: ``` E2B_API_KEY=e2b_*** @@ -20,13 +20,13 @@ E2B_API_KEY=e2b_*** 3. Build the template: ``` -python template/build_prod.py +python build_prod.py ``` Set `SKIP_CACHE=true` to force a clean rebuild that ignores the layer cache: ``` -SKIP_CACHE=true python template/build_prod.py +SKIP_CACHE=true python build_prod.py ``` If you want to customize the Code Interpreter sandbox (e.g.: add a preinstalled package) you can do that by creating a [custom sandbox template](https://e2b.dev/docs/template/quickstart). From c20d0cd5d755cdad39b14657e2d2cd37c4867ce1 Mon Sep 17 00:00:00 2001 From: Mish Ushakov <10400064+mishushakov@users.noreply.github.com> Date: Fri, 5 Jun 2026 15:13:48 +0200 Subject: [PATCH 4/5] Update README.md --- template/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/template/README.md b/template/README.md index a6c1aeb9..4f64fabe 100644 --- a/template/README.md +++ b/template/README.md @@ -3,7 +3,7 @@ ## Building the production template To build the official `code-interpreter-v1` template from this repo, use -`template/build_prod.py`. This is the script CI and releases run. +`build_prod.py`. This is the script CI and releases run. 1. Install the build dependencies: From 49a4972db88afd4b34bba39659961b11c8436343 Mon Sep 17 00:00:00 2001 From: Mish Ushakov <10400064+mishushakov@users.noreply.github.com> Date: Fri, 5 Jun 2026 15:14:41 +0200 Subject: [PATCH 5/5] docs: reference template guide from main README Co-Authored-By: Claude Opus 4.8 --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 4e6c788a..1b5216f9 100644 --- a/README.md +++ b/README.md @@ -72,3 +72,6 @@ Visit [E2B documentation](https://e2b.dev/docs). ### 5. E2B cookbook Visit our [Cookbook](https://github.com/e2b-dev/e2b-cookbook/tree/main) to get inspired by examples with different LLMs and AI frameworks. + +## Customizing the sandbox template +Need extra packages or a different runtime? You can build your own Code Interpreter sandbox template. See the [template guide](/template/README.md) for a step-by-step walkthrough of creating, building, and using a custom template (as well as building the production `code-interpreter-v1` template).