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). diff --git a/template/README.md b/template/README.md index 31f89a90..4f64fabe 100644 --- a/template/README.md +++ b/template/README.md @@ -1,8 +1,37 @@ -# Using custom sandbox with Code Interpreter SDK +# Code Interpreter + +## Building the production template + +To build the official `code-interpreter-v1` template from this repo, use +`build_prod.py`. This is the script CI and releases run. + +1. Install the build dependencies: + +``` +pip install -r requirements-dev.txt +``` + +2. Provide your credentials in `.env`: + +``` +E2B_API_KEY=e2b_*** +``` + +3. Build the template: + +``` +python build_prod.py +``` + +Set `SKIP_CACHE=true` to force a clean rebuild that ignores the layer cache: + +``` +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). -## Step-by-step guide +## Creating a custom template 1. Install E2B SDK @@ -40,13 +69,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