Add auto pause on timeout to SDK#568
Closed
dobrac wants to merge 415 commits intoadd-pause-and-resume-to-sdk-e2b-1190from
Closed
Add auto pause on timeout to SDK#568dobrac wants to merge 415 commits intoadd-pause-and-resume-to-sdk-e2b-1190from
dobrac wants to merge 415 commits intoadd-pause-and-resume-to-sdk-e2b-1190from
Conversation
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`
# 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 > e2b@1.2.1 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 > e2b@1.2.1 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 <jiri.sveceny@icloud.com>
- Minor type fix
One should now be able to use sb.filesystem.write(WriteEntry[]) in a typesafe way. --------- Co-authored-by: Mish <10400064+mishushakov@users.noreply.github.com>
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] <support@github.com> Co-authored-by: Ben Fornefeld <ben.fornefeld@gmail.com> Co-authored-by: never not exploring <50748440+ben-fornefeld@users.noreply.github.com> Co-authored-by: Vasek Mlejnsky <vasek.mlejnsky@gmail.com> Co-authored-by: Vasek Mlejnsky <vasek@e2b.dev> Co-authored-by: handlebauer <hi@donaldgeddes.ca> Co-authored-by: Tereza Tizkova <tereza@e2b.dev> Co-authored-by: tizkovatereza <135881365+tizkovatereza@users.noreply.github.com> Co-authored-by: Jakub Dobrý <jakub.dobry8@gmail.com> Co-authored-by: Jakub Novak <jakub@e2b.dev> 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 <valenta.and.thomas@gmail.com> Co-authored-by: r33drichards <rwendt1337@gmail.com> Co-authored-by: James Murdza <james@jamesmurdza.com> Co-authored-by: yushengchen <yushengchen@nine-yi.com> Co-authored-by: Ziray Hao <ziray.hao@gmail.com> Co-authored-by: Mish Ushakov <10400064+mishushakov@users.noreply.github.com> Co-authored-by: Ziray Hao <45774151+ziruihao@users.noreply.github.com> Co-authored-by: Jiri Sveceny <jiri.sveceny@icloud.com> Co-authored-by: yusheng chen <55658154+samuel871211@users.noreply.github.com> Co-authored-by: David Batey <davidlbatey@gmail.com> Co-authored-by: Penny Templeton <92920463+p-templeton@users.noreply.github.com>
- Added notices in "Connect to running sandbox", "Sandbox metadata" docs. - Updated "List sandboxes", "Sandbox persistence" docs. - Renamed route "List running sandboxes" > "List sandboxes".
…use-option-to-sdk-e2b-1461
- [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 <jakub@e2b.dev> Co-authored-by: Tomáš Rychlik <rychlis@rychlis.cz> Co-authored-by: Mish <10400064+mishushakov@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Member
|
Merged via #854 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes the following
autoPause: trueandauto_pause=TrueresumewithconnectSDK Change
The autoPause option is required, and has to be set to true.
JS
Python - Async
Python - Sync
For both Python implementations, the exit now calls .pause() instead of .kill()
Tasks
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