Skip to content

Conversation

@dobrac
Copy link
Contributor

@dobrac dobrac commented Jan 31, 2025

Changes the following

  • Adds auto pause to SDK, requires having autoPause: true and auto_pause=True
  • Replaces sandbox resume with connect
  • Updates sandbox timeout on connect if it's already running

SDK Change
The autoPause option is required, and has to be set to true.

JS

Sandbox.create({ autoPause: true })
Sandbox.connect(sandboxId, {autoPause: true})

Python - Async

AsyncSandbox.create(auto_pause=True)
AsyncSandbox.connect(sandbox_id, auto_pause=True)

Python - Sync

Sandbox(auto_pause=True)
Sandbox.connect(sandbox_id, auto_pause=True)

For both Python implementations, the exit now calls .pause() instead of .kill()

Tasks

  • Update interface of connect, resume, etc
  • Add tests for JS SDK
  • Add tests for Python SDK
  • Update web documentation (not for now, until we know the final SDK DX)

Temporary solution for connect
There is a setTimeout for every connect to resolve issues where paused sandbox can immediately timeout.

Options discussed:
1. No set - never sure how long the sandbox will be running
2. Always set the timeout in code - the user can't just connect to the sandbox
without changing the timeout, round trip to the server time
3. Set the timeout in resume on backend - side effect on error
4. Create new endpoint for connect

