<!-- CURSOR_SUMMARY -->
> [!NOTE]
> Use new connect API for JS/Python SDKs to connect and only extend
(never shorten) running sandbox timeouts, with updated types/docs and
tests.
>
> - **SDKs**:
> - **JS**:
> - Replace `resume`/`setTimeout` flow with `SandboxApi.connectSandbox`
calling `POST /sandboxes/{sandboxID}/connect`.
> - Update `Sandbox.connect` (static/instance) to use returned
`sandboxDomain`, `envdAccessToken`, `envdVersion`.
> - Redefine `SandboxConnectOpts` to include `timeoutMs` that only
extends existing timeout.
> - **Python (async/sync)**:
> - Introduce `_cls_connect` using `post_sandboxes_sandbox_id_connect`
with `ConnectSandbox`; return `Sandbox` model.
> - Update `connect` methods to use API response for
domain/token/version; remove extra info fetch.
> - Docstrings clarify timeout only extends for running sandboxes.
> - **Tests**:
> - Add cases ensuring connect does not shorten timeout and does extend
when longer (JS, async Python, sync Python).
> - Preserve error on connecting to non-running sandbox.
> - **Meta**:
> - Changeset: minor releases for `@e2b/python-sdk`, `e2b`, and
`@e2b/cli`.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
e76b07990cb4c05e51ba1c51fb5cc7bbd44b991b. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
<!-- CURSOR_SUMMARY -->
> [!NOTE]
> Adds `fromBunImage` and `bunInstall` to JS/Python SDKs, and extends
`npmInstall` with a `dev` flag, with tests across sync/async suites.
>
> - **Template APIs**:
> - Add `fromBunImage` to start from `oven/bun:<variant>` in
`packages/js-sdk/src/template/index.ts` and
`packages/python-sdk/e2b/template/main.py`.
> - Add `bunInstall(packages, { g, dev })` in both SDKs.
> - Extend `npmInstall` to accept `{ dev: boolean }` in both SDKs.
> - **Types/Docs**:
> - Update `packages/js-sdk/src/template/types.ts` to declare
`fromBunImage`, `bunInstall`, and `npmInstall` `dev` option.
> - **Tests**:
> - Add tests for `fromBunImage` and `bunInstall` and update
`npmInstall` (global/dev) in JS (`packages/js-sdk/tests/...`) and Python
sync/async (`packages/python-sdk/tests/...`).
> - **Changeset**:
> - Minor releases for `@e2b/python-sdk` and `e2b`
(`.changeset/silly-lions-buy.md`).
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
b6461d015743d38ba014d724167d2ca256cf7951. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
for building type-safe wrappers around .setStartCmd/.setReadyCmd
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> Expose `ReadyCmd` via JS (`packages/js-sdk/src/index.ts`) and Python
(`e2b/__init__.py`) SDK entrypoints, with patch version bumps.
>
> - **SDK Exports**:
> - **JS**: Re-exports `ReadyCmd` from `./template/readycmd` in
`packages/js-sdk/src/index.ts`.
> - **Python**: Exposes `ReadyCmd` in `e2b/__init__.py` imports and
`__all__`.
> - **Versioning**:
> - `.changeset/early-trainers-repeat.md`: Patch bumps for
`@e2b/python-sdk` and `e2b`.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
ff91a3e3578be8db6ea7644ee6717f1bd18b0165. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
Here's what it will look like. This highlights that the files are no
longer used.
```
🔄 Migrating template configuration to SDK format...
Using language: TypeScript
✅ Generated TypeScript template files:
./template.ts
./build.dev.ts
./build.prod.ts
📁 Old template files no longer needed:
./e2b.Dockerfile → ./e2b.Dockerfile.old
./e2b.toml → ./e2b.toml.old
🎉 Migration completed successfully!
🔨 You can now build your template using:
npx tsx build.dev.ts (for development)
npx tsx build.prod.ts (for production)
Learn more about Template SDK: https://e2b.dev/docs
```
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> Post-migration, the CLI renames `e2b.Dockerfile` and `e2b.toml` to
`.old` and refactors migration to use Dockerfile content directly.
>
> - **CLI Template Migration
(`packages/cli/src/commands/template/migrate.ts`)**
> - **Refactor**: `migrateToLanguage` now accepts `dockerfileContent`
(string) instead of a path; Dockerfile retrieval moved to the command
action via `getDockerfile`.
> - **Post-migration cleanup**: Renames `e2b.Dockerfile` and `e2b.toml`
to `*.old` if present and logs old→new paths.
> - Minor output tweaks (status messages/icons).
> - **Tests (`packages/cli/tests/commands/template/migrate.test.ts`)**
> - Add checks ensuring `e2b.Dockerfile.old` and `e2b.toml.old` exist
and originals are removed across fixtures/languages.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
5fc1add2ac8e688b7509c299211b53ac6b09188e. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
<!-- CURSOR_SUMMARY -->
> [!NOTE]
> Adds a force option to makeSymlink that passes -f to ln, with
typings/docs and tests across JS and Python SDKs.
>
> - **Template symlink enhancement**
> - **JS SDK (`packages/js-sdk`)**:
> - `makeSymlink(src, dest, options)` now accepts `{ user?: string;
force?: boolean }` and appends `-f` when `force` is true in
`src/template/index.ts`.
> - Types updated in `src/template/types.ts`, including example usage
with `{ force: true }`.
> - Tests added in `tests/template/methods/makeSymlink.test.ts` (regular
and forced).
> - **Python SDK (`packages/python-sdk`)**:
> - `make_symlink(src, dest, user=None, force=False)` now supports
`force` and appends `-f` when true in `e2b/template/main.py`.
> - Docstring examples updated to include `force=True`.
> - Tests added for async and sync in
`tests/async/template_async/methods/test_make_symlink.py` and
`tests/sync/template_sync/methods/test_make_symlink.py`.
> - **Release**:
> - Changeset added for patch releases of `@e2b/python-sdk` and `e2b`.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
6c5bbf9edfc7234b703046f387d11b8f10a002ab. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
This was causing some unexpected issues if users were trying to
apt-install some packages that needed recommended dependencies.
<!-- CURSOR_SUMMARY -->
> [!NOTE]
> Adds an option to `aptInstall`/`apt_install` to toggle
`--no-install-recommends`, updates typings/docs, and adds tests for both
modes.
>
> - **Template APIs**:
> - **JS SDK (`packages/js-sdk`)**:
> - `aptInstall` now accepts `options?: { noInstallRecommends?: boolean
}` and conditionally includes `--no-install-recommends`.
> - Types updated in `src/template/types.ts` with example usage.
> - **Python SDK (`packages/python-sdk`)**:
> - `apt_install` now accepts `no_install_recommends: bool = False` and
conditionally includes `--no-install-recommends`.
> - **Tests**:
> - JS: Add `aptInstall` tests (with and without `noInstallRecommends`);
refactor `npmInstall` tests to use `buildTemplateTest` helper.
> - Python: Add async and sync tests for `apt_install` with and without
`no_install_recommends`.
> - **Changeset**:
> - Patch bumps for `@e2b/python-sdk` and `e2b` with note on making
`--no-install-recommends` optional.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
3963b7daca73f1cfb99f405b09fbfb86c40c4b4f. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
The "lts" tag was unavailable on Docker Hub
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> Switch default Ubuntu image tag from 'lts' to 'latest' across
JS/Python SDKs and expand/refactor template tests and test config.
>
> - **SDKs**:
> - **Ubuntu default**: Change `fromUbuntuImage`/`from_ubuntu_image`
default variant from `'lts'` to `'latest'` in
`packages/js-sdk/src/template/index.ts` and
`packages/python-sdk/e2b/template/main.py`; update TS docs in
`packages/js-sdk/src/template/types.ts`.
> - **Tests**:
> - **JS**: Refactor template tests to use `buildTemplateTest`, add
`tests/template/methods/fromMethods.test.ts`, adjust npm/pip/runCmd
tests (include user install with `g: false`), and remove per-test
timeouts where not needed.
> - **Python (async/sync)**: Add comprehensive tests for from* methods,
npm/pip installs (including user installs), and runCmd behaviors; switch
to shared build fixtures.
> - **Vitest config**: Exclude `tests/template/**` from the main suite
and include all template tests in a dedicated project in
`vitest.workspace.mts`.
> - **Changeset**:
> - Patch bumps for `@e2b/python-sdk` and `e2b`.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
0bf3a7c15122d28cbc99b8faa44e7e217f634377. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
This allows you to set E2B_API_URL and override the entire API URL in
the CLI and the SDK
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> Adds API URL override to the JS SDK `ConnectionConfig` (via `apiUrl`
option or `E2B_API_URL`), with tests and test config updates.
>
> - **JS SDK**:
> - **ConnectionConfig**: Add `apiUrl` option and resolve priority
`opts.apiUrl` → `E2B_API_URL` → `debug ? http://localhost:3000 :
https://api.${domain}`; add static `apiUrl` env getter.
> - **Tests**:
> - Add `tests/connectionConfig.test.ts` covering defaults, arg/env
override, and priority.
> - Update `vitest.workspace.mts` to exclude this test from the main
suite and run it in an isolated project with its own timeout.
> - **Release**:
> - Add changeset for patch bumps (`e2b`, `@e2b/cli`).
> - **Misc**:
> - Remove `packages/python-sdk/.tool-versions`.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
46a86cba18865bd34ed5561a040af7736955c4ea. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
---------
Co-authored-by: Tomas Valenta <valenta.and.thomas@gmail.com>
(no tests as nothin was breaking)
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> Adds an optional `user` parameter to fs-related template methods and
`gitClone`, with tests for running commands as specific users.
>
> - **SDKs**:
> - **JS (`packages/js-sdk`)**:
> - Add `user` option to `TemplateBuilder` methods: `remove`, `rename`,
`makeDir`, `makeSymlink`, and `gitClone`; pass through to `runCmd`.
> - Update type defs and examples in `src/template/types.ts`.
> - **Python (`packages/python-sdk`)**:
> - Add `user` arg to `TemplateBuilder` methods: `remove`, `rename`,
`make_dir`, `make_symlink`, and `git_clone`; forward to `run_cmd`.
> - Update docstrings/examples.
> - **Tests**:
> - JS: add `runCmd` tests for default, specific `user`, and invalid
user in `packages/js-sdk/tests/template/methods/runCmd.test.ts`.
> - Python: add async and sync `run_cmd` tests (default, specific
`user`, invalid user) in
`packages/python-sdk/tests/async/.../test_run_cmd.py` and
`packages/python-sdk/tests/sync/.../test_run_cmd.py`.
> - **Release**:
> - Add changeset (`.changeset/warm-seals-design.md`) marking patch
bumps for `@e2b/python-sdk` and `e2b`.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
b0cbedc1d5c136367155c5646859842bd666b0d9. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
This adds (experimantal) support to add arbitrary MCP server from
Github.
```python
sbx = await AsyncSandbox.beta_create(timeout=600, mcp={
"github/modelcontextprotocol/servers": {
"install_cmd": "npm install",
"run_cmd": "sudo npx -y @modelcontextprotocol/server-filesystem /root",
},
})
```
or in TS with better typing:
```typescript
const sandbox = await Sandbox.betaCreate({
mcp: {
duckduckgo: {},
'github/modelcontextprotocol/servers': {
installCmd: 'npm install',
runCmd: `sudo npx -y @modelcontextprotocol/server-filesystem /root`,
},
},
timeoutMs: 600_000,
});
```
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> Adds beta support to launch custom MCP servers (including
GitHub-defined ones) and updates MCP schemas/types; also switches
default MCP template to `mcp-gateway`.
>
> - **SDK (JS & Python)**:
> - Add beta support for `mcp` config, including dynamic GitHub-based
servers with custom `runCmd/installCmd/envs` and automatic `mcp-gateway`
startup with token.
> - Send `UNSET`/omit when `mcp` not provided to avoid API noise.
> - Change default MCP template from `mcp-gateway-v0-2` to
`mcp-gateway`.
> - **Types/Schema**:
> - Extend `McpServer` typings (JS `mcp.d.ts`, Python type hints) to
include many servers and descriptive metadata.
> - Introduce GitHub MCP types (TS `GitHubMcpServer`, Python
`GitHubMcpServerConfig`) and export in SDK surfaces.
> - Regenerate and enrich `spec/mcp-server.json` with
titles/descriptions and new server entries.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
f3139b8fc2f1246c72734d8048ba277a13e3949d. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
This will help for local development
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> Add support to override the API base URL via `api_url` parameter or
`E2B_API_URL` env var with clear precedence.
>
> - **Python SDK**:
> - **ConnectionConfig**:
> - Add `api_url` parameter and `_api_url()` env lookup (`E2B_API_URL`).
> - Resolve `api_url` in order: constructor arg > `E2B_API_URL` >
`debug` localhost or `https://api.<domain>`.
> - **API Params**:
> - Include `api_url` in `ApiParams` and propagate via `get_api_params`.
> - **Tests** (`packages/python-sdk/tests/test_connection_config.py`):
> - Verify default, arg override, env override, and precedence.
> - **Changeset**: Patch release for `@e2b/python-sdk`.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
9be6d4e85bb0ad8ea52ad61c77530ac72f231c54. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
<!-- CURSOR_SUMMARY -->
> [!NOTE]
> Fix Dockerfile generation to properly render `RUN` and `COPY`
instructions using only relevant args, and add patch changesets.
>
> - **Template to Dockerfile generation**:
> - JS (`packages/js-sdk/src/template/index.ts`): Special-case `RUN` and
`COPY` so Dockerfile emits `RUN <cmd>` and `COPY <src> <dest>` instead
of joining all args.
> - Python (`packages/python-sdk/e2b/template/main.py`): Same
special-casing for `RUN` and `COPY` during Dockerfile rendering.
> - **Release**:
> - Changeset: patch bumps for `@e2b/python-sdk` and `e2b` with note
"fix RUN and COPY handling in to_dockerfile".
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
04b2dbbda34f0845f3d4ec9963cc478b7b7b7f01. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
Previously the gateway was just fire and forget which lead to a race
condition when you immediately tried to access the mcp server, changed
the template to launch a daemon with healthcheck.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> Start MCP gateway synchronously with error checks and bump default MCP
template to `mcp-gateway-v0-2` across JS and Python SDKs.
>
> - **MCP Gateway startup**:
> - JS (`packages/js-sdk/src/sandbox/index.ts`): Start `mcp-gateway`
without background mode; validate exit code and throw on failure.
> - Python Async (`packages/python-sdk/e2b/sandbox_async/main.py`):
Await `mcp-gateway` start, remove background/timeout flags; raise on
non-zero exit.
> - Python Sync (`packages/python-sdk/e2b/sandbox_sync/main.py`): Run
`mcp-gateway` synchronously; check exit code and raise on failure.
> - **Defaults**:
> - Update `default_mcp_template` from `mcp-gateway-v0-1` to
`mcp-gateway-v0-2` in JS and Python SDKs.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
79e431c78bf384c970a5b1fede55071116a089c5. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
<!-- CURSOR_SUMMARY -->
> [!NOTE]
> Adds `mcp` config support for sandbox creation across API, JS, and
Python SDKs, and updates timeout tests to use explicit request timeouts.
>
> - **API/OpenAPI**:
> - Add `McpConfig` schema and `mcp` field to `NewSandbox` in
`spec/openapi.yml` and generated TS `schema.gen.ts`.
> - **JS SDK**:
> - `SandboxApi.createSandbox` sends `mcp` in POST body
(`packages/js-sdk/src/sandbox/sandboxApi.ts`).
> - Types updated to include `components["schemas"]["McpConfig"]`.
> - **Python SDK**:
> - Extend `NewSandbox` model and sandbox create flow to accept/pass
`mcp`; async/sync APIs propagate `mcp` to POST `/sandboxes`.
> - **Tests**:
> - Increase `is_running` request timeouts in timeout tests to reduce
flakiness (JS and Python).
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
04ad4e6d4947e33523b74aba2f703fa1e9c05e72. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
<!-- CURSOR_SUMMARY -->
> [!NOTE]
> Global installs for pip/npm now run as root; pip gains an option to
install per-user instead.
>
> - **Template SDKs**:
> - **JavaScript (`packages/js-sdk/src/template`)**:
> - `pipInstall` now supports `options: { g?: boolean }` (default
`true`); when `g` is `true`, runs as `root`, when `false`, adds `--user`
and runs as current user.
> - `npmInstall` runs as `root` when `options.g` is `true`.
> - **Python (`packages/python-sdk/e2b/template/main.py`)**:
> - `pip_install` now accepts `g: bool = True`; when `True`, runs as
`root`, when `False`, adds `--user` and runs as current user.
> - `npm_install` runs as `root` when `g` is `True`.
> - **Changeset**: patch bump for `@e2b/python-sdk` and `e2b` with note:
install global packages as sudo.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
6be5ba211f7d200d50ffca50c1751d455b3e2cfa. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
Set default user for Dockerfiles. Includes also small migrate fixes.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> Defaults Dockerfile-based templates to user 'user' and workdir
'/home/user', updates CLI templates (sudo start/ready, relative Python
import), and allows template migration without a config file.
>
> - **SDKs (Dockerfile parsing)**:
> - JS (`packages/js-sdk/src/template/dockerfileParser.ts`) and Python
(`packages/python-sdk/e2b/template/dockerfile_parser.py`): after
parsing, set defaults `setUser('user')` and `setWorkdir('/home/user')`.
> - **CLI Templates**:
> - Python build scripts: switch to relative import `from .template
import template`.
> - Generated template hbs: start/ready commands now prefixed with
`sudo`; removed explicit root/workdir before start/ready.
> - **CLI Migrate**:
> - Supports migration without `e2b.toml`; uses default config values
and prints a warning instead of exiting.
> - Initializes default config when missing; success messaging adjusted.
> - **Tests**:
> - Update fixtures to reflect new defaults (`set_user('user')`,
`set_workdir('/home/user')`, `sudo` start/ready, relative imports).
> - Relax error case to succeed with warning when config is missing.
> - Comment out stacktrace tests for `fromDockerfile` in JS/Python until
fixed.
> - **Changesets**: Patch bumps for `@e2b/cli`, `@e2b/python-sdk`, and
`e2b`.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
934dc3b23b5607f70d4a4f5b7a9413a9d04df28a. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
<!-- CURSOR_SUMMARY -->
> [!NOTE]
> Updates stacktrace tests to use root-owned paths for workdir/dir ops
and a more explicit failing set_user command in JS and Python
(async/sync) SDKs.
>
> - **Tests (stacktrace)**:
> - **JS SDK (`packages/js-sdk/tests/template/stacktrace.test.ts`)**:
> - `setWorkdir`: set user to `root` and change path to `/root/.bashrc`.
> - `setUser`: use `; exit 1` as the failing command.
> - **Python SDK**:
> - Async
(`packages/python-sdk/tests/async/template_async/test_stacktrace.py`):
> - `make_dir`, `set_workdir`: set user to `root` and target
`/root/.bashrc`.
> - `set_user`: use `; exit 1` as the failing command.
> - Sync
(`packages/python-sdk/tests/sync/template_sync/test_stacktrace.py`):
> - `make_dir`, `set_workdir`: set user to `root` and target
`/root/.bashrc`.
> - `set_user`: use `; exit 1` as the failing command.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
780023b3819f19ba908ccd794195e630bab2741b. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->