0div and others added 30 commits January 24, 2025 16:46
This documents the new SDK method implemented
[here](#543)
run to => to run

🙂
Hide metrics route in the docs sidebar until the feature is fully
released
Added code snippets to documentation for using Groq with E2B.
show metrics route in the docs sidebar now that the metrics feature is
released
- Removed code runtime version check to prevent issues until further investigation
Adds recursive directory watch to the SDK and documentation section.
Requires merging and deploying e2b-dev/infra#210
first.

### Proposed API change:
**JS**
```js
await sandbox.files.watchDir(dirname, handler, {
  recursive: true
})
```

**Python**
```py
sandbox.files.watch_dir(dirname, recursive=True)
```


---

### Notes

Python SDK was generated using buf.build/protocolbuffers/python:v28.3.
The runtime check was removed for now. Further tests might be required
to make sure the runtime is at least the generated version before
including the runtime check.
Changing the following in the file spec/envd/buf-python.gen.yaml
(generator) allows using different protoc-gen-python version:
From: `plugin: python`
To: `plugin: buf.build/protocolbuffers/python:v28.3`
jakubno and others added 15 commits April 5, 2025 20:38
# Description

The response from backend for port is actual integer
# Description

The test was moved to integration tests directly in infra repo
# Description 

This PR allows to codegen without worrying about your environment and
dependencies for consistent outcomes in what code is generated from
openapi and envd protobuf spec. Will generate files for `js-sdk` and
`python-sdk`

- [x] create Docker image with all the pinned deps needed to codegen
- [x] create codegen script using this container with mapped volumes
- [x] adapt Makefiles to this new approach
- [x] adapt where we install the connect-python protobuf binary for this
to work

# Test

```sh
make codegen # this command is similar to `make generate` but w/o the hassle

Generating SDK code from openapi and envd spec
cd packages/js-sdk && pnpm generate

> [email protected] generate /workspace/packages/js-sdk
> python ./../../spec/remove_extra_tags.py sandboxes templates && openapi-typescript ../../spec/openapi_generated.yml -x api_key --arr
ay-length --alphabetize --output src/api/schema.gen.ts

✨ openapi-typescript 7.6.1
🚀 ../../spec/openapi_generated.yml → src/api/schema.gen.ts [44.2ms]
cd packages/js-sdk && pnpm generate-envd-api

> [email protected] generate-envd-api /workspace/packages/js-sdk
> openapi-typescript ../../spec/envd/envd.yaml -x api_key --array-length --alphabetize --output src/envd/schema.gen.ts

✨ openapi-typescript 7.6.1
🚀 ../../spec/envd/envd.yaml → src/envd/schema.gen.ts [22.7ms]

[...]

cd packages/python-sdk && make generate-api

All done! ✨ 🍰 ✨
```

---------

Co-authored-by: Jiri Sveceny <[email protected]>
One should now be able to use sb.filesystem.write(WriteEntry[]) in a
typesafe way.

---------

Co-authored-by: Mish <[email protected]>
There was a type in dataclass declaration that caused the WriteEntry to
behave incorrectly.
…lder during publish (#682)

### Description 

This was initially performed in [the legacy
workflow](https://github.com/e2b-dev/E2B/blob/d27f81c5d3a85e2791258e388eb7ebd5f2e5eaa9/.github/workflows/generate_sdk_ref.yml#L101-L117)
but has since been removed, adding it back to have latest [desktop &
code-interpreter SDK references](https://e2b.dev/docs/sdk-reference) on
our docs

### Test
<img width="234" alt="Screenshot 2025-04-15 at 1 47 16 PM"
src="https://github.com/user-attachments/assets/b00347d9-794d-41f1-98db-c4704c59f50d"
/>


#### should become:

- [ ] desktop:
  - [ ] js-sdk `v1.7.01@latest`
  - [ ] python-sdk `v1.6.1@latest`
- [ ] code-interpreter
  - [ ] js-sdk `v1.1.1@latest`
  - [ ] python-sdk `v1.2.0@latest`
Because our docs nextjs app is being proxied by our dashboard nextjs
app, we need to ensure the docs nextjs app uses absolute urls to handle
it's assets. Because when it is proxied by another nextjs app, the proxy
tries to reference the docs nextjs apps assets relatively, which results
in assets not being found.

Before this pr, we set an assetPrefix for every node production
deployment, which caused issues on preview deployments, since these can
consist of multiple assigned domains and depending on which one was
opened, the asset prefixing failed.

These changes ensure that only the production deployment of the docs
application has an assetPrefix. Here we can be certain on which domain
it will live. I created a new environment variable `PRODUCTION_URL` here
to ensure 100% consistency with `e2b-dev/dashboard`s proxy domain
config, without relying on the vercel projects assigned domain setup.
Add latest changes in main to the auto-pause feature branch 

- [x] python-sdk
  - [x] successful build?
  - [x] successful unit tests? 
- [x] js-sdk
  - [x] successful build?
  - [x] successful unit tests?

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: Ben Fornefeld <[email protected]>
Co-authored-by: never not exploring <[email protected]>
Co-authored-by: Vasek Mlejnsky <[email protected]>
Co-authored-by: Vasek Mlejnsky <[email protected]>
Co-authored-by: handlebauer <[email protected]>
Co-authored-by: Tereza Tizkova <[email protected]>
Co-authored-by: tizkovatereza <[email protected]>
Co-authored-by: Jakub Dobrý <[email protected]>
Co-authored-by: Jakub Novak <[email protected]>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Tomas Valenta <[email protected]>
Co-authored-by: r33drichards <[email protected]>
Co-authored-by: James Murdza <[email protected]>
Co-authored-by: yushengchen <[email protected]>
Co-authored-by: Ziray Hao <[email protected]>
Co-authored-by: Mish Ushakov <[email protected]>
Co-authored-by: Ziray Hao <[email protected]>
Co-authored-by: Jiri Sveceny <[email protected]>
Co-authored-by: yusheng chen <[email protected]>
Co-authored-by: David Batey <[email protected]>
Co-authored-by: Penny Templeton <[email protected]>
mishushakov and others added 4 commits April 17, 2025 17:56
- Added notices in "Connect to running sandbox", "Sandbox metadata"
docs.
- Updated "List sandboxes", "Sandbox persistence" docs.
- Renamed route "List running sandboxes"  > "List sandboxes".
- [x] js-sdk
  - [x] successful build?
  - [x] successful unit tests?
- [x] python-sdk
  - [x] successful build?
  - [x] successful unit tests?

---------

Co-authored-by: Jakub Novak <[email protected]>
Co-authored-by: Tomáš Rychlik <[email protected]>
Co-authored-by: Mish <[email protected]>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
@ValentaTomas
Copy link
Member

Merged via #854

@ValentaTomas ValentaTomas deleted the add-autopause-option-to-sdk-e2b-1461 branch October 7, 2025 03:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature or request sdk-preview Released in the SDK preview

Projects

None yet

Development

Successfully merging this pull request may close these issues.