├── .changeset ├── README.md └── config.json ├── .eslintrc.cjs ├── .gitattributes ├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md ├── scripts │ ├── is_new_sdk_ref.sh │ ├── is_release.sh │ └── is_release_for_package.sh └── workflows │ ├── cli_tests.yml │ ├── js_sdk_tests.yml │ ├── lint.yml │ ├── publish_packages.yml │ ├── python_sdk_tests.yml │ ├── release.yml │ ├── release_candidates.yml │ ├── supabase.yml │ └── templates.yml ├── .gitignore ├── .npmrc ├── .prettierignore ├── .prettierrc ├── .vale.ini ├── .vscode ├── extensions.json ├── launch.json └── settings.json ├── CODEOWNERS ├── CONTRIBUTING.md ├── DEV.md ├── LICENSE ├── Makefile ├── README.md ├── apps └── web │ ├── .eslintignore │ ├── .eslintrc.json │ ├── .gitignore │ ├── .prettierignore │ ├── README.md │ ├── components.json │ ├── config.ts │ ├── mdx-components.tsx │ ├── next.config.mjs │ ├── package.json │ ├── postcss.config.js │ ├── prebuild.js │ ├── public │ └── .well-known │ │ └── security.txt │ ├── sentry.client.config.ts │ ├── sentry.edge.config.ts │ ├── sentry.server.config.ts │ ├── src │ ├── app │ │ ├── (docs) │ │ │ └── docs │ │ │ │ ├── api-key │ │ │ │ └── page.mdx │ │ │ │ ├── api-reference │ │ │ │ └── python-sdk │ │ │ │ │ └── v1.0.4 │ │ │ │ │ ├── exceptions │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── sandbox_async │ │ │ │ │ └── page.mdx │ │ │ │ │ └── sandbox_sync │ │ │ │ │ └── page.mdx │ │ │ │ ├── cli │ │ │ │ ├── auth │ │ │ │ │ └── page.mdx │ │ │ │ ├── list-sandboxes │ │ │ │ │ └── page.mdx │ │ │ │ ├── page.mdx │ │ │ │ └── shutdown-sandboxes │ │ │ │ │ └── page.mdx │ │ │ │ ├── code-interpreting │ │ │ │ ├── analyze-data-with-ai │ │ │ │ │ ├── page.mdx │ │ │ │ │ └── pre-installed-libraries │ │ │ │ │ │ └── page.mdx │ │ │ │ ├── create-charts-visualizations │ │ │ │ │ ├── interactive-charts │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── page.mdx │ │ │ │ │ └── static-charts │ │ │ │ │ │ └── page.mdx │ │ │ │ ├── streaming │ │ │ │ │ └── page.mdx │ │ │ │ └── supported-languages │ │ │ │ │ ├── bash │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── java │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── javascript │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── page.mdx │ │ │ │ │ ├── python │ │ │ │ │ └── page.mdx │ │ │ │ │ └── r │ │ │ │ │ └── page.mdx │ │ │ │ ├── commands │ │ │ │ ├── background │ │ │ │ │ └── page.mdx │ │ │ │ ├── page.mdx │ │ │ │ └── streaming │ │ │ │ │ └── page.mdx │ │ │ │ ├── filesystem │ │ │ │ ├── download │ │ │ │ │ └── page.mdx │ │ │ │ ├── page.mdx │ │ │ │ ├── read-write │ │ │ │ │ └── page.mdx │ │ │ │ ├── upload │ │ │ │ │ └── page.mdx │ │ │ │ └── watch │ │ │ │ │ └── page.mdx │ │ │ │ ├── legacy │ │ │ │ ├── cli │ │ │ │ │ ├── commands │ │ │ │ │ │ └── page.mdx │ │ │ │ │ └── installation │ │ │ │ │ │ └── page.mdx │ │ │ │ ├── code-interpreter │ │ │ │ │ ├── examples │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── execution │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── installation │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── kernels │ │ │ │ │ │ └── page.mdx │ │ │ │ │ └── template │ │ │ │ │ │ └── page.mdx │ │ │ │ ├── examples │ │ │ │ │ └── clone-repo │ │ │ │ │ │ └── page.mdx │ │ │ │ ├── getting-help │ │ │ │ │ └── page.mdx │ │ │ │ ├── getting-started │ │ │ │ │ ├── api-key │ │ │ │ │ │ └── page.mdx │ │ │ │ │ └── installation │ │ │ │ │ │ └── page.mdx │ │ │ │ ├── guide │ │ │ │ │ ├── beta-code-interpreter-language-runtimes │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── beta-migration │ │ │ │ │ │ └── page.mdx │ │ │ │ │ └── custom-sandbox │ │ │ │ │ │ └── page.mdx │ │ │ │ ├── hello-world │ │ │ │ │ ├── js │ │ │ │ │ │ └── page.mdx │ │ │ │ │ └── py │ │ │ │ │ │ └── page.mdx │ │ │ │ ├── open-source │ │ │ │ │ └── page.mdx │ │ │ │ ├── page.mdx │ │ │ │ ├── pricing │ │ │ │ │ └── page.mdx │ │ │ │ ├── sandbox │ │ │ │ │ ├── api │ │ │ │ │ │ ├── cwd │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ ├── debugging │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ ├── download │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ ├── envs │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ ├── filesystem │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ ├── metadata │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ ├── process │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ ├── reconnect │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ ├── timeouts │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ ├── upload │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ └── url │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── compute │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── custom │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── overview │ │ │ │ │ │ ├── features.tsx │ │ │ │ │ │ └── page.mdx │ │ │ │ │ └── templates │ │ │ │ │ │ ├── overview │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ └── template-file │ │ │ │ │ │ └── page.mdx │ │ │ │ └── supported │ │ │ │ │ └── page.mdx │ │ │ │ ├── page.mdx │ │ │ │ ├── quickstart │ │ │ │ ├── connect-llms │ │ │ │ │ └── page.mdx │ │ │ │ ├── install-custom-packages │ │ │ │ │ └── page.mdx │ │ │ │ ├── migrating-from-v0 │ │ │ │ │ └── page.mdx │ │ │ │ ├── page.mdx │ │ │ │ └── upload-download-files │ │ │ │ │ └── page.mdx │ │ │ │ ├── sandbox-template │ │ │ │ ├── customize-cpu-ram │ │ │ │ │ └── page.mdx │ │ │ │ ├── page.mdx │ │ │ │ └── start-cmd │ │ │ │ │ └── page.mdx │ │ │ │ ├── sandbox │ │ │ │ ├── connect-bucket │ │ │ │ │ └── page.mdx │ │ │ │ ├── connect │ │ │ │ │ └── page.mdx │ │ │ │ ├── environment-variables │ │ │ │ │ └── page.mdx │ │ │ │ ├── installing-beta-sdks │ │ │ │ │ └── page.mdx │ │ │ │ ├── internet-access │ │ │ │ │ └── page.mdx │ │ │ │ ├── list │ │ │ │ │ └── page.mdx │ │ │ │ ├── metadata │ │ │ │ │ └── page.mdx │ │ │ │ ├── metrics │ │ │ │ │ └── page.mdx │ │ │ │ ├── page.mdx │ │ │ │ └── persistence │ │ │ │ │ └── page.mdx │ │ │ │ ├── sdk-reference │ │ │ │ ├── cli │ │ │ │ │ ├── v1.0.0 │ │ │ │ │ │ ├── auth │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ ├── sandbox │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ └── template │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── v1.0.1 │ │ │ │ │ │ ├── auth │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ ├── sandbox │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ └── template │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── v1.0.10 │ │ │ │ │ │ ├── auth │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ ├── sandbox │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ └── template │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── v1.0.2 │ │ │ │ │ │ ├── auth │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ ├── sandbox │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ └── template │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── v1.0.3 │ │ │ │ │ │ ├── auth │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ ├── sandbox │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ └── template │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── v1.0.4 │ │ │ │ │ │ ├── auth │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ ├── sandbox │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ └── template │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── v1.0.5 │ │ │ │ │ │ ├── auth │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ ├── sandbox │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ └── template │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── v1.0.6 │ │ │ │ │ │ ├── auth │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ ├── sandbox │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ └── template │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── v1.0.7 │ │ │ │ │ │ ├── auth │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ ├── sandbox │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ └── template │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── v1.0.8 │ │ │ │ │ │ ├── auth │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ ├── sandbox │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ └── template │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── v1.0.9 │ │ │ │ │ │ ├── auth │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ ├── sandbox │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ └── template │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── v1.2.0 │ │ │ │ │ │ ├── auth │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ ├── sandbox │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ └── template │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── v1.2.1 │ │ │ │ │ │ ├── auth │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ ├── sandbox │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ └── template │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── v1.2.2 │ │ │ │ │ │ ├── auth │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ ├── sandbox │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ └── template │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── v1.2.3 │ │ │ │ │ │ ├── auth │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ ├── sandbox │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ └── template │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── v1.3.0 │ │ │ │ │ │ ├── auth │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ ├── sandbox │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ └── template │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── v1.3.1 │ │ │ │ │ │ ├── auth │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ ├── sandbox │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ └── template │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── v1.3.2 │ │ │ │ │ │ ├── auth │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ ├── sandbox │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ └── template │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── v1.3.3 │ │ │ │ │ │ ├── auth │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ ├── sandbox │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ └── template │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── v1.3.4 │ │ │ │ │ │ ├── auth │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ ├── sandbox │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ └── template │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── v1.4.0 │ │ │ │ │ │ ├── auth │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ ├── sandbox │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ └── template │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── v1.4.1 │ │ │ │ │ │ ├── auth │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ ├── sandbox │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ └── template │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── v1.4.2 │ │ │ │ │ │ ├── auth │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ ├── sandbox │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ └── template │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ └── v1.4.3 │ │ │ │ │ │ ├── auth │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ ├── sandbox │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ └── template │ │ │ │ │ │ └── page.mdx │ │ │ │ ├── code-interpreter-js-sdk │ │ │ │ │ ├── v1.0.4 │ │ │ │ │ │ ├── charts │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ ├── consts │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ ├── index │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ ├── messaging │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ └── sandbox │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── v1.1.0 │ │ │ │ │ │ ├── charts │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ ├── consts │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ ├── index │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ ├── messaging │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ └── sandbox │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── v1.1.1 │ │ │ │ │ │ ├── charts │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ ├── consts │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ ├── index │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ ├── messaging │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ └── sandbox │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── v1.2.0 │ │ │ │ │ │ ├── charts │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ ├── consts │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ ├── index │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ ├── messaging │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ └── sandbox │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── v1.5.0 │ │ │ │ │ │ ├── charts │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ ├── consts │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ ├── index │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ ├── messaging │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ └── sandbox │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ └── v1.5.1 │ │ │ │ │ │ ├── charts │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ ├── consts │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ ├── index │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ ├── messaging │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ └── sandbox │ │ │ │ │ │ └── page.mdx │ │ │ │ ├── code-interpreter-python-sdk │ │ │ │ │ ├── v1.0.1 │ │ │ │ │ │ └── sandbox │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── v1.0.2 │ │ │ │ │ │ └── sandbox │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── v1.0.3 │ │ │ │ │ │ └── sandbox │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── v1.0.4 │ │ │ │ │ │ └── sandbox │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── v1.0.5 │ │ │ │ │ │ └── sandbox │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── v1.1.0 │ │ │ │ │ │ └── sandbox │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── v1.1.1 │ │ │ │ │ │ └── sandbox │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── v1.2.0 │ │ │ │ │ │ └── sandbox │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── v1.2.1 │ │ │ │ │ │ └── sandbox │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── v1.5.0 │ │ │ │ │ │ └── sandbox │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ └── v1.5.1 │ │ │ │ │ │ └── sandbox │ │ │ │ │ │ └── page.mdx │ │ │ │ ├── desktop-js-sdk │ │ │ │ │ ├── v1.0.1 │ │ │ │ │ │ └── sandbox │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── v1.0.2 │ │ │ │ │ │ └── sandbox │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── v1.0.3 │ │ │ │ │ │ └── sandbox │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── v1.1.1 │ │ │ │ │ │ └── sandbox │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── v1.2.0 │ │ │ │ │ │ └── sandbox │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── v1.3.0 │ │ │ │ │ │ └── sandbox │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── v1.4.0 │ │ │ │ │ │ └── sandbox │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── v1.5.0 │ │ │ │ │ │ └── sandbox │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── v1.6.0 │ │ │ │ │ │ └── sandbox │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── v1.6.1 │ │ │ │ │ │ └── sandbox │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── v1.6.2 │ │ │ │ │ │ └── sandbox │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── v1.7.0 │ │ │ │ │ │ └── sandbox │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── v1.7.1 │ │ │ │ │ │ └── sandbox │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── v1.7.2 │ │ │ │ │ │ └── sandbox │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── v1.7.3 │ │ │ │ │ │ └── sandbox │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── v1.8.0 │ │ │ │ │ │ └── sandbox │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── v1.8.1 │ │ │ │ │ │ └── sandbox │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── v1.9.0 │ │ │ │ │ │ └── sandbox │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ └── v1.9.1 │ │ │ │ │ │ └── sandbox │ │ │ │ │ │ └── page.mdx │ │ │ │ ├── desktop-python-sdk │ │ │ │ │ ├── v1.0.1 │ │ │ │ │ │ └── sandbox │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── v1.0.2 │ │ │ │ │ │ └── sandbox │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── v1.0.3 │ │ │ │ │ │ └── sandbox │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── v1.1.1 │ │ │ │ │ │ └── sandbox │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── v1.2.0 │ │ │ │ │ │ └── sandbox │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── v1.3.0 │ │ │ │ │ │ └── sandbox │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── v1.4.0 │ │ │ │ │ │ └── sandbox │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── v1.5.0 │ │ │ │ │ │ └── sandbox │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── v1.5.1 │ │ │ │ │ │ └── sandbox │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── v1.5.2 │ │ │ │ │ │ └── sandbox │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── v1.6.0 │ │ │ │ │ │ └── sandbox │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── v1.6.1 │ │ │ │ │ │ └── sandbox │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── v1.6.2 │ │ │ │ │ │ └── sandbox │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── v1.6.3 │ │ │ │ │ │ └── sandbox │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── v1.6.4 │ │ │ │ │ │ └── sandbox │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── v1.6.5 │ │ │ │ │ │ └── sandbox │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── v1.7.0 │ │ │ │ │ │ └── sandbox │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── v1.7.1 │ │ │ │ │ │ └── sandbox │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ └── v1.7.2 │ │ │ │ │ │ └── sandbox │ │ │ │ │ │ └── page.mdx │ │ │ │ ├── js-sdk │ │ │ │ │ ├── v1.0.0 │ │ │ │ │ │ ├── errors │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ ├── filesystem │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ └── sandbox │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── v1.0.1 │ │ │ │ │ │ ├── errors │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ ├── filesystem │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ └── sandbox │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── v1.0.2 │ │ │ │ │ │ ├── errors │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ ├── filesystem │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ └── sandbox │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── v1.0.3 │ │ │ │ │ │ ├── errors │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ ├── filesystem │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ └── sandbox │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── v1.0.4 │ │ │ │ │ │ ├── errors │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ ├── filesystem │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ └── sandbox │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── v1.0.5 │ │ │ │ │ │ ├── commands │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ ├── errors │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ ├── filesystem │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ └── sandbox │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── v1.0.6 │ │ │ │ │ │ ├── commands │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ ├── errors │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ ├── filesystem │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ └── sandbox │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── v1.0.7 │ │ │ │ │ │ ├── commands │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ ├── errors │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ ├── filesystem │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ └── sandbox │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── v1.1.0 │ │ │ │ │ │ ├── commands │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ ├── errors │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ ├── filesystem │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ └── sandbox │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── v1.1.1 │ │ │ │ │ │ ├── commands │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ ├── errors │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ ├── filesystem │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ └── sandbox │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── v1.2.0 │ │ │ │ │ │ ├── commands │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ ├── errors │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ ├── filesystem │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ └── sandbox │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── v1.2.1 │ │ │ │ │ │ ├── commands │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ ├── errors │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ ├── filesystem │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ └── sandbox │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── v1.2.2 │ │ │ │ │ │ ├── commands │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ ├── errors │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ ├── filesystem │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ └── sandbox │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── v1.2.3 │ │ │ │ │ │ ├── commands │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ ├── errors │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ ├── filesystem │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ └── sandbox │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── v1.2.4 │ │ │ │ │ │ ├── commands │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ ├── errors │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ ├── filesystem │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ └── sandbox │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── v1.2.5 │ │ │ │ │ │ ├── commands │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ ├── errors │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ ├── filesystem │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ └── sandbox │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── v1.3.0 │ │ │ │ │ │ ├── commands │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ ├── errors │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ ├── filesystem │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ └── sandbox │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── v1.4.0 │ │ │ │ │ │ ├── commands │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ ├── errors │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ ├── filesystem │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ └── sandbox │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── v1.5.0 │ │ │ │ │ │ ├── commands │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ ├── errors │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ ├── filesystem │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ └── sandbox │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── v1.5.1 │ │ │ │ │ │ ├── commands │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ ├── errors │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ ├── filesystem │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ └── sandbox │ │ │ │ │ │ │ └── page.mdx │ │ │ │ │ └── v1.5.2 │ │ │ │ │ │ ├── commands │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ ├── errors │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ ├── filesystem │ │ │ │ │ │ └── page.mdx │ │ │ │ │ │ └── sandbox │ │ │ │ │ │ └── page.mdx │ │ │ │ ├── page.mdx │ │ │ │ └── python-sdk │ │ │ │ │ ├── v1.0.0 │ │ │ │ │ ├── exceptions │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── sandbox_async │ │ │ │ │ │ └── page.mdx │ │ │ │ │ └── sandbox_sync │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── v1.0.1 │ │ │ │ │ ├── exceptions │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── sandbox_async │ │ │ │ │ │ └── page.mdx │ │ │ │ │ └── sandbox_sync │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── v1.0.2 │ │ │ │ │ ├── exceptions │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── sandbox_async │ │ │ │ │ │ └── page.mdx │ │ │ │ │ └── sandbox_sync │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── v1.0.3 │ │ │ │ │ ├── exceptions │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── sandbox_async │ │ │ │ │ │ └── page.mdx │ │ │ │ │ └── sandbox_sync │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── v1.0.4 │ │ │ │ │ ├── exceptions │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── sandbox_async │ │ │ │ │ │ └── page.mdx │ │ │ │ │ └── sandbox_sync │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── v1.0.5 │ │ │ │ │ ├── exceptions │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── sandbox_async │ │ │ │ │ │ └── page.mdx │ │ │ │ │ └── sandbox_sync │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── v1.0.6 │ │ │ │ │ ├── exceptions │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── sandbox_async │ │ │ │ │ │ └── page.mdx │ │ │ │ │ └── sandbox_sync │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── v1.1.0 │ │ │ │ │ ├── exceptions │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── sandbox_async │ │ │ │ │ │ └── page.mdx │ │ │ │ │ └── sandbox_sync │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── v1.2.0 │ │ │ │ │ ├── exceptions │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── sandbox_async │ │ │ │ │ │ └── page.mdx │ │ │ │ │ └── sandbox_sync │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── v1.2.1 │ │ │ │ │ ├── exceptions │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── sandbox_async │ │ │ │ │ │ └── page.mdx │ │ │ │ │ └── sandbox_sync │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── v1.3.0 │ │ │ │ │ ├── exceptions │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── sandbox_async │ │ │ │ │ │ └── page.mdx │ │ │ │ │ └── sandbox_sync │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── v1.3.1 │ │ │ │ │ ├── exceptions │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── sandbox_async │ │ │ │ │ │ └── page.mdx │ │ │ │ │ └── sandbox_sync │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── v1.3.2 │ │ │ │ │ ├── exceptions │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── sandbox_async │ │ │ │ │ │ └── page.mdx │ │ │ │ │ └── sandbox_sync │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── v1.3.3 │ │ │ │ │ ├── exceptions │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── sandbox_async │ │ │ │ │ │ └── page.mdx │ │ │ │ │ └── sandbox_sync │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── v1.3.4 │ │ │ │ │ ├── exceptions │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── sandbox_async │ │ │ │ │ │ └── page.mdx │ │ │ │ │ └── sandbox_sync │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── v1.3.5 │ │ │ │ │ ├── exceptions │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── sandbox_async │ │ │ │ │ │ └── page.mdx │ │ │ │ │ └── sandbox_sync │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── v1.4.0 │ │ │ │ │ ├── exceptions │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── sandbox_async │ │ │ │ │ │ └── page.mdx │ │ │ │ │ └── sandbox_sync │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── v1.5.0 │ │ │ │ │ ├── exceptions │ │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── sandbox_async │ │ │ │ │ │ └── page.mdx │ │ │ │ │ └── sandbox_sync │ │ │ │ │ │ └── page.mdx │ │ │ │ │ └── v1.5.1 │ │ │ │ │ ├── exceptions │ │ │ │ │ └── page.mdx │ │ │ │ │ ├── sandbox_async │ │ │ │ │ └── page.mdx │ │ │ │ │ └── sandbox_sync │ │ │ │ │ └── page.mdx │ │ │ │ ├── support │ │ │ │ ├── Support.tsx │ │ │ │ └── page.mdx │ │ │ │ └── troubleshooting │ │ │ │ ├── sdks │ │ │ │ └── workers-edge-runtime │ │ │ │ │ └── page.mdx │ │ │ │ └── templates │ │ │ │ └── build-authentication-error │ │ │ │ └── page.mdx │ │ ├── api │ │ │ └── stream │ │ │ │ └── sandbox │ │ │ │ ├── [sandboxId] │ │ │ │ └── route.ts │ │ │ │ └── route.ts │ │ ├── favicon.ico │ │ ├── hostnames.ts │ │ ├── layout.tsx │ │ ├── not-found.tsx │ │ ├── opengraph-image.png │ │ ├── providers.tsx │ │ ├── robots.ts │ │ ├── sitemap.ts │ │ └── twitter-image.png │ ├── code │ │ ├── js │ │ │ ├── agents │ │ │ │ ├── clone_repo.js │ │ │ │ ├── code_exec.js │ │ │ │ ├── install_deps_npm.js │ │ │ │ └── start_process.js │ │ │ ├── api_key │ │ │ │ └── api_key.js │ │ │ ├── basics │ │ │ │ ├── download_file.js │ │ │ │ ├── fs_ls.js │ │ │ │ ├── fs_mkdir.js │ │ │ │ ├── fs_read.js │ │ │ │ ├── fs_read_bytes.js │ │ │ │ ├── fs_watch.js │ │ │ │ ├── fs_write.js │ │ │ │ ├── fs_write_bytes.js │ │ │ │ ├── get_url.js │ │ │ │ ├── get_url_port.js │ │ │ │ ├── init.js │ │ │ │ ├── metadata.js │ │ │ │ ├── process_env_vars.js │ │ │ │ ├── process_exit.js │ │ │ │ ├── process_start.js │ │ │ │ ├── process_stop.js │ │ │ │ ├── process_stream_stderr.js │ │ │ │ ├── process_stream_stdout.js │ │ │ │ ├── process_write_stdin.js │ │ │ │ ├── set_env_vars.js │ │ │ │ └── upload_file.js │ │ │ ├── code_exec │ │ │ │ └── process.js │ │ │ ├── cwd │ │ │ │ ├── filesystem.js │ │ │ │ ├── process.js │ │ │ │ └── sandbox.js │ │ │ ├── index.js │ │ │ ├── logging │ │ │ │ └── e2b_logging.js │ │ │ ├── package.json │ │ │ ├── processes │ │ │ │ └── background_processes.js │ │ │ ├── quickstart.js │ │ │ ├── reconnect │ │ │ │ ├── reconnect.js │ │ │ │ ├── reconnect_1.js │ │ │ │ ├── reconnect_2.js │ │ │ │ └── reconnect_3.js │ │ │ ├── run_all.js │ │ │ └── timeout │ │ │ │ ├── timeout_filesystem.js │ │ │ │ ├── timeout_process.js │ │ │ │ └── timeout_sandbox.js │ │ └── python │ │ │ ├── README.md │ │ │ ├── __init__.py │ │ │ ├── _run_all.py │ │ │ ├── agents │ │ │ ├── __init__.py │ │ │ ├── clone_repo.py │ │ │ ├── code_exec.py │ │ │ └── start_process.py │ │ │ ├── api_key │ │ │ └── api_key.py │ │ │ ├── basics │ │ │ ├── __init__.py │ │ │ ├── download_file.py │ │ │ ├── fs_ls.py │ │ │ ├── fs_mkdir.py │ │ │ ├── fs_read.py │ │ │ ├── fs_read_bytes.py │ │ │ ├── fs_watch.py │ │ │ ├── fs_write.py │ │ │ ├── fs_write_bytes.py │ │ │ ├── get_url.py │ │ │ ├── get_url_port.py │ │ │ ├── init.py │ │ │ ├── metadata.py │ │ │ ├── process_env_vars.py │ │ │ ├── process_exit.py │ │ │ ├── process_start.py │ │ │ ├── process_stop.py │ │ │ ├── process_stream_stderr.py │ │ │ ├── process_stream_stdout.py │ │ │ ├── process_write_stdin.py │ │ │ ├── set_env_vars.py │ │ │ └── upload_file.py │ │ │ ├── code_exec │ │ │ └── process.py │ │ │ ├── cwd │ │ │ ├── filesystem.py │ │ │ ├── process.py │ │ │ └── sandbox.py │ │ │ ├── logging │ │ │ └── e2b_logging.py │ │ │ ├── poetry.lock │ │ │ ├── processes │ │ │ └── background_processes.py │ │ │ ├── pyproject.toml │ │ │ ├── quickstart.py │ │ │ ├── reconnect │ │ │ ├── reconnect.py │ │ │ ├── reconnect_1.py │ │ │ ├── reconnect_2.py │ │ │ └── reconnect_3.py │ │ │ ├── tests │ │ │ └── __init__.py │ │ │ └── timeout │ │ │ ├── timeout_filesystem.py │ │ │ ├── timeout_process.py │ │ │ └── timeout_sandbox.py │ ├── components │ │ ├── Button.tsx │ │ ├── Code.tsx │ │ ├── CodeInterpreting.tsx │ │ ├── Concepts.tsx │ │ ├── CopyButton.tsx │ │ ├── DialogAnimated.tsx │ │ ├── DocsBox.tsx │ │ ├── Footer.tsx │ │ ├── GridPattern.tsx │ │ ├── Guides.tsx │ │ ├── Header.tsx │ │ ├── HeaderUtils.tsx │ │ ├── Heading.tsx │ │ ├── HeroPattern.tsx │ │ ├── LanguageSpecificText.tsx │ │ ├── Layout.tsx │ │ ├── LegacyBanner.tsx │ │ ├── Libraries.tsx │ │ ├── Logo.tsx │ │ ├── MobileBurgerMenu.tsx │ │ ├── Navigation │ │ │ ├── DocsTypeItems.tsx │ │ │ ├── NavigationLink.tsx │ │ │ ├── NavigationSubgroup.tsx │ │ │ ├── apiRefRoutes.json │ │ │ ├── index.tsx │ │ │ └── routes.tsx │ │ ├── Prose.tsx │ │ ├── Quickstart.tsx │ │ ├── SandboxSpec │ │ │ ├── CPUSpec.tsx │ │ │ ├── RAMSpec.tsx │ │ │ ├── StorageSpec.tsx │ │ │ └── index.tsx │ │ ├── SdkVersionSelect.tsx │ │ ├── Search.tsx │ │ ├── SectionProvider.tsx │ │ ├── Spinner.tsx │ │ ├── Tag.tsx │ │ ├── Textarea.tsx │ │ ├── ThemeToggle.tsx │ │ ├── TopLevelNavItem.tsx │ │ ├── UseCases.tsx │ │ ├── icons │ │ │ ├── BellIcon.tsx │ │ │ ├── BoltIcon.tsx │ │ │ ├── BookIcon.tsx │ │ │ ├── CalendarIcon.tsx │ │ │ ├── CartIcon.tsx │ │ │ ├── ChatBubbleIcon.tsx │ │ │ ├── CheckIcon.tsx │ │ │ ├── ChevronRightLeftIcon.tsx │ │ │ ├── ClipboardIcon.tsx │ │ │ ├── CogIcon.tsx │ │ │ ├── CopyIcon.tsx │ │ │ ├── DiscordIcon.tsx │ │ │ ├── DocumentIcon.tsx │ │ │ ├── EnvelopeIcon.tsx │ │ │ ├── FaceSmileIcon.tsx │ │ │ ├── FolderIcon.tsx │ │ │ ├── GitHubIcon.tsx │ │ │ ├── LinkIcon.tsx │ │ │ ├── ListIcon.tsx │ │ │ ├── MagnifyingGlassIcon.tsx │ │ │ ├── MapPinIcon.tsx │ │ │ ├── PackageIcon.tsx │ │ │ ├── PaperAirplaneIcon.tsx │ │ │ ├── PaperClipIcon.tsx │ │ │ ├── ShapesIcon.tsx │ │ │ ├── ShirtIcon.tsx │ │ │ ├── SquaresPlusIcon.tsx │ │ │ ├── TagIcon.tsx │ │ │ ├── TwitterIcon.tsx │ │ │ ├── UserIcon.tsx │ │ │ └── UsersIcon.tsx │ │ ├── mdx.tsx │ │ └── ui │ │ │ ├── Popover.tsx │ │ │ ├── alert-dialog.tsx │ │ │ ├── button.tsx │ │ │ ├── card.tsx │ │ │ ├── dropdown-menu.tsx │ │ │ ├── skeleton.tsx │ │ │ ├── table.tsx │ │ │ ├── toast.tsx │ │ │ ├── toaster.tsx │ │ │ ├── tooltip.tsx │ │ │ └── use-toast.ts │ ├── images │ │ ├── ai-app-e2b-sandbox-model.png │ │ ├── analyze-data-chart.png │ │ ├── custom-sandbox.png │ │ ├── hello-world-chart.png │ │ ├── logos │ │ │ ├── node.svg │ │ │ ├── openai.svg │ │ │ └── python.svg │ │ ├── sandbox-build-output.png │ │ └── static-chart.png │ ├── lib │ │ ├── remToPx.ts │ │ └── utils.ts │ ├── mdx │ │ ├── recma.mjs │ │ ├── rehype.mjs │ │ ├── remark.mjs │ │ └── search.mjs │ ├── middleware.ts │ ├── styles │ │ └── tailwind.css │ └── utils │ │ ├── consts.ts │ │ ├── obfuscate.tsx │ │ ├── promise.ts │ │ ├── replaceUrls.ts │ │ ├── sitemap.ts │ │ └── useExpiringState.ts │ ├── tailwind.config.ts │ ├── tsconfig.json │ ├── types.d.ts │ ├── typestat.json │ ├── typography.ts │ └── vercel.json ├── codegen.Dockerfile ├── flake.lock ├── flake.nix ├── package.json ├── packages ├── cli │ ├── .eslintrc.cjs │ ├── .gitignore │ ├── LICENSE │ ├── README.md │ ├── package.json │ ├── scripts │ │ └── generate_sdk_ref.sh │ ├── src │ │ ├── api.ts │ │ ├── commands │ │ │ ├── auth │ │ │ │ ├── configure.ts │ │ │ │ ├── index.ts │ │ │ │ ├── info.ts │ │ │ │ ├── login.ts │ │ │ │ └── logout.ts │ │ │ ├── index.ts │ │ │ ├── sandbox │ │ │ │ ├── connect.ts │ │ │ │ ├── index.ts │ │ │ │ ├── kill.ts │ │ │ │ ├── list.ts │ │ │ │ ├── logs.ts │ │ │ │ └── spawn.ts │ │ │ └── template │ │ │ │ ├── build.ts │ │ │ │ ├── buildWithProxy.ts │ │ │ │ ├── delete.ts │ │ │ │ ├── index.ts │ │ │ │ ├── init.ts │ │ │ │ ├── list.ts │ │ │ │ └── publish.ts │ │ ├── config │ │ │ └── index.ts │ │ ├── docker │ │ │ └── constants.ts │ │ ├── index.ts │ │ ├── options.ts │ │ ├── terminal.ts │ │ ├── user.ts │ │ └── utils │ │ │ ├── commands2md.ts │ │ │ ├── confirm.ts │ │ │ ├── errors.ts │ │ │ ├── filesystem.ts │ │ │ ├── format.ts │ │ │ ├── templatePrompt.ts │ │ │ ├── templateSort.ts │ │ │ └── wait.ts │ ├── testground │ │ └── demo-basic │ │ │ ├── .dockerignore │ │ │ ├── .gitignore │ │ │ ├── Dockerfile │ │ │ ├── assets-to-be-ignored │ │ │ └── cool-doge.gif │ │ │ ├── main.mjs │ │ │ └── package.json │ ├── tsconfig.json │ └── tsup.config.js ├── connect-python │ ├── .gitignore │ ├── LICENSE │ ├── Makefile │ ├── README.md │ ├── cmd │ │ └── protoc-gen-connect-python │ │ │ └── main.go │ ├── go.mod │ ├── go.sum │ ├── pyproject.toml │ └── requirements-dev.txt ├── js-sdk │ ├── .eslintrc.cjs │ ├── .gitignore │ ├── LICENSE │ ├── README.md │ ├── package.json │ ├── scripts │ │ ├── CustomMarkdownTheme.js │ │ ├── generate_sdk_ref.sh │ │ └── post-publish.sh │ ├── src │ │ ├── api │ │ │ ├── index.ts │ │ │ ├── metadata.ts │ │ │ └── schema.gen.ts │ │ ├── connectionConfig.ts │ │ ├── envd │ │ │ ├── api.ts │ │ │ ├── filesystem │ │ │ │ ├── filesystem_connect.ts │ │ │ │ └── filesystem_pb.ts │ │ │ ├── process │ │ │ │ ├── process_connect.ts │ │ │ │ └── process_pb.ts │ │ │ ├── rpc.ts │ │ │ ├── schema.gen.ts │ │ │ └── versions.ts │ │ ├── errors.ts │ │ ├── index.ts │ │ ├── logs.ts │ │ └── sandbox │ │ │ ├── commands │ │ │ ├── commandHandle.ts │ │ │ ├── index.ts │ │ │ └── pty.ts │ │ │ ├── filesystem │ │ │ ├── index.ts │ │ │ └── watchHandle.ts │ │ │ ├── index.ts │ │ │ ├── sandboxApi.ts │ │ │ └── signature.ts │ ├── tests │ │ ├── api │ │ │ ├── info.test.ts │ │ │ ├── kill.test.ts │ │ │ └── list.test.ts │ │ ├── cmdHelper.ts │ │ ├── integration │ │ │ ├── stress.test.ts │ │ │ └── template │ │ │ │ ├── README.md │ │ │ │ ├── e2b.Dockerfile │ │ │ │ └── e2b.toml │ │ ├── runtimes │ │ │ ├── browser │ │ │ │ └── run.test.tsx │ │ │ ├── bun │ │ │ │ └── run.test.ts │ │ │ └── deno │ │ │ │ └── run.test.ts │ │ ├── sandbox │ │ │ ├── commands │ │ │ │ ├── connect.test.ts │ │ │ │ ├── envVars.test.ts │ │ │ │ ├── kill.test.ts │ │ │ │ ├── list.test.ts │ │ │ │ ├── run.test.ts │ │ │ │ └── sendStdin.test.ts │ │ │ ├── connect.test.ts │ │ │ ├── create.test.ts │ │ │ ├── files │ │ │ │ ├── exists.test.ts │ │ │ │ ├── list.test.ts │ │ │ │ ├── makeDir.test.ts │ │ │ │ ├── read.test.ts │ │ │ │ ├── remove.test.ts │ │ │ │ ├── rename.test.ts │ │ │ │ ├── signing.test.ts │ │ │ │ ├── watch.test.ts │ │ │ │ └── write.test.ts │ │ │ ├── host.test.ts │ │ │ ├── kill.test.ts │ │ │ ├── pty │ │ │ │ ├── ptyCreate.test.ts │ │ │ │ ├── resize.test.ts │ │ │ │ └── sendInput.test.ts │ │ │ ├── secure.test.ts │ │ │ └── timeout.test.ts │ │ ├── setup.ts │ │ └── template.ts │ ├── tsconfig.json │ ├── tsup.config.js │ ├── typedoc.json │ └── vitest.workspace.mts └── python-sdk │ ├── .gitignore │ ├── LICENSE │ ├── Makefile │ ├── README.md │ ├── e2b │ ├── __init__.py │ ├── api │ │ ├── __init__.py │ │ ├── client │ │ │ ├── __init__.py │ │ │ ├── api │ │ │ │ ├── __init__.py │ │ │ │ └── sandboxes │ │ │ │ │ ├── __init__.py │ │ │ │ │ ├── delete_sandboxes_sandbox_id.py │ │ │ │ │ ├── get_sandboxes.py │ │ │ │ │ ├── get_sandboxes_metrics.py │ │ │ │ │ ├── get_sandboxes_sandbox_id.py │ │ │ │ │ ├── get_sandboxes_sandbox_id_logs.py │ │ │ │ │ ├── get_sandboxes_sandbox_id_metrics.py │ │ │ │ │ ├── get_v2_sandboxes.py │ │ │ │ │ ├── post_sandboxes.py │ │ │ │ │ ├── post_sandboxes_sandbox_id_pause.py │ │ │ │ │ ├── post_sandboxes_sandbox_id_refreshes.py │ │ │ │ │ ├── post_sandboxes_sandbox_id_resume.py │ │ │ │ │ └── post_sandboxes_sandbox_id_timeout.py │ │ │ ├── client.py │ │ │ ├── errors.py │ │ │ ├── models │ │ │ │ ├── __init__.py │ │ │ │ ├── created_access_token.py │ │ │ │ ├── created_team_api_key.py │ │ │ │ ├── error.py │ │ │ │ ├── listed_sandbox.py │ │ │ │ ├── new_access_token.py │ │ │ │ ├── new_sandbox.py │ │ │ │ ├── new_team_api_key.py │ │ │ │ ├── node.py │ │ │ │ ├── node_detail.py │ │ │ │ ├── node_status.py │ │ │ │ ├── node_status_change.py │ │ │ │ ├── post_sandboxes_sandbox_id_refreshes_body.py │ │ │ │ ├── post_sandboxes_sandbox_id_timeout_body.py │ │ │ │ ├── resumed_sandbox.py │ │ │ │ ├── running_sandbox_with_metrics.py │ │ │ │ ├── sandbox.py │ │ │ │ ├── sandbox_detail.py │ │ │ │ ├── sandbox_log.py │ │ │ │ ├── sandbox_logs.py │ │ │ │ ├── sandbox_metric.py │ │ │ │ ├── sandbox_state.py │ │ │ │ ├── team.py │ │ │ │ ├── team_api_key.py │ │ │ │ ├── team_user.py │ │ │ │ ├── template.py │ │ │ │ ├── template_build.py │ │ │ │ ├── template_build_request.py │ │ │ │ ├── template_build_status.py │ │ │ │ ├── template_update_request.py │ │ │ │ └── update_team_api_key.py │ │ │ ├── py.typed │ │ │ └── types.py │ │ └── metadata.py │ ├── connection_config.py │ ├── envd │ │ ├── api.py │ │ ├── filesystem │ │ │ ├── filesystem_connect.py │ │ │ ├── filesystem_pb2.py │ │ │ └── filesystem_pb2.pyi │ │ ├── process │ │ │ ├── process_connect.py │ │ │ ├── process_pb2.py │ │ │ └── process_pb2.pyi │ │ ├── rpc.py │ │ └── versions.py │ ├── exceptions.py │ ├── sandbox │ │ ├── commands │ │ │ ├── command_handle.py │ │ │ └── main.py │ │ ├── filesystem │ │ │ ├── filesystem.py │ │ │ └── watch_handle.py │ │ ├── main.py │ │ ├── sandbox_api.py │ │ ├── signature.py │ │ └── utils.py │ ├── sandbox_async │ │ ├── commands │ │ │ ├── command.py │ │ │ ├── command_handle.py │ │ │ └── pty.py │ │ ├── filesystem │ │ │ ├── filesystem.py │ │ │ └── watch_handle.py │ │ ├── main.py │ │ ├── sandbox_api.py │ │ └── utils.py │ └── sandbox_sync │ │ ├── commands │ │ ├── command.py │ │ ├── command_handle.py │ │ └── pty.py │ │ ├── filesystem │ │ ├── filesystem.py │ │ └── watch_handle.py │ │ ├── main.py │ │ └── sandbox_api.py │ ├── e2b_connect │ ├── __init__.py │ └── client.py │ ├── example.py │ ├── package.json │ ├── poetry.lock │ ├── pyproject.toml │ ├── pytest.ini │ ├── scripts │ ├── fix-python-pb.sh │ └── generate_sdk_ref.sh │ └── tests │ ├── async │ ├── api_async │ │ ├── test_sbx_info.py │ │ ├── test_sbx_kill.py │ │ └── test_sbx_list.py │ └── sandbox_async │ │ ├── commands │ │ ├── test_cmd_connect.py │ │ ├── test_cmd_kill.py │ │ ├── test_cmd_list.py │ │ ├── test_env_vars.py │ │ ├── test_run.py │ │ └── test_send_stdin.py │ │ ├── files │ │ ├── test_exists.py │ │ ├── test_files_list.py │ │ ├── test_make_dir.py │ │ ├── test_read.py │ │ ├── test_remove.py │ │ ├── test_rename.py │ │ ├── test_secured.py │ │ ├── test_watch.py │ │ └── test_write.py │ │ ├── pty │ │ ├── test_pty_create.py │ │ ├── test_resize.py │ │ └── test_send_input.py │ │ ├── test_connect.py │ │ ├── test_create.py │ │ ├── test_host.py │ │ ├── test_kill.py │ │ ├── test_secure.py │ │ └── test_timeout.py │ ├── bugs │ └── test_envelope_decode.py │ ├── conftest.py │ └── sync │ ├── api_sync │ ├── test_sbx_info.py │ ├── test_sbx_kill.py │ └── test_sbx_list.py │ └── sandbox_sync │ ├── commands │ ├── test_cmd_connect.py │ ├── test_cmd_kill.py │ ├── test_cmd_list.py │ ├── test_env_vars.py │ ├── test_run.py │ └── test_send_stdin.py │ ├── files │ ├── test_exists.py │ ├── test_files_list.py │ ├── test_make_dir.py │ ├── test_read.py │ ├── test_remove.py │ ├── test_rename.py │ ├── test_secured.py │ ├── test_watch.py │ └── test_write.py │ ├── pty │ ├── test_pty.py │ ├── test_resize.py │ └── test_send_input.py │ ├── test_connect.py │ ├── test_create.py │ ├── test_host.py │ ├── test_kill.py │ ├── test_secure.py │ └── test_timeout.py ├── pnpm-lock.yaml ├── pnpm-workspace.yaml ├── readme-assets ├── e2b-sdk-dark.png ├── e2b-sdk-light.png ├── logo-circle.png └── preview.png ├── scripts ├── codegen.sh └── update-api-spec.sh ├── spec ├── envd │ ├── buf-js.gen.yaml │ ├── buf-python.gen.yaml │ ├── envd.yaml │ ├── filesystem │ │ └── filesystem.proto │ └── process │ │ └── process.proto ├── openapi.yml └── remove_extra_tags.py ├── supabase ├── .gitignore ├── config.toml └── functions │ └── new_user │ └── index.ts └── templates └── base ├── e2b.Dockerfile └── e2b.toml /.changeset/README.md: -------------------------------------------------------------------------------- 1 | # Changesets 2 | 3 | To add changeset run: 4 | 5 | ```bash 6 | npx changeset 7 | ``` 8 | 9 | in the root of the project. This will create a new changeset in the `.changeset` folder. -------------------------------------------------------------------------------- /.changeset/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://unpkg.com/@changesets/config@2.3.1/schema.json", 3 | "changelog": "@changesets/cli/changelog", 4 | "commit": false, 5 | "fixed": [], 6 | "ignore": [ 7 | "e2b-docs" 8 | ], 9 | "linked": [], 10 | "access": "public", 11 | "baseBranch": "main", 12 | "updateInternalDependencies": "patch", 13 | "privatePackages": { 14 | "version": true, 15 | "tag": true 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /.eslintrc.cjs: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | env: { 3 | node: true, 4 | browser: true, 5 | es6: true, 6 | }, 7 | extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended'], 8 | parser: '@typescript-eslint/parser', 9 | parserOptions: { 10 | ecmaVersion: 'latest', 11 | sourceType: 'module', 12 | }, 13 | ignorePatterns: ['dist/', 'node_modules/', '*.gen.ts'], 14 | plugins: ['@typescript-eslint', 'unused-imports', '@stylistic/ts'], 15 | rules: { 16 | '@typescript-eslint/member-ordering': 'error', 17 | '@typescript-eslint/ban-ts-comment': 'off', // "move fast" mode 18 | '@typescript-eslint/no-explicit-any': 'off', // "move fast" mode 19 | 'linebreak-style': ['error', 'unix'], 20 | 'unused-imports/no-unused-imports': 'error', 21 | // No double quotes 22 | quotes: ['error', 'single', { avoidEscape: true }], 23 | // No extra semicolon 24 | '@stylistic/ts/semi': ['error', 'never'], 25 | }, 26 | } 27 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | packages/python-sdk/e2b/api/client/** linguist-generated=true 2 | **/*.gen.ts linguist-generated=true 3 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: 'feature' 6 | assignees: '' 7 | --- 8 | 9 | **Is your feature request related to a problem? Please describe.** 10 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 11 | 12 | **Describe the solution you'd like** 13 | A clear and concise description of what you want to happen. 14 | 15 | **Describe alternatives you've considered** 16 | A clear and concise description of any alternative solutions or features you've considered. 17 | 18 | **Additional context** 19 | Add any other context or screenshots about the feature request here. 20 | -------------------------------------------------------------------------------- /.github/scripts/is_new_sdk_ref.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -euo pipefail 4 | 5 | # This script checks for diffs in the packages directory. 6 | # If there are diffs, it means we need to generate new SDK references. 7 | if git diff --name-only HEAD^ | grep -q '^packages/'; then 8 | echo "true" 9 | else 10 | echo "false" 11 | fi 12 | -------------------------------------------------------------------------------- /.github/scripts/is_release.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # This script checks if the current commit contains changesets. 4 | 5 | set -eu 6 | 7 | CHANGES=$(node -e "require('@changesets/read').default(process.cwd()).then(result => console.log(!!result.length))") 8 | 9 | echo "${CHANGES}" 10 | -------------------------------------------------------------------------------- /.github/scripts/is_release_for_package.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # This script checks if the specified package has changesets in the current commit. 4 | 5 | set -eu 6 | 7 | if [ $# -lt 1 ]; then 8 | echo "Error: Package name is required as the first argument." >&2 9 | exit 1 10 | fi 11 | 12 | PACKAGE_NAME=$1 13 | PACKAGE_CHANGES=$(node -e "require('@changesets/read').default(process.cwd()).then(result => console.log(result.flatMap(changeset => changeset.releases.flatMap(release => release.name)).includes('${PACKAGE_NAME}')))") 14 | 15 | echo "${PACKAGE_CHANGES}" 16 | -------------------------------------------------------------------------------- /.github/workflows/supabase.yml: -------------------------------------------------------------------------------- 1 | name: Deploy Supabase Edge functions 2 | 3 | on: 4 | push: 5 | paths: 6 | - 'supabase/functions/**' 7 | - '.github/workflows/supabase.yml' 8 | branches: 9 | - main 10 | 11 | concurrency: 12 | group: ${{ github.workflow }}-${{ github.ref }} 13 | cancel-in-progress: true 14 | 15 | permissions: 16 | contents: read 17 | 18 | env: 19 | SUPABASE_ACCESS_TOKEN: ${{ secrets.SUPABASE_ACCESS_TOKEN }} 20 | SUPABASE_PROJECT_ID: ${{ vars.SUPABASE_PROJECT_ID }} 21 | 22 | jobs: 23 | deploy: 24 | name: Deploy 25 | runs-on: ubuntu-22.04 26 | steps: 27 | - name: Checkout repository 28 | uses: actions/checkout@v3 29 | 30 | - name: Setup Supabase CLI 31 | uses: supabase/setup-cli@v1 32 | with: 33 | version: latest 34 | 35 | - name: Deploy supabase edge functions 36 | run: supabase functions deploy --project-ref "$SUPABASE_PROJECT_ID" 37 | -------------------------------------------------------------------------------- /.npmrc: -------------------------------------------------------------------------------- 1 | enable-pre-post-scripts=true 2 | auto-install-peers=true 3 | exclude-links-from-lockfile=true 4 | prefer-workspace-packages=false 5 | link-workspace-packages=false 6 | engine-strict=true 7 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | /.next/ 2 | 3 | # imporatant to keep // $HighlightLine comments at the end of the line 4 | apps/web/src/code/ 5 | 6 | 7 | **/*.mdx 8 | **/code/**/* 9 | -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "singleQuote": true, 3 | "semi": false, 4 | "trailingComma": "es5" 5 | } 6 | -------------------------------------------------------------------------------- /.vale.ini: -------------------------------------------------------------------------------- 1 | StylesPath = vale-styles 2 | 3 | MinAlertLevel = suggestion 4 | 5 | Packages = Microsoft, proselint, write-good, alex, Readability, Joblint, Google 6 | 7 | [*.{md,ts,py}] 8 | BasedOnStyles = Vale, Microsoft, proselint, write-good, alex, Readability, Joblint, Google -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | "recommendations": [ 3 | "ms-python.black-formatter", 4 | "dbaeumer.vscode-eslint", 5 | "ms-python.vscode-pylance", 6 | "ms-python.python", 7 | "bradlc.vscode-tailwindcss", 8 | "streetsidesoftware.code-spell-checker", 9 | "timonwong.shellcheck", 10 | "chrischinchilla.vale-vscode" 11 | ] 12 | } -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "name": "Python: Current File", 9 | "type": "python", 10 | "request": "launch", 11 | "program": "${file}", 12 | "console": "integratedTerminal", 13 | "justMyCode": true 14 | } 15 | ] 16 | } -------------------------------------------------------------------------------- /CODEOWNERS: -------------------------------------------------------------------------------- 1 | # These owners will be the default owners for everything in 2 | # the repo. Unless a later match takes precedence. 3 | * @jakubno @ValentaTomas 4 | 5 | # Web 6 | apps/web @jakubno @ben-fornefeld 7 | apps/web/src/app/(docs)/docs @mlejva 8 | apps/web/src/app/(docs)/docs/sdk-reference @0div 9 | 10 | # SDKs 11 | packages @jakubno @ValentaTomas @mishushakov 12 | packages/connect-python @ValentaTomas 13 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | If you want to contribute, open a PR, issue, or start a discussion on our [Discord](https://discord.gg/dSBY3ms2Qr). 3 | -------------------------------------------------------------------------------- /DEV.md: -------------------------------------------------------------------------------- 1 | # Releasing e2b cli 2 | 3 | to create a changeset run `npx changeset` 4 | 5 | 6 | # Enter Nix development shell 7 | 8 | install nix and enable flakes 9 | 10 | ``` 11 | curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install 12 | ``` 13 | 14 | enter the dev shell 15 | ``` 16 | nix develop --command zsh 17 | # or 18 | nix develop --command bash 19 | ``` -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | update-api-spec: 2 | @echo "Updating API spec" 3 | @./scripts/update-api-spec.sh 4 | @echo "Done" 5 | 6 | .PHONY: codegen 7 | codegen: 8 | @echo "Generating SDK code from openapi and envd spec" 9 | @./scripts/codegen.sh 10 | 11 | generate: generate-js generate-python 12 | 13 | generate-js: 14 | cd packages/js-sdk && pnpm generate 15 | cd packages/js-sdk && pnpm generate-envd-api 16 | cd spec/envd && buf generate --template buf-js.gen.yaml 17 | 18 | generate-python: 19 | if [ ! -f "/go/bin/protoc-gen-connect-python" ]; then \ 20 | $(MAKE) -C packages/connect-python build; \ 21 | fi 22 | cd packages/python-sdk && make generate-api 23 | cd spec/envd && buf generate --template buf-python.gen.yaml 24 | cd packages/python-sdk && ./scripts/fix-python-pb.sh && black . 25 | 26 | .PHONY: init-styles 27 | init-styles: 28 | vale sync 29 | -------------------------------------------------------------------------------- /apps/web/.eslintignore: -------------------------------------------------------------------------------- 1 | src/code/js/reconnect/*.js 2 | -------------------------------------------------------------------------------- /apps/web/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "root": true, 3 | "extends": ["../../.eslintrc.cjs", "next/core-web-vitals"], 4 | "overrides": [ 5 | { 6 | "files": ["src/code/**/*.js"], 7 | "rules": { 8 | "@typescript-eslint/no-unused-vars": "off", 9 | "no-useless-escape": "off" 10 | } 11 | } 12 | ] 13 | } 14 | -------------------------------------------------------------------------------- /apps/web/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /test_python/test_python/server/node_modules 6 | /.pnp 7 | .pnp.js 8 | 9 | # testing 10 | /coverage 11 | 12 | # next.js 13 | /.next/ 14 | /out/ 15 | 16 | # production 17 | /build 18 | 19 | # misc 20 | .DS_Store 21 | *.pem 22 | 23 | # debug 24 | npm-debug.log* 25 | yarn-debug.log* 26 | yarn-error.log* 27 | .pnpm-debug.log* 28 | 29 | .env 30 | # local env files 31 | .env*.local 32 | 33 | # vercel 34 | .vercel 35 | 36 | # typescript 37 | *.tsbuildinfo 38 | next-env.d.ts 39 | 40 | vale-styles 41 | 42 | .idea/ 43 | 44 | # Sentry Auth Token 45 | .sentryclirc 46 | 47 | # Add the generated route file for SDK reference docs to gitignore so we don't commit it. 48 | # The idea is that we want to generate this file only from the automated GitHub actions. 49 | sdkRefRoutes.json 50 | -------------------------------------------------------------------------------- /apps/web/.prettierignore: -------------------------------------------------------------------------------- 1 | **/*.mdx 2 | **/code/**/* -------------------------------------------------------------------------------- /apps/web/components.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://ui.shadcn.com/schema.json", 3 | "style": "default", 4 | "rsc": true, 5 | "tsx": true, 6 | "tailwind": { 7 | "config": "tailwind.config.js", 8 | "css": "src/styles/tailwind.css", 9 | "baseColor": "slate", 10 | "cssVariables": true 11 | }, 12 | "aliases": { 13 | "components": "@/components", 14 | "utils": "@/lib/utils" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /apps/web/config.ts: -------------------------------------------------------------------------------- 1 | export const config = { 2 | github: { 3 | url: 'https://github.com/e2b-dev/e2b', 4 | api: 'https://api.github.com/repos/e2b-dev/e2b', 5 | }, 6 | twitter: { 7 | url: 'https://x.com/e2b', 8 | }, 9 | } 10 | -------------------------------------------------------------------------------- /apps/web/mdx-components.tsx: -------------------------------------------------------------------------------- 1 | import * as mdxComponents from '@/components/mdx' 2 | import { type MDXComponents } from 'mdx/types' 3 | 4 | export function useMDXComponents(components: MDXComponents) { 5 | return { 6 | ...components, 7 | ...mdxComponents, 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /apps/web/postcss.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | plugins: { 3 | tailwindcss: {}, 4 | autoprefixer: {}, 5 | }, 6 | } 7 | -------------------------------------------------------------------------------- /apps/web/public/.well-known/security.txt: -------------------------------------------------------------------------------- 1 | Contact: mailto:security@e2b.dev 2 | Preferred-Languages: en 3 | Canonical: https://e2b.dev/.well-known/security.txt 4 | -------------------------------------------------------------------------------- /apps/web/sentry.edge.config.ts: -------------------------------------------------------------------------------- 1 | // This file configures the initialization of Sentry for edge features (middleware, edge routes, and so on). 2 | // The config you add here will be used whenever one of the edge features is loaded. 3 | // Note that this config is unrelated to the Vercel Edge Runtime and is also required when running locally. 4 | // https://docs.sentry.io/platforms/javascript/guides/nextjs/ 5 | import * as Sentry from '@sentry/nextjs' 6 | 7 | Sentry.init({ 8 | dsn: 'https://261086f9724ab3e36ee396fc6ae4823d@o4505753501564928.ingest.sentry.io/4505753529417728', 9 | 10 | // Adjust this value in production, or use tracesSampler for greater control 11 | tracesSampleRate: 0.1, 12 | 13 | // Setting this option to true will print useful information to the console while you're setting up Sentry. 14 | debug: false, 15 | enabled: process.env.NODE_ENV !== 'development', 16 | }) 17 | -------------------------------------------------------------------------------- /apps/web/sentry.server.config.ts: -------------------------------------------------------------------------------- 1 | // This file configures the initialization of Sentry on the server. 2 | // The config you add here will be used whenever the server handles a request. 3 | // https://docs.sentry.io/platforms/javascript/guides/nextjs/ 4 | import * as Sentry from '@sentry/nextjs' 5 | 6 | Sentry.init({ 7 | dsn: 'https://261086f9724ab3e36ee396fc6ae4823d@o4505753501564928.ingest.sentry.io/4505753529417728', 8 | 9 | // Adjust this value in production, or use tracesSampler for greater control 10 | tracesSampleRate: 0.1, 11 | 12 | // Setting this option to true will print useful information to the console while you're setting up Sentry. 13 | debug: false, 14 | enabled: process.env.NODE_ENV !== 'development', 15 | }) 16 | -------------------------------------------------------------------------------- /apps/web/src/app/(docs)/docs/cli/auth/page.mdx: -------------------------------------------------------------------------------- 1 | # Authentication in CLI 2 | 3 | You must authenticate with E2B CLI before using it. Run the following command to sign in into your E2B account: 4 | 5 | 6 | ```bash 7 | e2b auth login 8 | ``` 9 | -------------------------------------------------------------------------------- /apps/web/src/app/(docs)/docs/cli/page.mdx: -------------------------------------------------------------------------------- 1 | # E2B CLI 2 | 3 | E2B CLI is a command line tool that allows you to list, kill running sandboxes, and manage [sandbox templates](/docs/sandbox-templates). 4 | 5 | ## Installation 6 | 7 | **Using Homebrew (on macOS)** 8 | 9 | 10 | ```bash 11 | brew install e2b 12 | ``` 13 | 14 | 15 | **Using NPM** 16 | 17 | You can install E2B CLI using the following command: 18 | 19 | 20 | ```bash 21 | npm i -g @e2b/cli 22 | ``` 23 | 24 | 25 | ### Beta CLI 26 | 27 | The latest beta version of the CLI can be installed from NPM using the following command: 28 | 29 | 30 | ```bash 31 | npm i -g @e2b/cli@beta 32 | ``` 33 | -------------------------------------------------------------------------------- /apps/web/src/app/(docs)/docs/cli/shutdown-sandboxes/page.mdx: -------------------------------------------------------------------------------- 1 | # Shutdown running sandboxes 2 | 3 | You can shutdown single or all running sandboxes with the E2B CLI. 4 | 5 | ## Shutdown single sandbox 6 | 7 | To shutdown a single sandbox, run the following command: 8 | 9 | 10 | ```bash 11 | e2b sandbox kill 12 | ``` 13 | 14 | 15 | ## Shutdown all sandboxes 16 | 17 | To shutdown all running sandboxes, run the following command: 18 | 19 | 20 | ```bash 21 | e2b sandbox kill --all 22 | ``` 23 | 24 | -------------------------------------------------------------------------------- /apps/web/src/app/(docs)/docs/code-interpreting/create-charts-visualizations/page.mdx: -------------------------------------------------------------------------------- 1 | # Create charts & visualizations 2 | E2B Sandbox allows you to create charts and visualizations by executing Python code inside the sandbox with `runCode()` method in JavaScript and `run_code()` method in Python. 3 | 4 | These charts and visualizations can be [static](/docs/code-interpreting/create-charts-visualizations/static-charts) or [interactive](/docs/code-interpreting/create-charts-visualizations/interactive-charts) plots. 5 | 6 | {/* 7 | Learn more about different types of results that E2B Sandbox can return [(TODO: link)here](/docs/code-interpreting/results). 8 | */} 9 | 10 | -------------------------------------------------------------------------------- /apps/web/src/app/(docs)/docs/code-interpreting/supported-languages/bash/page.mdx: -------------------------------------------------------------------------------- 1 | # Run bash code 2 | Use the `runCode`/`run_code` method to run bash code inside the sandbox. 3 | You'll need to pass the `language` parameter with value `bash`. 4 | 5 | ```js 6 | import { Sandbox } from '@e2b/code-interpreter' 7 | 8 | const sbx = await Sandbox.create() 9 | const execution = await sbx.runCode('echo "Hello, world!"', { language: 'bash' }) 10 | console.log(execution) 11 | ``` 12 | ```python 13 | from e2b_code_interpreter import Sandbox 14 | 15 | sbx = Sandbox() 16 | execution = sbx.run_code("echo 'Hello, world!'", language="bash") 17 | print(execution) 18 | ``` 19 | -------------------------------------------------------------------------------- /apps/web/src/app/(docs)/docs/code-interpreting/supported-languages/java/page.mdx: -------------------------------------------------------------------------------- 1 | # Run Java code 2 | Use the `runCode`/`run_code` method to run Java code inside the sandbox. 3 | You'll need to pass the `language` parameter with value `java`. 4 | 5 | ```js 6 | import { Sandbox } from '@e2b/code-interpreter' 7 | 8 | const sbx = await Sandbox.create() 9 | const execution = await sbx.runCode('System.out.println("Hello, world!");', { language: 'java' }) 10 | console.log(execution) 11 | ``` 12 | ```python 13 | from e2b_code_interpreter import Sandbox 14 | 15 | sbx = Sandbox() 16 | execution = sbx.run_code('System.out.println("Hello, world!");', language="java") 17 | print(execution) 18 | ``` 19 | -------------------------------------------------------------------------------- /apps/web/src/app/(docs)/docs/code-interpreting/supported-languages/page.mdx: -------------------------------------------------------------------------------- 1 | # Supported languages 2 | 3 | Typically you use Python to run AI-generated code for data analysis but you can use other languages as well. 4 | 5 | Out of the box E2B Sandbox supports: 6 | - [Python](/docs/code-interpreting/supported-languages/python) 7 | - [JavaScript and TypeScript](/docs/code-interpreting/supported-languages/javascript) 8 | - [R](/docs/code-interpreting/supported-languages/r) 9 | - [Java](/docs/code-interpreting/supported-languages/java) 10 | - [Bash](/docs/code-interpreting/supported-languages/bash) 11 | 12 | 13 | You can use any custom language runtime by creating a [custom sandbox template](/docs/sandbox-template). 14 | 15 | -------------------------------------------------------------------------------- /apps/web/src/app/(docs)/docs/code-interpreting/supported-languages/python/page.mdx: -------------------------------------------------------------------------------- 1 | # Run Python code 2 | Use the `runCode`/`run_code` method to run Python code inside the sandbox. 3 | 4 | ```js 5 | import { Sandbox } from '@e2b/code-interpreter' 6 | 7 | const sbx = await Sandbox.create() 8 | const execution = await sbx.runCode('print("Hello, world!")') 9 | console.log(execution) 10 | ``` 11 | ```python 12 | from e2b_code_interpreter import Sandbox 13 | 14 | sbx = Sandbox() 15 | execution = sbx.run_code('print("Hello, world!")') 16 | print(execution) 17 | ``` 18 | -------------------------------------------------------------------------------- /apps/web/src/app/(docs)/docs/code-interpreting/supported-languages/r/page.mdx: -------------------------------------------------------------------------------- 1 | ## Run R code 2 | Use the `runCode`/`run_code` method to run R code inside the sandbox. 3 | You'll need to pass the `language` parameter with value `r`. 4 | 5 | ```js 6 | import { Sandbox } from '@e2b/code-interpreter' 7 | 8 | const sbx = await Sandbox.create() 9 | const execution = await sbx.runCode('print("Hello, world!")', { language: 'r' }) 10 | console.log(execution) 11 | ``` 12 | ```python 13 | from e2b_code_interpreter import Sandbox 14 | 15 | sbx = Sandbox() 16 | execution = sbx.run_code('print("Hello, world!")', language="r") 17 | print(execution) 18 | ``` 19 | -------------------------------------------------------------------------------- /apps/web/src/app/(docs)/docs/commands/page.mdx: -------------------------------------------------------------------------------- 1 | # Running commands in sandbox 2 | 3 | You can run terminal commands inside the sandbox using the `commands.run()` method. 4 | 5 | 6 | ```js 7 | import { Sandbox } from '@e2b/code-interpreter' 8 | 9 | const sandbox = await Sandbox.create() 10 | const result = await sandbox.commands.run('ls -l') 11 | console.log(result) 12 | ``` 13 | ```python 14 | from e2b_code_interpreter import Sandbox 15 | 16 | sandbox = Sandbox() 17 | 18 | result = sandbox.commands.run('ls -l') 19 | print(result) 20 | ``` 21 | 22 | -------------------------------------------------------------------------------- /apps/web/src/app/(docs)/docs/commands/streaming/page.mdx: -------------------------------------------------------------------------------- 1 | # Streaming command output 2 | 3 | To stream command output as it is being executed, pass the `onStdout`, `onStderr` callbacks to the `commands.run()` method in JavaScript 4 | or the `on_stdout`, `on_stderr` callbacks to the `commands.run()` method in Python. 5 | 6 | 7 | ```js 8 | import { Sandbox } from '@e2b/code-interpreter' 9 | 10 | const sandbox = await Sandbox.create() 11 | const result = await sandbox.commands.run('echo hello; sleep 1; echo world', { 12 | onStdout: (data) => { 13 | console.log(data) 14 | }, 15 | onStderr: (data) => { 16 | console.log(data) 17 | }, 18 | }) 19 | console.log(result) 20 | ``` 21 | ```python 22 | from e2b_code_interpreter import Sandbox 23 | 24 | sandbox = Sandbox() 25 | 26 | result = sandbox.commands.run('echo hello; sleep 1; echo world', on_stdout=lambda data: print(data), on_stderr=lambda data: print(data)) 27 | print(result) 28 | ``` 29 | 30 | -------------------------------------------------------------------------------- /apps/web/src/app/(docs)/docs/filesystem/download/page.mdx: -------------------------------------------------------------------------------- 1 | # Download data from sandbox 2 | 3 | You can download data from the sandbox using the `files.read()` method. 4 | 5 | 6 | ```js 7 | import fs from 'fs' 8 | import { Sandbox } from '@e2b/code-interpreter' 9 | 10 | const sandbox = await Sandbox.create() 11 | 12 | // Read file from sandbox 13 | const content = await sandbox.files.read('/path/in/sandbox') 14 | // Write file to local filesystem 15 | fs.writeFileSync('/local/path', content) 16 | ``` 17 | ```python 18 | from e2b_code_interpreter import Sandbox 19 | 20 | sandbox = Sandbox() 21 | 22 | # Read file from sandbox 23 | content = sandbox.files.read('/path/in/sandbox') 24 | # Write file to local filesystem 25 | with open('/local/path', 'w') as file: 26 | file.write(content) 27 | ``` 28 | 29 | -------------------------------------------------------------------------------- /apps/web/src/app/(docs)/docs/filesystem/page.mdx: -------------------------------------------------------------------------------- 1 | # Filesystem 2 | 3 | Each E2B Sandbox has its own isolated filesystem. The [Hobby tier](https://e2b.dev/pricing) sandboxes come with 1 GB of the free disk space and [Pro tier](https://e2b.dev/pricing) sandboxes come with 5 GB. 4 | 5 | With E2B SDK you can: 6 | - [Read and write files to the sandbox.](/docs/filesystem/read-write) 7 | - [Watch directory for changes.](/docs/filesystem/watch) 8 | - [Upload data to the sandbox.](/docs/filesystem/upload) 9 | - [Download data from the sandbox.](/docs/filesystem/download) 10 | 11 | -------------------------------------------------------------------------------- /apps/web/src/app/(docs)/docs/legacy/cli/installation/page.mdx: -------------------------------------------------------------------------------- 1 | # Installation 2 | 3 | You build and manage sandbox templates with our CLI. {{ className: 'lead' }} 4 | 5 | The CLI is distributed as an [NPM package](https://www.npmjs.com/package/e2b). 6 | 7 | ## Download CLI 8 | 9 | You can install the CLI with following command: 10 | 11 | ```bash 12 | npm install -g @e2b/cli@latest 13 | ``` 14 | 15 | ## Login 16 | 17 | You'll need to login to your account to start using the CLI. 18 | You'll be redirected to the browser after running the following command to finish the login. 19 | 20 | ```bash 21 | e2b auth login 22 | ``` -------------------------------------------------------------------------------- /apps/web/src/app/(docs)/docs/legacy/examples/clone-repo/page.mdx: -------------------------------------------------------------------------------- 1 | # Clone GitHub Repository -------------------------------------------------------------------------------- /apps/web/src/app/(docs)/docs/legacy/getting-help/page.mdx: -------------------------------------------------------------------------------- 1 | # Getting help 2 | 3 | If you have any questions, issues, or feature requests, please reach out on of the following channels: {{ className: 'lead' }} 4 | - Send us an email at [hello@e2b.dev](mailto:hello@e2b.dev) 5 | - Talk to us on our [Discord server](https://discord.gg/U7KEcGErtQ) 6 | - Open an issue on [our GitHub](https://github.com/e2b-dev/e2b) 7 | - Reach out on [Twitter / X](https://x.com/e2b) -------------------------------------------------------------------------------- /apps/web/src/app/(docs)/docs/legacy/getting-started/api-key/page.mdx: -------------------------------------------------------------------------------- 1 | ## Use API key 2 | 3 | To use the API key, you either: 4 | - **Set the API key as the `E2B_API_KEY` environment variable** 5 | - Or pass it directly to the `CodeInterpreter` constructor like this: 6 | 7 | ```js {{ language: 'js' }} 8 | import { CodeInterpreter } from '@e2b/code-interpreter' 9 | 10 | const sandbox = await CodeInterpreter.create({ apiKey: 'YOUR_API_KEY' }) 11 | await sandbox.notebook.execCell('x = 1') 12 | 13 | const execution = await sandbox.notebook.execCell('x+=1; x') 14 | console.log(execution.text) // outputs 2 15 | 16 | await sandbox.close() 17 | ``` 18 | ```python {{ language: 'python' }} 19 | from e2b_code_interpreter import CodeInterpreter 20 | 21 | with CodeInterpreter(api_key="YOUR_API_KEY") as code_interpreter: 22 | sandbox.notebook.exec_cell("x = 1") 23 | execution = sandbox.notebook.exec_cell("x+=1; x") 24 | print(execution.text) # outputs 2 25 | ``` 26 | 27 | -------------------------------------------------------------------------------- /apps/web/src/app/(docs)/docs/legacy/getting-started/installation/page.mdx: -------------------------------------------------------------------------------- 1 | import { Libraries } from '@/components/Libraries' 2 | 3 | # Installation 4 | 5 | You create and control sandboxes with our SDKs. 6 | We offer SDKs for [JavaScript / TypeScript](https://www.npmjs.com/package/e2b), and [Python](https://pypi.org/project/e2b/). 7 | 8 | 9 | 10 | You can install them using the following commands: 11 | 12 | 13 | ```bash {{ language: 'js' }} 14 | npm install e2b 15 | ``` 16 | ```bash {{ language: 'python' }} 17 | pip install e2b 18 | ``` 19 | 20 | 21 | 22 | ## Next steps 23 | 24 | 1. [Get your API key](/docs/getting-started/api-key) 25 | 1. [Explore the Sandbox API](/docs/sandbox/api/envs) 26 | {/* 1. [Follow the "Hello World" example](/docs/guides/) */} 27 | {/* 1. [Check out the official guides](/docs/guides/overview) */} 28 | {/* 1. [Explore integrations with AI frameworks and LLMs](/docs/integrations/overview) */} 29 | -------------------------------------------------------------------------------- /apps/web/src/app/(docs)/docs/legacy/open-source/page.mdx: -------------------------------------------------------------------------------- 1 | # Open source 2 | 3 | E2B is fully open source including the infrastructure layer. 4 | 5 | - [E2B monorepo containing the SDKs, CLI, and docs](https://github.com/e2b-dev/e2b) 6 | - [E2B infrastructure](https://github.com/e2b-dev/infra) 7 | - [Example code interpreter ChatGPT plugin](https://github.com/e2b-dev/llm-code-interpreter) 8 | - [List of awesome SDKs for AI agents](https://github.com/e2b-dev/awesome-sdks-for-ai-agents) 9 | - [List of awesome AI agents](https://github.com/e2b-dev/awesome-ai-agents) 10 | {/* - [E2B cookbook](https://github.com/e2b-dev/e2b-cookbook) */} 11 | -------------------------------------------------------------------------------- /apps/web/src/app/(docs)/docs/legacy/sandbox/api/cwd/page.mdx: -------------------------------------------------------------------------------- 1 | # Current Working Directory 2 | 3 | You can set a working directory either for the whole sandbox, a filesystem operation, or a new process. 4 | 5 | ## Sandbox 6 | 7 | If the current working directory for the sandbox is not set, it will default to the home directory - `/home/user`. 8 | 9 | 10 | 11 | ## Filesystem 12 | 13 | All filesystem operations with relative paths are relative to the current working directory. 14 | 15 | 16 | 17 | ## Process 18 | 19 | If you set a working directory for the sandbox, all processes will inherit it. You can override it for each process. 20 | 21 | 22 | -------------------------------------------------------------------------------- /apps/web/src/app/(docs)/docs/legacy/sandbox/api/debugging/page.mdx: -------------------------------------------------------------------------------- 1 | export const sections = [ 2 | { title: 'Logging', id: 'logging' }, 3 | ] 4 | 5 | # Logging 6 | 7 | 8 | ```js {{ language: 'js', text: "E2B package logs only warnings & errors to the console by default. Below is an example of how to fully customize the logging levels.\n\nFeel free to override the logger with your own implementation with debug, info, warn, and error methods." }} 9 | ``` 10 | ```python {{ language: 'python', text: "E2B package uses the standard Python logging module You can configure the logging level, handlers and format as you would with any other Python application. \n\nBelow is an example of how to configure the logging module to log to the console." }} 11 | ``` 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /apps/web/src/app/(docs)/docs/legacy/sandbox/api/download/page.mdx: -------------------------------------------------------------------------------- 1 | # Download files from the sandbox 2 | Any file inside the sandbox can be downloaded using the `downloadFile`/`download_file` method. 3 | 4 | ## Use case for downloading files 5 | For example, the download file method is useful for downloading any files produced by LLM. You can let LLM generate and execute code inside the sandbox. 6 | This LLM-generated code might produce some files like charts, CSV files, or PDF files that you want to download to your machine. 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /apps/web/src/app/(docs)/docs/legacy/sandbox/api/envs/page.mdx: -------------------------------------------------------------------------------- 1 | # Setting environment variables 2 | 3 | ## Global environment variables 4 | You can set the sandbox's global environment variables when initializing a new sandbox. 5 | 9 | 10 | 11 | ## Environment variables per process 12 | Alternatively, you can set environment variables when starting a new process. These environment variables are accessible only for this process. 13 | 14 | 15 | Environment variables set when starting a new process have precedence over the environment variables set when initializing the sandbox. 16 | 17 | 18 | -------------------------------------------------------------------------------- /apps/web/src/app/(docs)/docs/legacy/sandbox/api/metadata/page.mdx: -------------------------------------------------------------------------------- 1 | ## Sandbox metadata 2 | 3 | You can assign metadata to your sandbox. This metadata will be available if you call `Sandbox.list()`. This can be useful in situation where each of your users have dedicated sandbox and the time between the steps of the integration is long. You can use the metadata to store the user id and reconnect to it later. 4 | 5 | 9 | -------------------------------------------------------------------------------- /apps/web/src/app/(docs)/docs/legacy/sandbox/api/timeouts/page.mdx: -------------------------------------------------------------------------------- 1 | # Timeouts 2 | 3 | The SDK has a number of timeouts that can be configured to control how long the SDK will wait for a response from the E2B servers. **The default is 60 seconds.** 4 | 5 | ## Timeout creating sandbox 6 | 7 | 8 | ## Timeout process 9 | 10 | 11 | ## Timeout filesystem operations 12 | -------------------------------------------------------------------------------- /apps/web/src/app/(docs)/docs/legacy/sandbox/api/upload/page.mdx: -------------------------------------------------------------------------------- 1 | # Upload files to sandbox 2 | You can upload any file to the sandbox. This is useful if you want to let the LLM work with your files or files of your users. The file will be uploaded to the user's home directory with the same name. If a file with the same name already exists, it will be overwritten. 3 | 4 | ## Use case for uploading files 5 | A popular workflow is for example to upload a CSV data file and then let the LLM generate and execute Python code that operates with the uploaded CSV file inside the sandbox. This way, you can essentially create your own AI data analyst or code interpreter. 6 | 7 | 8 | We support uploading files up to 100MB at the moment. If you need to upload larger files, please [reach out to us](/docs/getting-help). 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /apps/web/src/app/(docs)/docs/legacy/sandbox/api/url/page.mdx: -------------------------------------------------------------------------------- 1 | # Sandbox URL 2 | Each sandbox has its own URL that you can use to connect to any service running inside the sandbox. 3 | 4 | For example, you can start a server inside the sandbox and connect to it from your browser. 5 | 6 | 7 | 8 | 9 | If you want to get an URL for a specific port inside the sandbox, pass the port number to the `getHostname()`/`get_hostname()` method. 10 | 11 | -------------------------------------------------------------------------------- /apps/web/src/app/(docs)/docs/legacy/sandbox/compute/page.mdx: -------------------------------------------------------------------------------- 1 | import SandboxSpec from '@/components/SandboxSpec' 2 | 3 | # Sandbox compute 4 | Pro customers can customize the sandbox with **any combination** of the CPU and RAM based on the following tables. 5 | 6 | Read a dedicated page to [learn more about pricing](/docs/pricing). 7 | 8 | 9 | By default your sandbox has 2 vCPU and 512 MiB RAM. 10 | 11 | To customize your sandbox compute, you need to build your custom sandbox template using the [E2B CLI](/docs/cli/installation). 12 | Run [`e2b template build`](/docs/cli/commands#template-build) and specify the `--cpu-count` and `--memory-mb` options. 13 | 14 | For example, this custom build command gives your sandbox 8 vCPU and 4GiB of RAM 15 | ```sh 16 | e2b template build --cpu-count 8 --memory-mb 4096 17 | ``` 18 | 19 | 20 | 21 | 22 |
23 | 24 | [Let us know](/docs/getting-help) if you need more powerful compute. -------------------------------------------------------------------------------- /apps/web/src/app/(docs)/docs/legacy/supported/page.mdx: -------------------------------------------------------------------------------- 1 | # Supported LLMs and AI frameworks 2 | E2B is LLM agnostic - it supports any LLM models and any AI frameworks. 3 | 4 | Usually, all you need from the model is just support for tool use. You then use the E2B code interpreter as a tool. 5 | If the LLM doesn't support tool use, you can ask the LLM to respond with Markdown or XML and parse the LLM's output on your own. Then just pass the parsed code from code blocks to the code interpreter. 6 | 7 | 8 | Check out our [cookbook](https://github.com/e2b-dev/e2b-cookbook) for examples. 9 | -------------------------------------------------------------------------------- /apps/web/src/app/(docs)/docs/sandbox-template/customize-cpu-ram/page.mdx: -------------------------------------------------------------------------------- 1 | # Customize sandbox CPU & RAM 2 | You can customize the CPU and RAM of your sandbox template via E2B CLI. 3 | 4 | You'll need to create a sandbox [template first](/docs/sandbox-template). 5 | 6 | During the build step, you can specify the CPU and RAM of your sandbox template. 7 | 8 | The following command will create a sandbox template with 2 CPUs and 2GB of RAM. 9 | 10 | ```bash 11 | e2b template build -c "/root/.jupyter/start-up.sh" --cpu-count 2 --memory-mb 2048 12 | ``` 13 | 14 | -------------------------------------------------------------------------------- /apps/web/src/app/(docs)/docs/sandbox/installing-beta-sdks/page.mdx: -------------------------------------------------------------------------------- 1 | # Installing beta SDKs 2 | 3 | To use features like [sandbox persistence](/docs/sandbox/persistence) and [metrics](/docs/sandbox/metrics), you need to install the beta version of the SDKs. 4 | 5 | ### Code Interpreter SDK 6 | 7 | 8 | ```bash {{ language: 'js' }} 9 | npm i @e2b/code-interpreter@beta 10 | ``` 11 | 12 | ```bash {{ language: 'python' }} 13 | pip install e2b-code-interpreter==1.2.0b5 14 | ``` 15 | 16 | 17 | ### Core SDK 18 | 19 | 20 | ```bash {{ language: 'js' }} 21 | npm i e2b@beta 22 | ``` 23 | 24 | ```bash {{ language: 'python' }} 25 | pip install e2b==1.2.0b6 26 | ``` 27 | 28 | 29 | ### Desktop SDK 30 | 31 | 32 | ```bash {{ language: 'js' }} 33 | npm i @e2b/desktop@beta 34 | ``` 35 | 36 | ```bash {{ language: 'python' }} 37 | pip install e2b-desktop==1.7.1b1 38 | ``` 39 | -------------------------------------------------------------------------------- /apps/web/src/app/(docs)/docs/sdk-reference/cli/v1.0.0/auth/page.mdx: -------------------------------------------------------------------------------- 1 | ## e2b auth 2 | 3 | 4 | authentication commands 5 | 6 | ### Usage 7 | 8 | ```bash 9 | e2b auth [options] [command] 10 | ``` 11 | ## e2b auth login 12 | 13 | 14 | log in to CLI 15 | 16 | ### Usage 17 | 18 | ```bash 19 | e2b auth login [options] 20 | ``` 21 | 22 | 23 | ## e2b auth logout 24 | 25 | 26 | log out of CLI 27 | 28 | ### Usage 29 | 30 | ```bash 31 | e2b auth logout [options] 32 | ``` 33 | 34 | 35 | ## e2b auth info 36 | 37 | 38 | get information about the current user 39 | 40 | ### Usage 41 | 42 | ```bash 43 | e2b auth info [options] 44 | ``` 45 | 46 | 47 | ## e2b auth configure 48 | 49 | 50 | configure user 51 | 52 | ### Usage 53 | 54 | ```bash 55 | e2b auth configure [options] 56 | ``` 57 | 58 | 59 | -------------------------------------------------------------------------------- /apps/web/src/app/(docs)/docs/sdk-reference/cli/v1.0.1/auth/page.mdx: -------------------------------------------------------------------------------- 1 | ## e2b auth 2 | 3 | 4 | authentication commands 5 | 6 | ### Usage 7 | 8 | ```bash 9 | e2b auth [options] [command] 10 | ``` 11 | ## e2b auth login 12 | 13 | 14 | log in to CLI 15 | 16 | ### Usage 17 | 18 | ```bash 19 | e2b auth login [options] 20 | ``` 21 | 22 | 23 | ## e2b auth logout 24 | 25 | 26 | log out of CLI 27 | 28 | ### Usage 29 | 30 | ```bash 31 | e2b auth logout [options] 32 | ``` 33 | 34 | 35 | ## e2b auth info 36 | 37 | 38 | get information about the current user 39 | 40 | ### Usage 41 | 42 | ```bash 43 | e2b auth info [options] 44 | ``` 45 | 46 | 47 | ## e2b auth configure 48 | 49 | 50 | configure user 51 | 52 | ### Usage 53 | 54 | ```bash 55 | e2b auth configure [options] 56 | ``` 57 | 58 | 59 | -------------------------------------------------------------------------------- /apps/web/src/app/(docs)/docs/sdk-reference/cli/v1.0.10/auth/page.mdx: -------------------------------------------------------------------------------- 1 | ## e2b auth 2 | 3 | 4 | authentication commands 5 | 6 | ### Usage 7 | 8 | ```bash 9 | e2b auth [options] [command] 10 | ``` 11 | ## e2b auth login 12 | 13 | 14 | log in to CLI 15 | 16 | ### Usage 17 | 18 | ```bash 19 | e2b auth login [options] 20 | ``` 21 | 22 | 23 | ## e2b auth logout 24 | 25 | 26 | log out of CLI 27 | 28 | ### Usage 29 | 30 | ```bash 31 | e2b auth logout [options] 32 | ``` 33 | 34 | 35 | ## e2b auth info 36 | 37 | 38 | get information about the current user 39 | 40 | ### Usage 41 | 42 | ```bash 43 | e2b auth info [options] 44 | ``` 45 | 46 | 47 | ## e2b auth configure 48 | 49 | 50 | configure user 51 | 52 | ### Usage 53 | 54 | ```bash 55 | e2b auth configure [options] 56 | ``` 57 | 58 | 59 | -------------------------------------------------------------------------------- /apps/web/src/app/(docs)/docs/sdk-reference/cli/v1.0.2/auth/page.mdx: -------------------------------------------------------------------------------- 1 | ## e2b auth 2 | 3 | 4 | authentication commands 5 | 6 | ### Usage 7 | 8 | ```bash 9 | e2b auth [options] [command] 10 | ``` 11 | ## e2b auth login 12 | 13 | 14 | log in to CLI 15 | 16 | ### Usage 17 | 18 | ```bash 19 | e2b auth login [options] 20 | ``` 21 | 22 | 23 | ## e2b auth logout 24 | 25 | 26 | log out of CLI 27 | 28 | ### Usage 29 | 30 | ```bash 31 | e2b auth logout [options] 32 | ``` 33 | 34 | 35 | ## e2b auth info 36 | 37 | 38 | get information about the current user 39 | 40 | ### Usage 41 | 42 | ```bash 43 | e2b auth info [options] 44 | ``` 45 | 46 | 47 | ## e2b auth configure 48 | 49 | 50 | configure user 51 | 52 | ### Usage 53 | 54 | ```bash 55 | e2b auth configure [options] 56 | ``` 57 | 58 | 59 | -------------------------------------------------------------------------------- /apps/web/src/app/(docs)/docs/sdk-reference/cli/v1.0.3/auth/page.mdx: -------------------------------------------------------------------------------- 1 | ## e2b auth 2 | 3 | 4 | authentication commands 5 | 6 | ### Usage 7 | 8 | ```bash 9 | e2b auth [options] [command] 10 | ``` 11 | ## e2b auth login 12 | 13 | 14 | log in to CLI 15 | 16 | ### Usage 17 | 18 | ```bash 19 | e2b auth login [options] 20 | ``` 21 | 22 | 23 | ## e2b auth logout 24 | 25 | 26 | log out of CLI 27 | 28 | ### Usage 29 | 30 | ```bash 31 | e2b auth logout [options] 32 | ``` 33 | 34 | 35 | ## e2b auth info 36 | 37 | 38 | get information about the current user 39 | 40 | ### Usage 41 | 42 | ```bash 43 | e2b auth info [options] 44 | ``` 45 | 46 | 47 | ## e2b auth configure 48 | 49 | 50 | configure user 51 | 52 | ### Usage 53 | 54 | ```bash 55 | e2b auth configure [options] 56 | ``` 57 | 58 | 59 | -------------------------------------------------------------------------------- /apps/web/src/app/(docs)/docs/sdk-reference/cli/v1.0.4/auth/page.mdx: -------------------------------------------------------------------------------- 1 | ## e2b auth 2 | 3 | 4 | authentication commands 5 | 6 | ### Usage 7 | 8 | ```bash 9 | e2b auth [options] [command] 10 | ``` 11 | ## e2b auth login 12 | 13 | 14 | log in to CLI 15 | 16 | ### Usage 17 | 18 | ```bash 19 | e2b auth login [options] 20 | ``` 21 | 22 | 23 | ## e2b auth logout 24 | 25 | 26 | log out of CLI 27 | 28 | ### Usage 29 | 30 | ```bash 31 | e2b auth logout [options] 32 | ``` 33 | 34 | 35 | ## e2b auth info 36 | 37 | 38 | get information about the current user 39 | 40 | ### Usage 41 | 42 | ```bash 43 | e2b auth info [options] 44 | ``` 45 | 46 | 47 | ## e2b auth configure 48 | 49 | 50 | configure user 51 | 52 | ### Usage 53 | 54 | ```bash 55 | e2b auth configure [options] 56 | ``` 57 | 58 | 59 | -------------------------------------------------------------------------------- /apps/web/src/app/(docs)/docs/sdk-reference/cli/v1.0.5/auth/page.mdx: -------------------------------------------------------------------------------- 1 | ## e2b auth 2 | 3 | 4 | authentication commands 5 | 6 | ### Usage 7 | 8 | ```bash 9 | e2b auth [options] [command] 10 | ``` 11 | ## e2b auth login 12 | 13 | 14 | log in to CLI 15 | 16 | ### Usage 17 | 18 | ```bash 19 | e2b auth login [options] 20 | ``` 21 | 22 | 23 | ## e2b auth logout 24 | 25 | 26 | log out of CLI 27 | 28 | ### Usage 29 | 30 | ```bash 31 | e2b auth logout [options] 32 | ``` 33 | 34 | 35 | ## e2b auth info 36 | 37 | 38 | get information about the current user 39 | 40 | ### Usage 41 | 42 | ```bash 43 | e2b auth info [options] 44 | ``` 45 | 46 | 47 | ## e2b auth configure 48 | 49 | 50 | configure user 51 | 52 | ### Usage 53 | 54 | ```bash 55 | e2b auth configure [options] 56 | ``` 57 | 58 | 59 | -------------------------------------------------------------------------------- /apps/web/src/app/(docs)/docs/sdk-reference/cli/v1.0.6/auth/page.mdx: -------------------------------------------------------------------------------- 1 | ## e2b auth 2 | 3 | 4 | authentication commands 5 | 6 | ### Usage 7 | 8 | ```bash 9 | e2b auth [options] [command] 10 | ``` 11 | ## e2b auth login 12 | 13 | 14 | log in to CLI 15 | 16 | ### Usage 17 | 18 | ```bash 19 | e2b auth login [options] 20 | ``` 21 | 22 | 23 | ## e2b auth logout 24 | 25 | 26 | log out of CLI 27 | 28 | ### Usage 29 | 30 | ```bash 31 | e2b auth logout [options] 32 | ``` 33 | 34 | 35 | ## e2b auth info 36 | 37 | 38 | get information about the current user 39 | 40 | ### Usage 41 | 42 | ```bash 43 | e2b auth info [options] 44 | ``` 45 | 46 | 47 | ## e2b auth configure 48 | 49 | 50 | configure user 51 | 52 | ### Usage 53 | 54 | ```bash 55 | e2b auth configure [options] 56 | ``` 57 | 58 | 59 | -------------------------------------------------------------------------------- /apps/web/src/app/(docs)/docs/sdk-reference/cli/v1.0.7/auth/page.mdx: -------------------------------------------------------------------------------- 1 | ## e2b auth 2 | 3 | 4 | authentication commands 5 | 6 | ### Usage 7 | 8 | ```bash 9 | e2b auth [options] [command] 10 | ``` 11 | ## e2b auth login 12 | 13 | 14 | log in to CLI 15 | 16 | ### Usage 17 | 18 | ```bash 19 | e2b auth login [options] 20 | ``` 21 | 22 | 23 | ## e2b auth logout 24 | 25 | 26 | log out of CLI 27 | 28 | ### Usage 29 | 30 | ```bash 31 | e2b auth logout [options] 32 | ``` 33 | 34 | 35 | ## e2b auth info 36 | 37 | 38 | get information about the current user 39 | 40 | ### Usage 41 | 42 | ```bash 43 | e2b auth info [options] 44 | ``` 45 | 46 | 47 | ## e2b auth configure 48 | 49 | 50 | configure user 51 | 52 | ### Usage 53 | 54 | ```bash 55 | e2b auth configure [options] 56 | ``` 57 | 58 | 59 | -------------------------------------------------------------------------------- /apps/web/src/app/(docs)/docs/sdk-reference/cli/v1.0.8/auth/page.mdx: -------------------------------------------------------------------------------- 1 | ## e2b auth 2 | 3 | 4 | authentication commands 5 | 6 | ### Usage 7 | 8 | ```bash 9 | e2b auth [options] [command] 10 | ``` 11 | ## e2b auth login 12 | 13 | 14 | log in to CLI 15 | 16 | ### Usage 17 | 18 | ```bash 19 | e2b auth login [options] 20 | ``` 21 | 22 | 23 | ## e2b auth logout 24 | 25 | 26 | log out of CLI 27 | 28 | ### Usage 29 | 30 | ```bash 31 | e2b auth logout [options] 32 | ``` 33 | 34 | 35 | ## e2b auth info 36 | 37 | 38 | get information about the current user 39 | 40 | ### Usage 41 | 42 | ```bash 43 | e2b auth info [options] 44 | ``` 45 | 46 | 47 | ## e2b auth configure 48 | 49 | 50 | configure user 51 | 52 | ### Usage 53 | 54 | ```bash 55 | e2b auth configure [options] 56 | ``` 57 | 58 | 59 | -------------------------------------------------------------------------------- /apps/web/src/app/(docs)/docs/sdk-reference/cli/v1.0.9/auth/page.mdx: -------------------------------------------------------------------------------- 1 | ## e2b auth 2 | 3 | 4 | authentication commands 5 | 6 | ### Usage 7 | 8 | ```bash 9 | e2b auth [options] [command] 10 | ``` 11 | ## e2b auth login 12 | 13 | 14 | log in to CLI 15 | 16 | ### Usage 17 | 18 | ```bash 19 | e2b auth login [options] 20 | ``` 21 | 22 | 23 | ## e2b auth logout 24 | 25 | 26 | log out of CLI 27 | 28 | ### Usage 29 | 30 | ```bash 31 | e2b auth logout [options] 32 | ``` 33 | 34 | 35 | ## e2b auth info 36 | 37 | 38 | get information about the current user 39 | 40 | ### Usage 41 | 42 | ```bash 43 | e2b auth info [options] 44 | ``` 45 | 46 | 47 | ## e2b auth configure 48 | 49 | 50 | configure user 51 | 52 | ### Usage 53 | 54 | ```bash 55 | e2b auth configure [options] 56 | ``` 57 | 58 | 59 | -------------------------------------------------------------------------------- /apps/web/src/app/(docs)/docs/sdk-reference/cli/v1.2.0/auth/page.mdx: -------------------------------------------------------------------------------- 1 | ## e2b auth 2 | 3 | 4 | authentication commands 5 | 6 | ### Usage 7 | 8 | ```bash 9 | e2b auth [options] [command] 10 | ``` 11 | ## e2b auth login 12 | 13 | 14 | log in to CLI 15 | 16 | ### Usage 17 | 18 | ```bash 19 | e2b auth login [options] 20 | ``` 21 | 22 | 23 | ## e2b auth logout 24 | 25 | 26 | log out of CLI 27 | 28 | ### Usage 29 | 30 | ```bash 31 | e2b auth logout [options] 32 | ``` 33 | 34 | 35 | ## e2b auth info 36 | 37 | 38 | get information about the current user 39 | 40 | ### Usage 41 | 42 | ```bash 43 | e2b auth info [options] 44 | ``` 45 | 46 | 47 | ## e2b auth configure 48 | 49 | 50 | configure user 51 | 52 | ### Usage 53 | 54 | ```bash 55 | e2b auth configure [options] 56 | ``` 57 | 58 | 59 | -------------------------------------------------------------------------------- /apps/web/src/app/(docs)/docs/sdk-reference/cli/v1.2.1/auth/page.mdx: -------------------------------------------------------------------------------- 1 | ## e2b auth 2 | 3 | 4 | authentication commands 5 | 6 | ### Usage 7 | 8 | ```bash 9 | e2b auth [options] [command] 10 | ``` 11 | ## e2b auth login 12 | 13 | 14 | log in to CLI 15 | 16 | ### Usage 17 | 18 | ```bash 19 | e2b auth login [options] 20 | ``` 21 | 22 | 23 | ## e2b auth logout 24 | 25 | 26 | log out of CLI 27 | 28 | ### Usage 29 | 30 | ```bash 31 | e2b auth logout [options] 32 | ``` 33 | 34 | 35 | ## e2b auth info 36 | 37 | 38 | get information about the current user 39 | 40 | ### Usage 41 | 42 | ```bash 43 | e2b auth info [options] 44 | ``` 45 | 46 | 47 | ## e2b auth configure 48 | 49 | 50 | configure user 51 | 52 | ### Usage 53 | 54 | ```bash 55 | e2b auth configure [options] 56 | ``` 57 | 58 | 59 | -------------------------------------------------------------------------------- /apps/web/src/app/(docs)/docs/sdk-reference/cli/v1.2.2/auth/page.mdx: -------------------------------------------------------------------------------- 1 | ## e2b auth 2 | 3 | 4 | authentication commands 5 | 6 | ### Usage 7 | 8 | ```bash 9 | e2b auth [options] [command] 10 | ``` 11 | ## e2b auth login 12 | 13 | 14 | log in to CLI 15 | 16 | ### Usage 17 | 18 | ```bash 19 | e2b auth login [options] 20 | ``` 21 | 22 | 23 | ## e2b auth logout 24 | 25 | 26 | log out of CLI 27 | 28 | ### Usage 29 | 30 | ```bash 31 | e2b auth logout [options] 32 | ``` 33 | 34 | 35 | ## e2b auth info 36 | 37 | 38 | get information about the current user 39 | 40 | ### Usage 41 | 42 | ```bash 43 | e2b auth info [options] 44 | ``` 45 | 46 | 47 | ## e2b auth configure 48 | 49 | 50 | configure user 51 | 52 | ### Usage 53 | 54 | ```bash 55 | e2b auth configure [options] 56 | ``` 57 | 58 | 59 | -------------------------------------------------------------------------------- /apps/web/src/app/(docs)/docs/sdk-reference/cli/v1.2.3/auth/page.mdx: -------------------------------------------------------------------------------- 1 | ## e2b auth 2 | 3 | 4 | authentication commands 5 | 6 | ### Usage 7 | 8 | ```bash 9 | e2b auth [options] [command] 10 | ``` 11 | ## e2b auth login 12 | 13 | 14 | log in to CLI 15 | 16 | ### Usage 17 | 18 | ```bash 19 | e2b auth login [options] 20 | ``` 21 | 22 | 23 | ## e2b auth logout 24 | 25 | 26 | log out of CLI 27 | 28 | ### Usage 29 | 30 | ```bash 31 | e2b auth logout [options] 32 | ``` 33 | 34 | 35 | ## e2b auth info 36 | 37 | 38 | get information about the current user 39 | 40 | ### Usage 41 | 42 | ```bash 43 | e2b auth info [options] 44 | ``` 45 | 46 | 47 | ## e2b auth configure 48 | 49 | 50 | configure user 51 | 52 | ### Usage 53 | 54 | ```bash 55 | e2b auth configure [options] 56 | ``` 57 | 58 | 59 | -------------------------------------------------------------------------------- /apps/web/src/app/(docs)/docs/sdk-reference/cli/v1.3.0/auth/page.mdx: -------------------------------------------------------------------------------- 1 | ## e2b auth 2 | 3 | 4 | authentication commands 5 | 6 | ### Usage 7 | 8 | ```bash 9 | e2b auth [options] [command] 10 | ``` 11 | ## e2b auth login 12 | 13 | 14 | log in to CLI 15 | 16 | ### Usage 17 | 18 | ```bash 19 | e2b auth login [options] 20 | ``` 21 | 22 | 23 | ## e2b auth logout 24 | 25 | 26 | log out of CLI 27 | 28 | ### Usage 29 | 30 | ```bash 31 | e2b auth logout [options] 32 | ``` 33 | 34 | 35 | ## e2b auth info 36 | 37 | 38 | get information about the current user 39 | 40 | ### Usage 41 | 42 | ```bash 43 | e2b auth info [options] 44 | ``` 45 | 46 | 47 | ## e2b auth configure 48 | 49 | 50 | configure user 51 | 52 | ### Usage 53 | 54 | ```bash 55 | e2b auth configure [options] 56 | ``` 57 | 58 | 59 | -------------------------------------------------------------------------------- /apps/web/src/app/(docs)/docs/sdk-reference/cli/v1.3.1/auth/page.mdx: -------------------------------------------------------------------------------- 1 | ## e2b auth 2 | 3 | 4 | authentication commands 5 | 6 | ### Usage 7 | 8 | ```bash 9 | e2b auth [options] [command] 10 | ``` 11 | ## e2b auth login 12 | 13 | 14 | log in to CLI 15 | 16 | ### Usage 17 | 18 | ```bash 19 | e2b auth login [options] 20 | ``` 21 | 22 | 23 | ## e2b auth logout 24 | 25 | 26 | log out of CLI 27 | 28 | ### Usage 29 | 30 | ```bash 31 | e2b auth logout [options] 32 | ``` 33 | 34 | 35 | ## e2b auth info 36 | 37 | 38 | get information about the current user 39 | 40 | ### Usage 41 | 42 | ```bash 43 | e2b auth info [options] 44 | ``` 45 | 46 | 47 | ## e2b auth configure 48 | 49 | 50 | configure user 51 | 52 | ### Usage 53 | 54 | ```bash 55 | e2b auth configure [options] 56 | ``` 57 | 58 | 59 | -------------------------------------------------------------------------------- /apps/web/src/app/(docs)/docs/sdk-reference/cli/v1.3.2/auth/page.mdx: -------------------------------------------------------------------------------- 1 | ## e2b auth 2 | 3 | 4 | authentication commands 5 | 6 | ### Usage 7 | 8 | ```bash 9 | e2b auth [options] [command] 10 | ``` 11 | ## e2b auth login 12 | 13 | 14 | log in to CLI 15 | 16 | ### Usage 17 | 18 | ```bash 19 | e2b auth login [options] 20 | ``` 21 | 22 | 23 | ## e2b auth logout 24 | 25 | 26 | log out of CLI 27 | 28 | ### Usage 29 | 30 | ```bash 31 | e2b auth logout [options] 32 | ``` 33 | 34 | 35 | ## e2b auth info 36 | 37 | 38 | get information about the current user 39 | 40 | ### Usage 41 | 42 | ```bash 43 | e2b auth info [options] 44 | ``` 45 | 46 | 47 | ## e2b auth configure 48 | 49 | 50 | configure user 51 | 52 | ### Usage 53 | 54 | ```bash 55 | e2b auth configure [options] 56 | ``` 57 | 58 | 59 | -------------------------------------------------------------------------------- /apps/web/src/app/(docs)/docs/sdk-reference/cli/v1.3.3/auth/page.mdx: -------------------------------------------------------------------------------- 1 | ## e2b auth 2 | 3 | 4 | authentication commands 5 | 6 | ### Usage 7 | 8 | ```bash 9 | e2b auth [options] [command] 10 | ``` 11 | ## e2b auth login 12 | 13 | 14 | log in to CLI 15 | 16 | ### Usage 17 | 18 | ```bash 19 | e2b auth login [options] 20 | ``` 21 | 22 | 23 | ## e2b auth logout 24 | 25 | 26 | log out of CLI 27 | 28 | ### Usage 29 | 30 | ```bash 31 | e2b auth logout [options] 32 | ``` 33 | 34 | 35 | ## e2b auth info 36 | 37 | 38 | get information about the current user 39 | 40 | ### Usage 41 | 42 | ```bash 43 | e2b auth info [options] 44 | ``` 45 | 46 | 47 | ## e2b auth configure 48 | 49 | 50 | configure user 51 | 52 | ### Usage 53 | 54 | ```bash 55 | e2b auth configure [options] 56 | ``` 57 | 58 | 59 | -------------------------------------------------------------------------------- /apps/web/src/app/(docs)/docs/sdk-reference/cli/v1.3.4/auth/page.mdx: -------------------------------------------------------------------------------- 1 | ## e2b auth 2 | 3 | 4 | authentication commands 5 | 6 | ### Usage 7 | 8 | ```bash 9 | e2b auth [options] [command] 10 | ``` 11 | ## e2b auth login 12 | 13 | 14 | log in to CLI 15 | 16 | ### Usage 17 | 18 | ```bash 19 | e2b auth login [options] 20 | ``` 21 | 22 | 23 | ## e2b auth logout 24 | 25 | 26 | log out of CLI 27 | 28 | ### Usage 29 | 30 | ```bash 31 | e2b auth logout [options] 32 | ``` 33 | 34 | 35 | ## e2b auth info 36 | 37 | 38 | get information about the current user 39 | 40 | ### Usage 41 | 42 | ```bash 43 | e2b auth info [options] 44 | ``` 45 | 46 | 47 | ## e2b auth configure 48 | 49 | 50 | configure user 51 | 52 | ### Usage 53 | 54 | ```bash 55 | e2b auth configure [options] 56 | ``` 57 | 58 | 59 | -------------------------------------------------------------------------------- /apps/web/src/app/(docs)/docs/sdk-reference/cli/v1.4.0/auth/page.mdx: -------------------------------------------------------------------------------- 1 | ## e2b auth 2 | 3 | 4 | authentication commands 5 | 6 | ### Usage 7 | 8 | ```bash 9 | e2b auth [options] [command] 10 | ``` 11 | ## e2b auth login 12 | 13 | 14 | log in to CLI 15 | 16 | ### Usage 17 | 18 | ```bash 19 | e2b auth login [options] 20 | ``` 21 | 22 | 23 | ## e2b auth logout 24 | 25 | 26 | log out of CLI 27 | 28 | ### Usage 29 | 30 | ```bash 31 | e2b auth logout [options] 32 | ``` 33 | 34 | 35 | ## e2b auth info 36 | 37 | 38 | get information about the current user 39 | 40 | ### Usage 41 | 42 | ```bash 43 | e2b auth info [options] 44 | ``` 45 | 46 | 47 | ## e2b auth configure 48 | 49 | 50 | configure user 51 | 52 | ### Usage 53 | 54 | ```bash 55 | e2b auth configure [options] 56 | ``` 57 | 58 | 59 | -------------------------------------------------------------------------------- /apps/web/src/app/(docs)/docs/sdk-reference/cli/v1.4.1/auth/page.mdx: -------------------------------------------------------------------------------- 1 | ## e2b auth 2 | 3 | 4 | authentication commands 5 | 6 | ### Usage 7 | 8 | ```bash 9 | e2b auth [options] [command] 10 | ``` 11 | ## e2b auth login 12 | 13 | 14 | log in to CLI 15 | 16 | ### Usage 17 | 18 | ```bash 19 | e2b auth login [options] 20 | ``` 21 | 22 | 23 | ## e2b auth logout 24 | 25 | 26 | log out of CLI 27 | 28 | ### Usage 29 | 30 | ```bash 31 | e2b auth logout [options] 32 | ``` 33 | 34 | 35 | ## e2b auth info 36 | 37 | 38 | get information about the current user 39 | 40 | ### Usage 41 | 42 | ```bash 43 | e2b auth info [options] 44 | ``` 45 | 46 | 47 | ## e2b auth configure 48 | 49 | 50 | configure user 51 | 52 | ### Usage 53 | 54 | ```bash 55 | e2b auth configure [options] 56 | ``` 57 | 58 | 59 | -------------------------------------------------------------------------------- /apps/web/src/app/(docs)/docs/sdk-reference/cli/v1.4.2/auth/page.mdx: -------------------------------------------------------------------------------- 1 | ## e2b auth 2 | 3 | 4 | authentication commands 5 | 6 | ### Usage 7 | 8 | ```bash 9 | e2b auth [options] [command] 10 | ``` 11 | ## e2b auth login 12 | 13 | 14 | log in to CLI 15 | 16 | ### Usage 17 | 18 | ```bash 19 | e2b auth login [options] 20 | ``` 21 | 22 | 23 | ## e2b auth logout 24 | 25 | 26 | log out of CLI 27 | 28 | ### Usage 29 | 30 | ```bash 31 | e2b auth logout [options] 32 | ``` 33 | 34 | 35 | ## e2b auth info 36 | 37 | 38 | get information about the current user 39 | 40 | ### Usage 41 | 42 | ```bash 43 | e2b auth info [options] 44 | ``` 45 | 46 | 47 | ## e2b auth configure 48 | 49 | 50 | configure user 51 | 52 | ### Usage 53 | 54 | ```bash 55 | e2b auth configure [options] 56 | ``` 57 | 58 | 59 | -------------------------------------------------------------------------------- /apps/web/src/app/(docs)/docs/sdk-reference/cli/v1.4.3/auth/page.mdx: -------------------------------------------------------------------------------- 1 | ## e2b auth 2 | 3 | 4 | authentication commands 5 | 6 | ### Usage 7 | 8 | ```bash 9 | e2b auth [options] [command] 10 | ``` 11 | ## e2b auth login 12 | 13 | 14 | log in to CLI 15 | 16 | ### Usage 17 | 18 | ```bash 19 | e2b auth login [options] 20 | ``` 21 | 22 | 23 | ## e2b auth logout 24 | 25 | 26 | log out of CLI 27 | 28 | ### Usage 29 | 30 | ```bash 31 | e2b auth logout [options] 32 | ``` 33 | 34 | 35 | ## e2b auth info 36 | 37 | 38 | get information about the current user 39 | 40 | ### Usage 41 | 42 | ```bash 43 | e2b auth info [options] 44 | ``` 45 | 46 | 47 | ## e2b auth configure 48 | 49 | 50 | configure user 51 | 52 | ### Usage 53 | 54 | ```bash 55 | e2b auth configure [options] 56 | ``` 57 | 58 | 59 | -------------------------------------------------------------------------------- /apps/web/src/app/(docs)/docs/sdk-reference/code-interpreter-js-sdk/v1.0.4/consts/page.mdx: -------------------------------------------------------------------------------- 1 | ### DEFAULT\_TIMEOUT\_MS 2 | 3 | ```ts 4 | const DEFAULT_TIMEOUT_MS: 60000 = 60_000; 5 | ``` 6 | 7 | *** 8 | 9 | ### JUPYTER\_PORT 10 | 11 | ```ts 12 | const JUPYTER_PORT: 49999 = 49999; 13 | ``` 14 | -------------------------------------------------------------------------------- /apps/web/src/app/(docs)/docs/sdk-reference/code-interpreter-js-sdk/v1.1.0/consts/page.mdx: -------------------------------------------------------------------------------- 1 | ### DEFAULT\_TIMEOUT\_MS 2 | 3 | ```ts 4 | const DEFAULT_TIMEOUT_MS: 60000 = 60_000; 5 | ``` 6 | 7 | *** 8 | 9 | ### JUPYTER\_PORT 10 | 11 | ```ts 12 | const JUPYTER_PORT: 49999 = 49999; 13 | ``` 14 | -------------------------------------------------------------------------------- /apps/web/src/app/(docs)/docs/sdk-reference/code-interpreter-js-sdk/v1.1.1/consts/page.mdx: -------------------------------------------------------------------------------- 1 | ### DEFAULT\_TIMEOUT\_MS 2 | 3 | ```ts 4 | const DEFAULT_TIMEOUT_MS: 60000 = 60_000; 5 | ``` 6 | 7 | *** 8 | 9 | ### JUPYTER\_PORT 10 | 11 | ```ts 12 | const JUPYTER_PORT: 49999 = 49999; 13 | ``` 14 | -------------------------------------------------------------------------------- /apps/web/src/app/(docs)/docs/sdk-reference/code-interpreter-js-sdk/v1.2.0/consts/page.mdx: -------------------------------------------------------------------------------- 1 | ### DEFAULT\_TIMEOUT\_MS 2 | 3 | ```ts 4 | const DEFAULT_TIMEOUT_MS: 60000 = 60_000; 5 | ``` 6 | 7 | *** 8 | 9 | ### JUPYTER\_PORT 10 | 11 | ```ts 12 | const JUPYTER_PORT: 49999 = 49999; 13 | ``` 14 | -------------------------------------------------------------------------------- /apps/web/src/app/(docs)/docs/sdk-reference/code-interpreter-js-sdk/v1.5.0/consts/page.mdx: -------------------------------------------------------------------------------- 1 | ### DEFAULT\_TIMEOUT\_MS 2 | 3 | ```ts 4 | const DEFAULT_TIMEOUT_MS: 60000 = 60_000; 5 | ``` 6 | 7 | *** 8 | 9 | ### JUPYTER\_PORT 10 | 11 | ```ts 12 | const JUPYTER_PORT: 49999 = 49999; 13 | ``` 14 | -------------------------------------------------------------------------------- /apps/web/src/app/(docs)/docs/sdk-reference/code-interpreter-js-sdk/v1.5.1/consts/page.mdx: -------------------------------------------------------------------------------- 1 | ### DEFAULT\_TIMEOUT\_MS 2 | 3 | ```ts 4 | const DEFAULT_TIMEOUT_MS: 60000 = 60_000; 5 | ``` 6 | 7 | *** 8 | 9 | ### JUPYTER\_PORT 10 | 11 | ```ts 12 | const JUPYTER_PORT: 49999 = 49999; 13 | ``` 14 | -------------------------------------------------------------------------------- /apps/web/src/app/(docs)/docs/sdk-reference/page.mdx: -------------------------------------------------------------------------------- 1 | # SDK Reference 2 | 3 | This is the SDK reference for the [E2B CLI & Core SDK](https://github.com/e2b-dev/e2b), [Code Interpreter SDK](https://github.com/e2b-dev/code-interpreter), and [Desktop Sandbox SDK](https://github.com/e2b-dev/desktop). 4 | 5 | The reference is intended to be limited to low-level descriptions of various programmatic functionality. If you’re just getting started with E2B, we would instead recommend looking at the [documentation](/docs) first or to get started quickly with an example. 6 | -------------------------------------------------------------------------------- /apps/web/src/app/(docs)/docs/support/page.mdx: -------------------------------------------------------------------------------- 1 | import { Support } from './Support' 2 | 3 | # Need help? 4 | 5 | Join our Discord community, open GitHub issues, or send us an email if you have any questions or request. 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /apps/web/src/app/(docs)/docs/troubleshooting/sdks/workers-edge-runtime/page.mdx: -------------------------------------------------------------------------------- 1 | # Vercel Edge Runtime and Cloudflare Workers 2 | 3 | The E2B JavaScript SDK currently lacks support for Vercel Edge Runtime and Cloudflare Workers due to transport layer package incompatibility used for Sandbox communication. We recommend using supported runtimes like Node, Bun, or Deno instead. 4 | -------------------------------------------------------------------------------- /apps/web/src/app/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/e2b-dev/E2B/27e292eedcf04b52b88f5729079c2eb02ae0bc9f/apps/web/src/app/favicon.ico -------------------------------------------------------------------------------- /apps/web/src/app/hostnames.ts: -------------------------------------------------------------------------------- 1 | // We are in the process of migrating to the new landing page hosting. 2 | export const landingPageHostname = 'www.e2b-landing-page.com' 3 | export const landingPageFramerHostname = 'e2b-landing-page.framer.website' 4 | export const blogFramerHostname = 'e2b-blog.framer.website' 5 | export const changelogFramerHostname = 'e2b-changelog.framer.website' 6 | -------------------------------------------------------------------------------- /apps/web/src/app/not-found.tsx: -------------------------------------------------------------------------------- 1 | import Link from 'next/link' 2 | 3 | export default function NotFound() { 4 | return ( 5 |
14 |

Not Found

15 |

Could not find requested resource

16 | 17 | Return Home 18 | 19 |
20 | ) 21 | } 22 | -------------------------------------------------------------------------------- /apps/web/src/app/opengraph-image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/e2b-dev/E2B/27e292eedcf04b52b88f5729079c2eb02ae0bc9f/apps/web/src/app/opengraph-image.png -------------------------------------------------------------------------------- /apps/web/src/app/robots.ts: -------------------------------------------------------------------------------- 1 | import { MetadataRoute } from 'next' 2 | 3 | export default function robots(): MetadataRoute.Robots { 4 | return { 5 | rules: { 6 | userAgent: '*', 7 | allow: '/', 8 | }, 9 | sitemap: 'https://e2b.dev/sitemap.xml', 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /apps/web/src/app/twitter-image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/e2b-dev/E2B/27e292eedcf04b52b88f5729079c2eb02ae0bc9f/apps/web/src/app/twitter-image.png -------------------------------------------------------------------------------- /apps/web/src/code/js/agents/start_process.js: -------------------------------------------------------------------------------- 1 | import { Sandbox } from 'e2b' 2 | 3 | // 1. Start the playground sandbox 4 | const sandbox = await Sandbox.create({ 5 | // You can pass your own sandbox template id 6 | template: 'base', 7 | apiKey: process.env.E2B_API_KEY, 8 | }) 9 | 10 | // 2. Start the shell commdand 11 | let proc = await sandbox.process.start({ 12 | // $HighlightLine 13 | // Print names of all running processes 14 | cmd: 'ps aux | tr -s \' \' | cut -d \' \' -f 11', // $HighlightLine 15 | // Stream stdout and stderr 16 | onStderr: (data) => console.log(data.line), // $HighlightLine 17 | onStdout: (data) => console.log(data.line), // $HighlightLine 18 | }) // $HighlightLine 19 | 20 | // 3. Wait for the process to finish 21 | await proc.wait() 22 | 23 | // 4. Or you can access output after the process has finished 24 | const output = proc.output 25 | 26 | await sandbox.close() 27 | -------------------------------------------------------------------------------- /apps/web/src/code/js/api_key/api_key.js: -------------------------------------------------------------------------------- 1 | import { Sandbox } from 'e2b' 2 | 3 | const sandbox = await Sandbox.create({ apiKey: 'YOUR_API_KEY' }) 4 | await sandbox.close() 5 | -------------------------------------------------------------------------------- /apps/web/src/code/js/basics/download_file.js: -------------------------------------------------------------------------------- 1 | import { Sandbox } from 'e2b' 2 | import fs from 'node:fs' 3 | 4 | const sandbox = await Sandbox.create({ template: 'base' }) 5 | 6 | const buffer = await sandbox.downloadFile('path/to/remote/file/inside/sandbox', 'buffer') // $HighlightLine 7 | // Save file to local filesystem 8 | fs.writeFileSync('path/to/local/file', buffer) 9 | 10 | await sandbox.close() 11 | -------------------------------------------------------------------------------- /apps/web/src/code/js/basics/fs_ls.js: -------------------------------------------------------------------------------- 1 | import { Sandbox } from 'e2b' 2 | 3 | const sandbox = await Sandbox.create({ 4 | template: 'base', 5 | }) 6 | 7 | const dirContent = await sandbox.filesystem.list('/') // $HighlightLine 8 | dirContent.forEach((item) => { 9 | console.log(item.name) 10 | }) 11 | 12 | await sandbox.close() 13 | -------------------------------------------------------------------------------- /apps/web/src/code/js/basics/fs_mkdir.js: -------------------------------------------------------------------------------- 1 | import { Sandbox } from 'e2b' 2 | 3 | const sandbox = await Sandbox.create({ template: 'base' }) 4 | 5 | // Create a new directory '/dir' 6 | await sandbox.filesystem.makeDir('/dir') // $HighlightLine 7 | 8 | await sandbox.close() 9 | -------------------------------------------------------------------------------- /apps/web/src/code/js/basics/fs_read.js: -------------------------------------------------------------------------------- 1 | import { Sandbox } from 'e2b' 2 | 3 | const sandbox = await Sandbox.create({ template: 'base' }) 4 | 5 | const fileContent = await sandbox.filesystem.read('/etc/hosts') // $HighlightLine 6 | console.log(fileContent) 7 | 8 | await sandbox.close() 9 | -------------------------------------------------------------------------------- /apps/web/src/code/js/basics/fs_read_bytes.js: -------------------------------------------------------------------------------- 1 | import fs from 'fs' 2 | import { Sandbox } from 'e2b' 3 | 4 | const sandbox = await Sandbox.create({ template: 'base' }) 5 | 6 | // File bytes will read file's content as bytes 7 | // `fileBytes` as a Uint8Array 8 | const fileBytes = await sandbox.filesystem.readBytes('/etc/hosts') // $HighlightLine 9 | 10 | // The output will look similar to this: 11 | // { 8 | // $HighlightLine 9 | console.log('Filesystem event', event) // $HighlightLine 10 | }) // $HighlightLine 11 | await watcher.start() // $HighlightLine 12 | 13 | // Create files in the /home directory inside the playground 14 | // We'll receive notifications for these events through the watcher we created above. 15 | for (let i = 0; i < 10; i++) { 16 | console.log('Creating file', i) 17 | // `filesystem.write()` will trigger two events: 18 | // 1. 'Create' when the file is created 19 | // 2. 'Write' when the file is written to 20 | await sandbox.filesystem.write(`/home/${i}.txt`, `Hello World ${i}!`) 21 | } 22 | 23 | await sandbox.close() 24 | -------------------------------------------------------------------------------- /apps/web/src/code/js/basics/fs_write.js: -------------------------------------------------------------------------------- 1 | import { Sandbox } from 'e2b' 2 | 3 | const sandbox = await Sandbox.create({ template: 'base' }) 4 | 5 | // `filesystem.write()` will: 6 | // - create the file if it doesn't exist 7 | // - fail if any directory in the path doesn't exist 8 | // - overwrite the file if it exists 9 | 10 | // Write the content of the file '/hello.txt' 11 | await sandbox.filesystem.write('/hello.txt', 'Hello World!') // $HighlightLine 12 | 13 | // The following would fail because '/dir' doesn't exist 14 | // await sandbox.filesystem.write("/dir/hello.txt", "Hello World!") 15 | 16 | await sandbox.close() 17 | -------------------------------------------------------------------------------- /apps/web/src/code/js/basics/fs_write_bytes.js: -------------------------------------------------------------------------------- 1 | import { Sandbox } from 'e2b' 2 | 3 | const sandbox = await Sandbox.create({ template: 'base' }) 4 | 5 | // Let's convert string to bytes for testing purposes 6 | const encoder = new TextEncoder('utf-8') 7 | const contentInBytes = encoder.encode('Hello World!') 8 | 9 | // `writeBytes` accepts a Uint8Array and saves it to a file inside the playground 10 | await sandbox.filesystem.writeBytes('/file', contentInBytes) // $HighlightLine 11 | 12 | // We can read the file back to verify the content 13 | const fileContent = await sandbox.filesystem.read('/file') 14 | 15 | // This will print 'Hello World!' 16 | console.log(fileContent) 17 | 18 | await sandbox.close() 19 | -------------------------------------------------------------------------------- /apps/web/src/code/js/basics/get_url.js: -------------------------------------------------------------------------------- 1 | import { Sandbox } from 'e2b' 2 | 3 | const sandbox = await Sandbox.create({ template: 'base' }) 4 | 5 | const url = sandbox.getHostname() // $HighlightLine 6 | console.log('https://' + url) 7 | 8 | await sandbox.close() 9 | -------------------------------------------------------------------------------- /apps/web/src/code/js/basics/get_url_port.js: -------------------------------------------------------------------------------- 1 | import { Sandbox } from 'e2b' 2 | 3 | const sandbox = await Sandbox.create({ template: 'base' }) 4 | 5 | const openPort = 3000 6 | const url = sandbox.getHostname(openPort) // $HighlightLine 7 | console.log('https://' + url) 8 | 9 | await sandbox.close() 10 | -------------------------------------------------------------------------------- /apps/web/src/code/js/basics/init.js: -------------------------------------------------------------------------------- 1 | import { Sandbox } from 'e2b' 2 | 3 | const sandbox = await Sandbox.create() 4 | 5 | await sandbox.close() 6 | -------------------------------------------------------------------------------- /apps/web/src/code/js/basics/metadata.js: -------------------------------------------------------------------------------- 1 | import { Sandbox } from 'e2b' 2 | 3 | const sandbox = await Sandbox.create({ 4 | template: 'base', 5 | metadata: { userID: 'uniqueID' } // $HighlightLine 6 | }) 7 | // Keep the sandbox alive for 60 seconds 8 | await sandbox.keepAlive(60_000) 9 | // You can even close the script 10 | 11 | // Later, can be even from another process 12 | // List all running sandboxes 13 | const runningSandboxes = await Sandbox.list() 14 | // Find the sandbox by metadata 15 | const found = runningSandboxes.find(s => s.metadata?.userID === 'uniqueID') 16 | if (found) { 17 | // Sandbox found, we can reconnect to it 18 | const sandbox = await Sandbox.reconnect(found.sandboxID) 19 | } else { 20 | // Sandbox not found 21 | } 22 | 23 | await sandbox.close() 24 | -------------------------------------------------------------------------------- /apps/web/src/code/js/basics/process_env_vars.js: -------------------------------------------------------------------------------- 1 | import { Sandbox } from 'e2b' 2 | 3 | const sandbox = await Sandbox.create({ 4 | template: 'base', 5 | envVars: {FOO: 'Hello'}, 6 | }) 7 | 8 | const proc = await sandbox.process.start({ 9 | cmd: 'echo $FOO $BAR!', 10 | envVars: {BAR: 'World'}, // $HighlightLine 11 | }) 12 | await proc.wait() 13 | console.log(proc.output.stdout) 14 | // output: Hello World! 15 | 16 | await sandbox.close() 17 | -------------------------------------------------------------------------------- /apps/web/src/code/js/basics/process_exit.js: -------------------------------------------------------------------------------- 1 | import { Sandbox } from 'e2b' 2 | 3 | const sandbox = await Sandbox.create({ 4 | template: 'base', 5 | onExit: () => console.log('[sandbox]', 'process ended'), // $HighlightLine 6 | }) 7 | 8 | const proc = await sandbox.process.start({cmd: 'echo "Hello World!"'}) 9 | await proc.wait() 10 | // output: [sandbox] process ended 11 | 12 | const procWithCustomHandler = await sandbox.process.start({ 13 | cmd: 'echo "Hello World!"', 14 | onExit: () => console.log('[process]', 'process ended'), // $HighlightLine 15 | }) 16 | await procWithCustomHandler.wait() 17 | // output: [process] process ended 18 | 19 | await sandbox.close() 20 | -------------------------------------------------------------------------------- /apps/web/src/code/js/basics/process_start.js: -------------------------------------------------------------------------------- 1 | import { Sandbox } from 'e2b' 2 | 3 | const sandbox = await Sandbox.create({ template: 'base' }) 4 | 5 | const npmInit = await sandbox.process.start({ 6 | cmd: 'npm init -y', // $HighlightLine 7 | }) 8 | await npmInit.wait() 9 | 10 | console.log(npmInit.output.stdout) 11 | 12 | await sandbox.close() 13 | -------------------------------------------------------------------------------- /apps/web/src/code/js/basics/process_stop.js: -------------------------------------------------------------------------------- 1 | import { Sandbox } from 'e2b' 2 | 3 | const sandbox = await Sandbox.create({ 4 | template: 'base', 5 | }) 6 | 7 | const npmInit = await sandbox.process.start({ 8 | cmd: 'npm init -y', 9 | }) 10 | await npmInit.kill() // $HighlightLine 11 | // There will be no output because we immediately kill the `npm_init` process 12 | console.log(npmInit.output.stdout) 13 | 14 | await sandbox.close() 15 | -------------------------------------------------------------------------------- /apps/web/src/code/js/basics/process_stream_stderr.js: -------------------------------------------------------------------------------- 1 | import { Sandbox } from 'e2b' 2 | 3 | const sandbox = await Sandbox.create({ 4 | template: 'base', 5 | }) 6 | 7 | // This command will fail and output to stderr because Golang isn't installed in the cloud playground 8 | const golangVersion = await sandbox.process.start({ 9 | cmd: 'go version', 10 | onStderr: (output) => console.log('sandbox', output.line), // $HighlightLine 11 | }) 12 | await golangVersion.wait() 13 | // output: [sandbox] /bin/bash: line 1: go: command not found 14 | 15 | const procWithCustomHandler = await sandbox.process.start({ 16 | cmd: 'go version', 17 | onStderr: (data) => console.log('process', data.line), // $HighlightLine 18 | }) 19 | await procWithCustomHandler.wait() 20 | // output: process /bin/bash: line 1: go: command not found 21 | 22 | await sandbox.close() 23 | -------------------------------------------------------------------------------- /apps/web/src/code/js/basics/process_stream_stdout.js: -------------------------------------------------------------------------------- 1 | import { Sandbox } from 'e2b' 2 | 3 | const sandbox = await Sandbox.create({ 4 | template: 'base', 5 | onStdout: (output) => console.log('sandbox', output.line), // $HighlightLine 6 | }) 7 | 8 | const proc = await sandbox.process.start({ 9 | cmd: 'echo "Hello World!"', 10 | }) 11 | await proc.wait() 12 | // output: sandbox Hello World! 13 | 14 | const procWithCustomHandler = await sandbox.process.start({ 15 | cmd: 'echo "Hello World!"', 16 | onStdout: (data) => console.log('process', data.line), // $HighlightLine 17 | }) 18 | await procWithCustomHandler.wait() 19 | // output: process Hello World! 20 | 21 | await sandbox.close() 22 | -------------------------------------------------------------------------------- /apps/web/src/code/js/basics/process_write_stdin.js: -------------------------------------------------------------------------------- 1 | import { Sandbox } from 'e2b' 2 | 3 | const sandbox = await Sandbox.create({ template: 'base' }) 4 | 5 | // This example will print back the string we send to the process using `sendStdin()` 6 | 7 | const proc = await sandbox.process.start({ 8 | cmd: 'while IFS= read -r line; do echo "$line"; sleep 1; done', 9 | onStdout: (output) => console.log(output), 10 | }) 11 | await proc.sendStdin('AI Playground\n') // $HighlightLine 12 | await proc.kill() 13 | 14 | await sandbox.close() 15 | -------------------------------------------------------------------------------- /apps/web/src/code/js/basics/set_env_vars.js: -------------------------------------------------------------------------------- 1 | import { Sandbox } from 'e2b' 2 | 3 | const sandbox = await Sandbox.create({ 4 | template: 'base', 5 | envVars: {FOO: 'Hello'}, // $HighlightLine 6 | }) 7 | 8 | await sandbox.close() 9 | -------------------------------------------------------------------------------- /apps/web/src/code/js/basics/upload_file.js: -------------------------------------------------------------------------------- 1 | import { Sandbox } from 'e2b' 2 | import fs from 'node:fs' 3 | 4 | const sandbox = await Sandbox.create({ template: 'base' }) 5 | 6 | // If you're in the server environment 7 | const filename = 'data.csv' // $HighlightLine 8 | const fileBuffer = fs.readFileSync('path/to/local/file') // $HighlightLine 9 | const remotePath = await sandbox.uploadFile(fileBuffer, filename) // $HighlightLine 10 | 11 | // If you're in the browser environment, you can use the Blob API 12 | // const filename = 'data.csv' 13 | // const CSV = [ 14 | // '"1","val1","val2","val3","val4"', 15 | // '"2","val1","val2","val3","val4"', 16 | // '"3","val1","val2","val3","val4"' 17 | // ].join('\n'); 18 | // const fileBlob = new Blob([csv], { type: 'text/csv' }) 19 | // const remotePath = await sandbox.uploadFile(fileBlob, 'data.csv') 20 | 21 | console.log( 22 | `The file was uploaded to '${remotePath}' path inside the sandbox `, 23 | ) 24 | 25 | await sandbox.close() 26 | -------------------------------------------------------------------------------- /apps/web/src/code/js/cwd/filesystem.js: -------------------------------------------------------------------------------- 1 | import { Sandbox } from 'e2b' 2 | 3 | const sandbox = await Sandbox.create({ 4 | template: 'base', 5 | cwd: '/home/user/code', // $HighlightLine 6 | }) 7 | 8 | await sandbox.filesystem.write('hello.txt', 'Welcome to E2B!') // $HighlightLine 9 | const proc = await sandbox.process.start({ 10 | cmd: 'cat /home/user/code/hello.txt', 11 | }) 12 | await proc.wait() 13 | console.log(proc.output.stdout) 14 | // output: "Welcome to E2B!" 15 | 16 | await sandbox.filesystem.write('../hello.txt', 'We hope you have a great day!') // $HighlightLine 17 | const proc2 = await sandbox.process.start({cmd: 'cat /home/user/hello.txt'}) 18 | await proc2.wait() 19 | console.log(proc2.output.stdout) 20 | // output: "We hope you have a great day!" 21 | 22 | await sandbox.close() 23 | -------------------------------------------------------------------------------- /apps/web/src/code/js/cwd/process.js: -------------------------------------------------------------------------------- 1 | import { Sandbox } from 'e2b' 2 | 3 | const sandbox = await Sandbox.create({ 4 | template: 'base', 5 | cwd: '/code', // $HighlightLine 6 | }) 7 | 8 | const sandboxCwd = await sandbox.process.start({cmd: 'pwd'}) // $HighlightLine 9 | await sandboxCwd.wait() 10 | console.log(sandboxCwd.output.stdout) 11 | // output: /code 12 | 13 | const processCwd = await sandbox.process.start({cmd: 'pwd', cwd: '/home'}) // $HighlightLine 14 | await processCwd.wait() 15 | console.log(processCwd.output.stdout) 16 | // output: /home 17 | 18 | await sandbox.close() 19 | -------------------------------------------------------------------------------- /apps/web/src/code/js/cwd/sandbox.js: -------------------------------------------------------------------------------- 1 | import { Sandbox } from 'e2b' 2 | 3 | const sandbox = await Sandbox.create({ 4 | template: 'base', 5 | cwd: '/code', // $HighlightLine 6 | }) 7 | 8 | // You can also change the cwd of an existing sandbox 9 | sandbox.cwd = '/home' // $HighlightLine 10 | 11 | await sandbox.close() 12 | -------------------------------------------------------------------------------- /apps/web/src/code/js/index.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/e2b-dev/E2B/27e292eedcf04b52b88f5729079c2eb02ae0bc9f/apps/web/src/code/js/index.js -------------------------------------------------------------------------------- /apps/web/src/code/js/logging/e2b_logging.js: -------------------------------------------------------------------------------- 1 | import { Sandbox } from 'e2b' 2 | 3 | const logger = { 4 | debug: console.debug, // log debug messages, in default logger this is noop 5 | info: console.info, // log info messages, in default logger this is noop 6 | // don't forget to also specify warn & error handlers, otherwise they won't be logged when overriding the logger 7 | warn: console.warn, 8 | error: console.error, 9 | } 10 | 11 | const sandbox = await Sandbox.create({ 12 | template: 'base', 13 | apiKey: process.env.E2B_API_KEY, 14 | logger, // $HighlightLine 15 | }) 16 | -------------------------------------------------------------------------------- /apps/web/src/code/js/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "js", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "type": "module", 7 | "scripts": { 8 | "all": "node index.js", 9 | "test": "echo \"Error: no test specified\" && exit 1" 10 | }, 11 | "keywords": [], 12 | "author": "", 13 | "license": "ISC", 14 | "dependencies": { 15 | "e2b": "^0.3.0" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /apps/web/src/code/js/quickstart.js: -------------------------------------------------------------------------------- 1 | import { Sandbox } from 'e2b' 2 | 3 | // 1. Start cloud playground 4 | const sandbox = await Sandbox.create({ 5 | // $HighlightLine 6 | template: 'base', // or you can pass your own sandbox template id 7 | apiKey: process.env.E2B_API_KEY, 8 | }) 9 | 10 | // 2. Use filesystem 11 | sandbox.filesystem // $HighlightLine 12 | 13 | // 3. Start processes 14 | sandbox.process.start() // $HighlightLine 15 | 16 | // 4. Upload/download files 17 | sandbox.read_bytes() // $HighlightLine 18 | sandbox.write_bytes() // $HighlightLine 19 | 20 | await sandbox.close() 21 | -------------------------------------------------------------------------------- /apps/web/src/code/js/reconnect/reconnect.js: -------------------------------------------------------------------------------- 1 | import { Sandbox } from 'e2b' 2 | 3 | async function wait(ms) { 4 | return new Promise(resolve => setTimeout(resolve, ms)) 5 | } 6 | 7 | const sandbox = await Sandbox.create({ template: 'base' }) 8 | 9 | // Do something in the sandbox 10 | await sandbox.filesystem.write('hello.txt', 'Hello World!') 11 | 12 | // Get the sandbox ID, we'll need it later 13 | const sandboxID = sandbox.id 14 | 15 | // Keep alive the sandbox for 2 minutes 16 | await sandbox.keepAlive(2 * 60 * 1000) // 2 * minutes $HighlightLine 17 | 18 | // Close the sandbox 19 | await sandbox.close() 20 | 21 | // Do something else... 22 | await wait(60 * 1000) 23 | 24 | // Reconnect to the sandbox 25 | const sandbox2 = await Sandbox.reconnect(sandboxID) // $HighlightLine 26 | 27 | // Continue in using the sandbox 28 | const content = await sandbox2.filesystem.read('hello.txt') 29 | console.log(content) 30 | 31 | // Close the sandbox 32 | await sandbox2.close() 33 | -------------------------------------------------------------------------------- /apps/web/src/code/js/reconnect/reconnect_1.js: -------------------------------------------------------------------------------- 1 | import { Sandbox } from 'e2b' 2 | 3 | async function wait(ms) { 4 | return new Promise(resolve => setTimeout(resolve, ms)) 5 | } 6 | 7 | const sandbox = await Sandbox.create({ template: 'base' }) -------------------------------------------------------------------------------- /apps/web/src/code/js/reconnect/reconnect_2.js: -------------------------------------------------------------------------------- 1 | // Do something in the sandbox 2 | await sandbox.filesystem.write('hello.txt', 'Hello World!') 3 | 4 | // Get the sandbox ID, we'll need it later 5 | const sandboxID = sandbox.id 6 | 7 | // Keep alive the sandbox for 2 minutes 8 | await sandbox.keepAlive(2 * 60 * 1000) // 2 minutes $HighlightLine 9 | 10 | // Close the sandbox. Even if we close the sandbox, it will stay alive, because we explicitly called keepAlive(). 11 | await sandbox.close() 12 | 13 | // Do something else... 14 | await wait(60 * 1000) -------------------------------------------------------------------------------- /apps/web/src/code/js/reconnect/reconnect_3.js: -------------------------------------------------------------------------------- 1 | // Reconnect to the sandbox 2 | const sandbox2 = await Sandbox.reconnect(sandboxID) // $HighlightLine 3 | 4 | // Continue in using the sandbox 5 | const content = await sandbox2.filesystem.read('hello.txt') 6 | console.log(content) 7 | 8 | // Close the sandbox 9 | await sandbox2.close() 10 | -------------------------------------------------------------------------------- /apps/web/src/code/js/run_all.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable unused-imports/no-unused-imports,@typescript-eslint/no-unused-vars */ 2 | 3 | console.log('Done') 4 | -------------------------------------------------------------------------------- /apps/web/src/code/js/timeout/timeout_filesystem.js: -------------------------------------------------------------------------------- 1 | import { Sandbox } from 'e2b' 2 | 3 | const sandbox = await Sandbox.create({ template: 'base' }) 4 | 5 | // Timeout 3s for the write operation 6 | await sandbox.filesystem.write('hello.txt', 'Hello World!', {timeout: 3000}) // $HighlightLine 7 | 8 | // Timeout 3s for the list operation 9 | const files = await sandbox.filesystem.list('.', {timeout: 3000}) // $HighlightLine 10 | console.log(files) 11 | 12 | // Timeout 3s for the read operation 13 | const content = await sandbox.filesystem.read('hello.txt', {timeout: 3000}) // $HighlightLine 14 | console.log(content) 15 | 16 | await sandbox.close() 17 | -------------------------------------------------------------------------------- /apps/web/src/code/js/timeout/timeout_process.js: -------------------------------------------------------------------------------- 1 | import { Sandbox } from 'e2b' 2 | 3 | const sandbox = await Sandbox.create({ template: 'base' }) 4 | 5 | // Timeout 3s for the process to start 6 | const npmInit = await sandbox.process.start({ 7 | cmd: 'npm init -y', 8 | timeout: 3000, // $HighlightLine 9 | }) 10 | await npmInit.wait() 11 | 12 | await sandbox.close() 13 | -------------------------------------------------------------------------------- /apps/web/src/code/js/timeout/timeout_sandbox.js: -------------------------------------------------------------------------------- 1 | import { Sandbox } from 'e2b' 2 | 3 | // Timeout 3s for the sandbox to open 4 | const sandbox = await Sandbox.create({ 5 | template: 'base', 6 | timeout: 3000, // $HighlightLine 7 | }) 8 | 9 | await sandbox.close() 10 | -------------------------------------------------------------------------------- /apps/web/src/code/python/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/e2b-dev/E2B/27e292eedcf04b52b88f5729079c2eb02ae0bc9f/apps/web/src/code/python/README.md -------------------------------------------------------------------------------- /apps/web/src/code/python/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/e2b-dev/E2B/27e292eedcf04b52b88f5729079c2eb02ae0bc9f/apps/web/src/code/python/__init__.py -------------------------------------------------------------------------------- /apps/web/src/code/python/_run_all.py: -------------------------------------------------------------------------------- 1 | print("Done") 2 | -------------------------------------------------------------------------------- /apps/web/src/code/python/agents/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/e2b-dev/E2B/27e292eedcf04b52b88f5729079c2eb02ae0bc9f/apps/web/src/code/python/agents/__init__.py -------------------------------------------------------------------------------- /apps/web/src/code/python/agents/start_process.py: -------------------------------------------------------------------------------- 1 | from os import getenv 2 | 3 | from e2b import Sandbox 4 | 5 | E2B_API_KEY = getenv("E2B_API_KEY") 6 | 7 | 8 | def print_out(output): 9 | print(output.line) 10 | 11 | 12 | def main(): 13 | # 1. Start the playground sandbox 14 | sandbox = Sandbox( 15 | # Select the right runtime 16 | template="base", 17 | api_key=E2B_API_KEY, 18 | ) 19 | 20 | # 2. Start the shell commdand 21 | proc = sandbox.process.start( # $HighlightLine 22 | # Print names of all running processes 23 | cmd="ps aux | tr -s ' ' | cut -d ' ' -f 11", # $HighlightLine 24 | on_stdout=print_out, # $HighlightLine 25 | on_stderr=print_out, # $HighlightLine 26 | ) # $HighlightLine 27 | 28 | # 3. Wait for the process to finish 29 | proc.wait() 30 | 31 | # 4. Or you can access output after the process has finished 32 | output = proc.output 33 | 34 | sandbox.close() 35 | 36 | 37 | main() 38 | -------------------------------------------------------------------------------- /apps/web/src/code/python/api_key/api_key.py: -------------------------------------------------------------------------------- 1 | from e2b import Sandbox 2 | 3 | sandbox = Sandbox(api_key="YOUR_API_KEY") 4 | sandbox.close() 5 | -------------------------------------------------------------------------------- /apps/web/src/code/python/basics/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/e2b-dev/E2B/27e292eedcf04b52b88f5729079c2eb02ae0bc9f/apps/web/src/code/python/basics/__init__.py -------------------------------------------------------------------------------- /apps/web/src/code/python/basics/download_file.py: -------------------------------------------------------------------------------- 1 | from e2b import Sandbox 2 | 3 | sandbox = Sandbox(template="base") 4 | 5 | file_in_bytes = sandbox.download_file("path/to/remote/file/inside/sandbox") # $HighlightLine 6 | # Save file to local filesystem 7 | with open("path/to/local/file", "wb") as f: # $HighlightLine 8 | f.write(file_in_bytes) # $HighlightLine 9 | 10 | sandbox.close() 11 | -------------------------------------------------------------------------------- /apps/web/src/code/python/basics/fs_ls.py: -------------------------------------------------------------------------------- 1 | from e2b import Sandbox 2 | 3 | sandbox = Sandbox(template="base") 4 | 5 | # List the root directory 6 | content = sandbox.filesystem.list("/") # $HighlightLine 7 | for item in content: 8 | print(f"Is '{item.name}' directory?", item.is_dir) 9 | 10 | sandbox.close() 11 | -------------------------------------------------------------------------------- /apps/web/src/code/python/basics/fs_mkdir.py: -------------------------------------------------------------------------------- 1 | from e2b import Sandbox 2 | 3 | sandbox = Sandbox(template="base") 4 | 5 | # Create a new directory '/dir' 6 | sandbox.filesystem.make_dir("/dir") # $HighlightLine 7 | 8 | sandbox.close() 9 | -------------------------------------------------------------------------------- /apps/web/src/code/python/basics/fs_read.py: -------------------------------------------------------------------------------- 1 | from e2b import Sandbox 2 | 3 | sandbox = Sandbox(template="base") 4 | 5 | # Read the '/etc/hosts' file 6 | file_content = sandbox.filesystem.read("/etc/hosts") # $HighlightLine 7 | 8 | # Prints something like: 9 | # 127.0.0.1 localhost 10 | print(file_content) 11 | 12 | sandbox.close() 13 | -------------------------------------------------------------------------------- /apps/web/src/code/python/basics/fs_read_bytes.py: -------------------------------------------------------------------------------- 1 | from e2b import Sandbox 2 | 3 | sandbox = Sandbox(template="base") 4 | 5 | # File bytes will read file's content as bytes 6 | # `file_bytes` as a bytearray 7 | file_bytes = sandbox.filesystem.read_bytes("/etc/hosts") # $HighlightLine 8 | 9 | # The output will look similar to this: 10 | # b'127.0.0.1\tlocalhost\n::1\tlocalhost ip6-localhost ip6-loopback\nfe00::0\tip6-localnet\nff00::0\tip6-mcastprefix\nff02::1\tip6-allnodes\nff02::2\tip6-allrouters\n172.17.0.17\t77c7a543226b\n' 11 | print(file_bytes) 12 | 13 | # We can save those bytes to a file locally like this: 14 | with open("./hosts.txt", "wb") as f: 15 | f.write(file_bytes) 16 | 17 | sandbox.close() 18 | -------------------------------------------------------------------------------- /apps/web/src/code/python/basics/fs_watch.py: -------------------------------------------------------------------------------- 1 | import time 2 | 3 | from e2b import Sandbox 4 | 5 | sandbox = Sandbox() 6 | 7 | watcher = sandbox.files.watch_dir("/home") # $HighlightLine 8 | 9 | # Create files in the /home directory inside the playground 10 | # We'll receive notifications for these events through the watcher we created above. 11 | for i in range(10): 12 | # `filesystem.write()` will trigger two events: 13 | # 1. 'Create' when the file is created 14 | # 2. 'Write' when the file is written to 15 | sandbox.files.write(f"/home/file{i}.txt", f"Hello World {i}!") 16 | time.sleep(1) 17 | 18 | for event in watcher.get(): 19 | print(f"Event: {event.type} {event.name}") # $HighlightLine 20 | 21 | watcher.stop() 22 | sandbox.kill() 23 | -------------------------------------------------------------------------------- /apps/web/src/code/python/basics/fs_write.py: -------------------------------------------------------------------------------- 1 | from e2b import Sandbox 2 | 3 | sandbox = Sandbox(template="base") 4 | 5 | # `filesystem.write()` will: 6 | # - create the file if it doesn't exist 7 | # - fail if any directory in the path doesn't exist 8 | # - overwrite the file if it exists 9 | 10 | # Write the content of the file '/hello.txt' 11 | sandbox.filesystem.write("/hello.txt", "Hello World!") # $HighlightLine 12 | 13 | # The following would fail because '/dir' doesn't exist 14 | # sandbox.filesystem.write("/dir/hello.txt", "Hello World!") 15 | 16 | sandbox.close() 17 | -------------------------------------------------------------------------------- /apps/web/src/code/python/basics/fs_write_bytes.py: -------------------------------------------------------------------------------- 1 | from e2b import Sandbox 2 | 3 | sandbox = Sandbox(template="base") 4 | 5 | content_in_bytes = bytearray(b"Hello world") 6 | 7 | # `write_bytes` will write bytearray to a file inside the playground. 8 | sandbox.filesystem.write_bytes("/file", content_in_bytes) # $HighlightLine 9 | 10 | # We can read the file back to verify the content 11 | file_content = sandbox.filesystem.read("/file") 12 | print(file_content) 13 | 14 | sandbox.close() 15 | -------------------------------------------------------------------------------- /apps/web/src/code/python/basics/get_url.py: -------------------------------------------------------------------------------- 1 | from e2b import Sandbox 2 | 3 | sandbox = Sandbox(template="base") 4 | 5 | url = sandbox.get_host() # $HighlightLine 6 | print("https://" + url) 7 | 8 | sandbox.close() 9 | -------------------------------------------------------------------------------- /apps/web/src/code/python/basics/get_url_port.py: -------------------------------------------------------------------------------- 1 | from e2b import Sandbox 2 | 3 | sandbox = Sandbox(template="base") 4 | 5 | open_port = 3000 6 | url = sandbox.get_host(open_port) # $HighlightLine 7 | print("https://" + url) 8 | 9 | sandbox.close() 10 | -------------------------------------------------------------------------------- /apps/web/src/code/python/basics/init.py: -------------------------------------------------------------------------------- 1 | from e2b import Sandbox 2 | 3 | sandbox = Sandbox() 4 | sandbox.close() 5 | -------------------------------------------------------------------------------- /apps/web/src/code/python/basics/metadata.py: -------------------------------------------------------------------------------- 1 | from e2b import Sandbox 2 | 3 | sandbox = Sandbox( 4 | template='base', 5 | metadata={"user_id": "uniqueID"}, # $HighlightLine 6 | ) 7 | 8 | # Keep the sandbox alive for 60 seconds 9 | sandbox.keep_alive(60) 10 | # You can even close the script 11 | 12 | # Later, can be even from another process 13 | # List all running sandboxes 14 | running_sandboxes = Sandbox.list() 15 | 16 | # Find the sandbox by metadata 17 | for running_sandbox in running_sandboxes: 18 | if running_sandbox.metadata.get("user_id", "") == 'uniqueID': 19 | sandbox = Sandbox.reconnect(running_sandbox.sandbox_id) 20 | break 21 | else: 22 | # Sandbox not found 23 | pass 24 | 25 | sandbox.close() 26 | -------------------------------------------------------------------------------- /apps/web/src/code/python/basics/process_env_vars.py: -------------------------------------------------------------------------------- 1 | from e2b import Sandbox 2 | 3 | sandbox = Sandbox( 4 | template="base", 5 | env_vars={"FOO": "Hello"} 6 | ) 7 | 8 | proc = sandbox.process.start( 9 | "echo $FOO $BAR!", 10 | env_vars={"BAR": "World"}, # $HighlightLine 11 | ) 12 | proc.wait() 13 | 14 | print(proc.output.stdout) 15 | # output: Hello World! 16 | 17 | sandbox.close() 18 | -------------------------------------------------------------------------------- /apps/web/src/code/python/basics/process_exit.py: -------------------------------------------------------------------------------- 1 | from e2b import Sandbox 2 | 3 | sandbox = Sandbox( 4 | template="base", 5 | on_exit=lambda: print("[sandbox]", "process ended"), # $HighlightLine 6 | ) 7 | 8 | proc = sandbox.process.start('echo "Hello World!"') 9 | proc.wait() 10 | # output: [sandbox] process ended 11 | 12 | proc_with_custom_handler = sandbox.process.start( 13 | 'echo "Hello World!"', 14 | on_exit=lambda: print("[process]", "process ended"), # $HighlightLine 15 | ) 16 | proc_with_custom_handler.wait() 17 | # output: [process] process ended 18 | 19 | sandbox.close() 20 | -------------------------------------------------------------------------------- /apps/web/src/code/python/basics/process_start.py: -------------------------------------------------------------------------------- 1 | from e2b import Sandbox 2 | 3 | sandbox = Sandbox(template="base") 4 | 5 | npm_init = sandbox.process.start("npm init -y") # $HighlightLine 6 | npm_init.wait() 7 | print(npm_init.stdout) 8 | 9 | sandbox.close() 10 | -------------------------------------------------------------------------------- /apps/web/src/code/python/basics/process_stop.py: -------------------------------------------------------------------------------- 1 | from e2b import Sandbox 2 | 3 | sandbox = Sandbox(template="base") 4 | 5 | npm_init = sandbox.process.start("npm init -y") 6 | npm_init.kill() # $HighlightLine 7 | 8 | # There will be no output because we immediately kill the `npm_init` process 9 | print(npm_init.stdout) 10 | 11 | sandbox.close() 12 | -------------------------------------------------------------------------------- /apps/web/src/code/python/basics/process_stream_stderr.py: -------------------------------------------------------------------------------- 1 | from e2b import Sandbox 2 | 3 | sandbox = Sandbox( 4 | template="base", 5 | on_stderr=lambda output: print("[sandbox]", output.line), # $HighlightLine 6 | ) 7 | 8 | # This command will fail and output to stderr because Golang isn't installed in the cloud playground 9 | proc = sandbox.process.start("go version") 10 | proc.wait() 11 | # output: [sandbox] /bin/bash: line 1: go: command not found 12 | 13 | proc_with_custom_handler = sandbox.process.start( 14 | "go version", 15 | on_stderr=lambda output: print("[process]", output.line), # $HighlightLine 16 | ) 17 | proc_with_custom_handler.wait() 18 | # output: [process] /bin/bash: line 1: go: command not found 19 | 20 | sandbox.close() 21 | -------------------------------------------------------------------------------- /apps/web/src/code/python/basics/process_stream_stdout.py: -------------------------------------------------------------------------------- 1 | from e2b import Sandbox 2 | 3 | sandbox = Sandbox( 4 | template="base", 5 | on_stdout=lambda output: print("sandbox", output.line), # $HighlightLine 6 | ) 7 | 8 | proc = sandbox.process.start('echo "Hello World!"') 9 | proc.wait() 10 | # output: sandbox Hello World! 11 | 12 | proc_with_custom_handler = sandbox.process.start( 13 | 'echo "Hello World!"', 14 | on_stdout=lambda output: print("process", output.line), # $HighlightLine 15 | ) 16 | proc_with_custom_handler.wait() 17 | # output: process Hello World! 18 | 19 | sandbox.close() 20 | -------------------------------------------------------------------------------- /apps/web/src/code/python/basics/process_write_stdin.py: -------------------------------------------------------------------------------- 1 | from e2b import Sandbox 2 | 3 | sandbox = Sandbox(template="base") 4 | 5 | # This example will print back the string we send to the process using `send_stdin()` 6 | 7 | proc = sandbox.process.start( 8 | 'while IFS= read -r line; do echo "$line"; sleep 1; done', 9 | on_stdout=print, 10 | ) 11 | proc.send_stdin("AI Playground\n") # $HighlightLine 12 | proc.kill() 13 | 14 | sandbox.close() 15 | -------------------------------------------------------------------------------- /apps/web/src/code/python/basics/set_env_vars.py: -------------------------------------------------------------------------------- 1 | from e2b import Sandbox 2 | 3 | sandbox = Sandbox( 4 | template="base", 5 | env_vars={"FOO": "Hello"}, # $HighlightLine 6 | ) 7 | 8 | sandbox.close() 9 | -------------------------------------------------------------------------------- /apps/web/src/code/python/basics/upload_file.py: -------------------------------------------------------------------------------- 1 | from e2b import Sandbox 2 | 3 | sandbox = Sandbox(template="base") 4 | 5 | with open("path/to/local/file", "rb") as f: 6 | remote_path = sandbox.upload_file(f) # $HighlightLine 7 | 8 | sandbox.close() 9 | -------------------------------------------------------------------------------- /apps/web/src/code/python/cwd/filesystem.py: -------------------------------------------------------------------------------- 1 | from e2b import Sandbox 2 | 3 | sandbox = Sandbox( 4 | template="base", 5 | cwd="/home/user/code" # $HighlightLine 6 | ) 7 | sandbox.filesystem.write("hello.txt", "Welcome to E2B!") # $HighlightLine 8 | proc = sandbox.process.start("cat /home/user/code/hello.txt") 9 | proc.wait() 10 | print(proc.output.stdout) 11 | # output: "Welcome to E2B!" 12 | 13 | sandbox.filesystem.write("../hello.txt", "We hope you have a great day!") # $HighlightLine 14 | proc2 = sandbox.process.start("cat /home/user/hello.txt") 15 | proc2.wait() 16 | print(proc2.output.stdout) 17 | # output: "We hope you have a great day!" 18 | 19 | sandbox.close() 20 | -------------------------------------------------------------------------------- /apps/web/src/code/python/cwd/process.py: -------------------------------------------------------------------------------- 1 | from e2b import Sandbox 2 | 3 | sandbox = Sandbox(template="base", cwd="/code") # $HighlightLine 4 | sandbox_cwd = sandbox.process.start("pwd") # $HighlightLine 5 | sandbox_cwd.wait() 6 | print(sandbox_cwd.output.stdout) 7 | # output: "/code" 8 | 9 | process_cwd = sandbox.process.start("pwd", cwd="/home") # $HighlightLine 10 | process_cwd.wait() 11 | print(process_cwd.output.stdout) 12 | # output: "/home" 13 | 14 | sandbox.close() 15 | -------------------------------------------------------------------------------- /apps/web/src/code/python/cwd/sandbox.py: -------------------------------------------------------------------------------- 1 | from e2b import Sandbox 2 | 3 | sandbox = Sandbox( 4 | template="base", 5 | cwd="/code", # $HighlightLine 6 | ) 7 | 8 | # You can also change the cwd of an existing sandbox 9 | sandbox.cwd = "/home" # $HighlightLine 10 | 11 | sandbox.close() 12 | -------------------------------------------------------------------------------- /apps/web/src/code/python/pyproject.toml: -------------------------------------------------------------------------------- 1 | [tool.poetry] 2 | name = "python-snippets" 3 | version = "0.1.0" 4 | description = "" 5 | authors = ["Vasek Mlejnsky "] 6 | readme = "README.md" 7 | 8 | [tool.poetry.dependencies] 9 | python = "^3.8" 10 | e2b = "^0.9.3" 11 | 12 | 13 | [build-system] 14 | requires = ["poetry-core"] 15 | build-backend = "poetry.core.masonry.api" 16 | -------------------------------------------------------------------------------- /apps/web/src/code/python/quickstart.py: -------------------------------------------------------------------------------- 1 | from e2b import Sandbox 2 | 3 | # 1. Start cloud playground 4 | sandbox = Sandbox() # $HighlightLine 5 | 6 | # 2. Use filesystem 7 | sandbox.filesystem # $HighlightLine 8 | 9 | # 3. Start processes 10 | sandbox.process.start() # $HighlightLine 11 | 12 | # 4. Upload/download files 13 | sandbox.read_bytes() # $HighlightLine 14 | sandbox.write_bytes() # $HighlightLine 15 | 16 | sandbox.close() 17 | -------------------------------------------------------------------------------- /apps/web/src/code/python/reconnect/reconnect.py: -------------------------------------------------------------------------------- 1 | import time 2 | from e2b import Sandbox 3 | 4 | 5 | sandbox = Sandbox('base') 6 | 7 | # Do something in the sandbox 8 | sandbox.filesystem.write('hello.txt', 'Hello World!') 9 | 10 | # Get the sandbox ID, we'll need it later 11 | sandboxID = sandbox.id 12 | 13 | # Keep alive the sandbox for 2 minutes 14 | sandbox.keep_alive(2 * 60) # $HighlightLine 15 | 16 | # Close the sandbox 17 | sandbox.close() 18 | 19 | # Do something else... 20 | time.sleep(60) 21 | 22 | # Reconnect to the sandbox 23 | sandbox2 = Sandbox.reconnect(sandboxID) # $HighlightLine 24 | 25 | # Continue in using the sandbox 26 | content = sandbox2.filesystem.read('hello.txt') 27 | print(content) 28 | 29 | # Close the sandbox 30 | sandbox2.close() 31 | -------------------------------------------------------------------------------- /apps/web/src/code/python/reconnect/reconnect_1.py: -------------------------------------------------------------------------------- 1 | import time 2 | from e2b import Sandbox 3 | 4 | 5 | sandbox = Sandbox('base') -------------------------------------------------------------------------------- /apps/web/src/code/python/reconnect/reconnect_2.py: -------------------------------------------------------------------------------- 1 | # Do something in the sandbox 2 | sandbox.filesystem.write('hello.txt', 'Hello World!') 3 | 4 | # Get the sandbox ID, we'll need it later 5 | sandboxID = sandbox.id 6 | 7 | # Keep the sandbox alive for 2 minutes 8 | sandbox.keep_alive(60 * 2) # $HighlightLine 9 | 10 | # Close the sandbox. Even if we close the sandbox, it will stay alive, because we explicitly called keep_alive(). 11 | sandbox.close() 12 | 13 | # Do something else... 14 | time.sleep(60) 15 | -------------------------------------------------------------------------------- /apps/web/src/code/python/reconnect/reconnect_3.py: -------------------------------------------------------------------------------- 1 | # Reconnect to the sandbox 2 | sandbox2 = Sandbox.reconnect(sandboxID) # $HighlightLine 3 | 4 | # Continue in using the sandbox 5 | content = sandbox2.filesystem.read('hello.txt') 6 | print(content) 7 | 8 | # Close the sandbox 9 | sandbox2.close() 10 | -------------------------------------------------------------------------------- /apps/web/src/code/python/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/e2b-dev/E2B/27e292eedcf04b52b88f5729079c2eb02ae0bc9f/apps/web/src/code/python/tests/__init__.py -------------------------------------------------------------------------------- /apps/web/src/code/python/timeout/timeout_filesystem.py: -------------------------------------------------------------------------------- 1 | from e2b import Sandbox 2 | 3 | sandbox = Sandbox(template="base") 4 | 5 | # Timeout 3s for the write operation 6 | sandbox.filesystem.write("test.txt", "Hello World", timeout=3) # $HighlightLine 7 | 8 | # Timeout 3s for the list operation 9 | dir_content = sandbox.filesystem.list(".", timeout=3) # $HighlightLine 10 | print(dir_content) 11 | 12 | # Timeout 3s for the read operation 13 | file_content = sandbox.filesystem.read("test.txt", timeout=3) # $HighlightLine 14 | print(file_content) 15 | 16 | sandbox.close() 17 | -------------------------------------------------------------------------------- /apps/web/src/code/python/timeout/timeout_process.py: -------------------------------------------------------------------------------- 1 | from e2b import Sandbox 2 | 3 | sandbox = Sandbox(template="base") 4 | 5 | # Timeout 3s for the process to start 6 | npm_init = sandbox.process.start("npm init -y", timeout=3) # $HighlightLine 7 | npm_init.wait() 8 | 9 | sandbox.close() 10 | -------------------------------------------------------------------------------- /apps/web/src/code/python/timeout/timeout_sandbox.py: -------------------------------------------------------------------------------- 1 | from e2b import Sandbox 2 | 3 | # Timeout 3s for the sandbox to open 4 | sandbox = Sandbox(template="base", timeout=3) # $HighlightLine 5 | 6 | sandbox.close() 7 | -------------------------------------------------------------------------------- /apps/web/src/components/HeaderUtils.tsx: -------------------------------------------------------------------------------- 1 | export function HeaderSeparator() { 2 | return ( 3 |
4 | ) 5 | } 6 | -------------------------------------------------------------------------------- /apps/web/src/components/LegacyBanner.tsx: -------------------------------------------------------------------------------- 1 | 'use client' 2 | 3 | import { AlertCircle } from 'lucide-react' 4 | import { usePathname } from 'next/navigation' 5 | 6 | export default function LegacyBanner() { 7 | const pathname = usePathname() 8 | 9 | const isLegacy = pathname?.startsWith('/docs/legacy') 10 | 11 | if (!isLegacy) return null 12 | 13 | return ( 14 | <> 15 |
16 |
17 | 18 | 19 | You are reading a{' '} 20 | legacy (pre v1.0){' '} 21 | document. 22 | 23 |
24 |
25 |
26 | 27 | ) 28 | } 29 | -------------------------------------------------------------------------------- /apps/web/src/components/Navigation/apiRefRoutes.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "title": "References", 4 | "links": [ 5 | { 6 | "title": "CLI", 7 | "href": "/docs/api-reference/cli" 8 | }, 9 | { 10 | "title": "JS-SDK", 11 | "href": "/docs/api-reference/js-sdk" 12 | }, 13 | { 14 | "title": "PYTHON-SDK", 15 | "href": "/docs/api-reference/python-sdk" 16 | } 17 | ] 18 | } 19 | ] -------------------------------------------------------------------------------- /apps/web/src/components/Prose.tsx: -------------------------------------------------------------------------------- 1 | import clsx from 'clsx' 2 | 3 | export function Prose({ 4 | as, 5 | className, 6 | ...props 7 | }: Omit, 'as' | 'className'> & { 8 | as?: T 9 | className?: string 10 | }) { 11 | const Component = as ?? 'div' 12 | 13 | return ( 14 | 18 | ) 19 | } 20 | -------------------------------------------------------------------------------- /apps/web/src/components/Spinner.tsx: -------------------------------------------------------------------------------- 1 | import { Loader2 as Loader } from 'lucide-react' 2 | 3 | function Spinner({ className = '', size = '16px'}) { 4 | return ( 5 | 9 | ) 10 | } 11 | 12 | export default Spinner 13 | -------------------------------------------------------------------------------- /apps/web/src/components/Tag.tsx: -------------------------------------------------------------------------------- 1 | import clsx from 'clsx' 2 | import React from 'react' 3 | 4 | export function Tag({ 5 | children, 6 | }: { 7 | children: React.ReactNode 8 | }) { 9 | return ( 10 | 16 | {children} 17 | 18 | ) 19 | } -------------------------------------------------------------------------------- /apps/web/src/components/icons/BellIcon.tsx: -------------------------------------------------------------------------------- 1 | export function BellIcon(props: React.ComponentPropsWithoutRef<'svg'>) { 2 | return ( 3 | 20 | ) 21 | } 22 | -------------------------------------------------------------------------------- /apps/web/src/components/icons/BoltIcon.tsx: -------------------------------------------------------------------------------- 1 | export function BoltIcon(props: React.ComponentPropsWithoutRef<'svg'>) { 2 | return ( 3 | 14 | ) 15 | } 16 | -------------------------------------------------------------------------------- /apps/web/src/components/icons/BookIcon.tsx: -------------------------------------------------------------------------------- 1 | export function BookIcon(props: React.ComponentPropsWithoutRef<'svg'>) { 2 | return ( 3 | 20 | ) 21 | } 22 | -------------------------------------------------------------------------------- /apps/web/src/components/icons/CalendarIcon.tsx: -------------------------------------------------------------------------------- 1 | export function CalendarIcon(props: React.ComponentPropsWithoutRef<'svg'>) { 2 | return ( 3 | 26 | ) 27 | } 28 | -------------------------------------------------------------------------------- /apps/web/src/components/icons/CartIcon.tsx: -------------------------------------------------------------------------------- 1 | export function CartIcon(props: React.ComponentPropsWithoutRef<'svg'>) { 2 | return ( 3 | 18 | ) 19 | } 20 | -------------------------------------------------------------------------------- /apps/web/src/components/icons/ChatBubbleIcon.tsx: -------------------------------------------------------------------------------- 1 | export function ChatBubbleIcon(props: React.ComponentPropsWithoutRef<'svg'>) { 2 | return ( 3 | 20 | ) 21 | } 22 | -------------------------------------------------------------------------------- /apps/web/src/components/icons/CheckIcon.tsx: -------------------------------------------------------------------------------- 1 | export function CheckIcon(props: React.ComponentPropsWithoutRef<'svg'>) { 2 | return ( 3 | 20 | ) 21 | } 22 | -------------------------------------------------------------------------------- /apps/web/src/components/icons/ChevronRightLeftIcon.tsx: -------------------------------------------------------------------------------- 1 | export function ChevronRightLeftIcon(props: React.ComponentPropsWithoutRef<'svg'>) { 2 | return ( 3 | 20 | ) 21 | } 22 | -------------------------------------------------------------------------------- /apps/web/src/components/icons/ClipboardIcon.tsx: -------------------------------------------------------------------------------- 1 | export function ClipboardIcon(props: React.ComponentPropsWithoutRef<'svg'>) { 2 | return ( 3 | 20 | ) 21 | } 22 | -------------------------------------------------------------------------------- /apps/web/src/components/icons/CopyIcon.tsx: -------------------------------------------------------------------------------- 1 | export function CopyIcon(props: React.ComponentPropsWithoutRef<'svg'>) { 2 | return ( 3 | 20 | ) 21 | } 22 | -------------------------------------------------------------------------------- /apps/web/src/components/icons/DocumentIcon.tsx: -------------------------------------------------------------------------------- 1 | export function DocumentIcon(props: React.ComponentPropsWithoutRef<'svg'>) { 2 | return ( 3 | 20 | ) 21 | } 22 | -------------------------------------------------------------------------------- /apps/web/src/components/icons/EnvelopeIcon.tsx: -------------------------------------------------------------------------------- 1 | export function EnvelopeIcon(props: React.ComponentPropsWithoutRef<'svg'>) { 2 | return ( 3 | 20 | ) 21 | } 22 | -------------------------------------------------------------------------------- /apps/web/src/components/icons/FaceSmileIcon.tsx: -------------------------------------------------------------------------------- 1 | export function FaceSmileIcon(props: React.ComponentPropsWithoutRef<'svg'>) { 2 | return ( 3 | 20 | ) 21 | } 22 | -------------------------------------------------------------------------------- /apps/web/src/components/icons/FolderIcon.tsx: -------------------------------------------------------------------------------- 1 | export function FolderIcon(props: React.ComponentPropsWithoutRef<'svg'>) { 2 | return ( 3 | 25 | ) 26 | } 27 | -------------------------------------------------------------------------------- /apps/web/src/components/icons/LinkIcon.tsx: -------------------------------------------------------------------------------- 1 | export function LinkIcon(props: React.ComponentPropsWithoutRef<'svg'>) { 2 | return ( 3 | 15 | ) 16 | } 17 | -------------------------------------------------------------------------------- /apps/web/src/components/icons/ListIcon.tsx: -------------------------------------------------------------------------------- 1 | export function ListIcon(props: React.ComponentPropsWithoutRef<'svg'>) { 2 | return ( 3 | 20 | ) 21 | } 22 | -------------------------------------------------------------------------------- /apps/web/src/components/icons/MagnifyingGlassIcon.tsx: -------------------------------------------------------------------------------- 1 | export function MagnifyingGlassIcon(props: React.ComponentPropsWithoutRef<'svg'>) { 2 | return ( 3 | 19 | ) 20 | } 21 | -------------------------------------------------------------------------------- /apps/web/src/components/icons/MapPinIcon.tsx: -------------------------------------------------------------------------------- 1 | export function MapPinIcon(props: React.ComponentPropsWithoutRef<'svg'>) { 2 | return ( 3 | 27 | ) 28 | } 29 | -------------------------------------------------------------------------------- /apps/web/src/components/icons/PackageIcon.tsx: -------------------------------------------------------------------------------- 1 | export function PackageIcon(props: React.ComponentPropsWithoutRef<'svg'>) { 2 | return ( 3 | 19 | ) 20 | } 21 | -------------------------------------------------------------------------------- /apps/web/src/components/icons/PaperAirplaneIcon.tsx: -------------------------------------------------------------------------------- 1 | export function PaperAirplaneIcon(props: React.ComponentPropsWithoutRef<'svg'>) { 2 | return ( 3 | 20 | ) 21 | } 22 | -------------------------------------------------------------------------------- /apps/web/src/components/icons/PaperClipIcon.tsx: -------------------------------------------------------------------------------- 1 | export function PaperClipIcon(props: React.ComponentPropsWithoutRef<'svg'>) { 2 | return ( 3 | 15 | ) 16 | } 17 | -------------------------------------------------------------------------------- /apps/web/src/components/icons/ShapesIcon.tsx: -------------------------------------------------------------------------------- 1 | export function ShapesIcon(props: React.ComponentPropsWithoutRef<'svg'>) { 2 | return ( 3 | 20 | ) 21 | } 22 | -------------------------------------------------------------------------------- /apps/web/src/components/icons/ShirtIcon.tsx: -------------------------------------------------------------------------------- 1 | export function ShirtIcon(props: React.ComponentPropsWithoutRef<'svg'>) { 2 | return ( 3 | 14 | ) 15 | } 16 | -------------------------------------------------------------------------------- /apps/web/src/components/icons/SquaresPlusIcon.tsx: -------------------------------------------------------------------------------- 1 | export function SquaresPlusIcon(props: React.ComponentPropsWithoutRef<'svg'>) { 2 | return ( 3 | 20 | ) 21 | } 22 | -------------------------------------------------------------------------------- /apps/web/src/components/icons/TwitterIcon.tsx: -------------------------------------------------------------------------------- 1 | export function TwitterIcon(props) { 2 | return ( 3 | 8 | 12 | 17 | 18 | 19 | ) 20 | } 21 | -------------------------------------------------------------------------------- /apps/web/src/components/ui/skeleton.tsx: -------------------------------------------------------------------------------- 1 | import { cn } from '@/lib/utils' 2 | 3 | function Skeleton({ 4 | className, 5 | ...props 6 | }: React.HTMLAttributes) { 7 | return ( 8 |
12 | ) 13 | } 14 | 15 | export { Skeleton } 16 | -------------------------------------------------------------------------------- /apps/web/src/components/ui/toaster.tsx: -------------------------------------------------------------------------------- 1 | 'use client' 2 | 3 | import { 4 | Toast, 5 | ToastClose, 6 | ToastDescription, 7 | ToastProvider, 8 | ToastTitle, 9 | ToastViewport, 10 | } from '@/components/ui/toast' 11 | import { useToast } from '@/components/ui/use-toast' 12 | 13 | export function Toaster() { 14 | const { toasts } = useToast() 15 | 16 | return ( 17 | 18 | {toasts.map(function ({ id, title, description, action, ...props }) { 19 | return ( 20 | 21 |
22 | {title && {title}} 23 | {description && ( 24 | {description} 25 | )} 26 |
27 | {action} 28 | 29 |
30 | ) 31 | })} 32 | 33 |
34 | ) 35 | } 36 | -------------------------------------------------------------------------------- /apps/web/src/images/ai-app-e2b-sandbox-model.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/e2b-dev/E2B/27e292eedcf04b52b88f5729079c2eb02ae0bc9f/apps/web/src/images/ai-app-e2b-sandbox-model.png -------------------------------------------------------------------------------- /apps/web/src/images/analyze-data-chart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/e2b-dev/E2B/27e292eedcf04b52b88f5729079c2eb02ae0bc9f/apps/web/src/images/analyze-data-chart.png -------------------------------------------------------------------------------- /apps/web/src/images/custom-sandbox.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/e2b-dev/E2B/27e292eedcf04b52b88f5729079c2eb02ae0bc9f/apps/web/src/images/custom-sandbox.png -------------------------------------------------------------------------------- /apps/web/src/images/hello-world-chart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/e2b-dev/E2B/27e292eedcf04b52b88f5729079c2eb02ae0bc9f/apps/web/src/images/hello-world-chart.png -------------------------------------------------------------------------------- /apps/web/src/images/logos/python.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /apps/web/src/images/sandbox-build-output.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/e2b-dev/E2B/27e292eedcf04b52b88f5729079c2eb02ae0bc9f/apps/web/src/images/sandbox-build-output.png -------------------------------------------------------------------------------- /apps/web/src/images/static-chart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/e2b-dev/E2B/27e292eedcf04b52b88f5729079c2eb02ae0bc9f/apps/web/src/images/static-chart.png -------------------------------------------------------------------------------- /apps/web/src/lib/remToPx.ts: -------------------------------------------------------------------------------- 1 | export function remToPx(remValue: number) { 2 | const rootFontSize = 3 | typeof window === 'undefined' 4 | ? 16 5 | : parseFloat(window.getComputedStyle(document.documentElement).fontSize) 6 | 7 | return remValue * rootFontSize 8 | } 9 | -------------------------------------------------------------------------------- /apps/web/src/lib/utils.ts: -------------------------------------------------------------------------------- 1 | import { Sandbox } from 'e2b' 2 | import { type ClassValue, clsx } from 'clsx' 3 | import { twMerge } from 'tailwind-merge' 4 | 5 | export function cn(...inputs: ClassValue[]) { 6 | return twMerge(clsx(inputs)) 7 | } 8 | 9 | // Verify that the sandbox exists and is associated with the API key 10 | export async function verifySandbox(apiKey: string, sandboxId: string) { 11 | const sandboxes = await Sandbox.list({ apiKey }) 12 | return sandboxes.some((sandbox) => sandbox.sandboxId === sandboxId) 13 | } -------------------------------------------------------------------------------- /apps/web/src/mdx/recma.mjs: -------------------------------------------------------------------------------- 1 | import { mdxAnnotations } from 'mdx-annotations' 2 | 3 | export const recmaPlugins = [mdxAnnotations.recma] 4 | -------------------------------------------------------------------------------- /apps/web/src/middleware.ts: -------------------------------------------------------------------------------- 1 | import { NextResponse } from 'next/server' 2 | import type { NextRequest } from 'next/server' 3 | 4 | export function middleware(request: NextRequest) { 5 | const path = request.nextUrl.pathname 6 | 7 | const requestHeaders = new Headers(request.headers) 8 | requestHeaders.set('x-middleware-pathname', path) 9 | 10 | return NextResponse.next({ 11 | request: { 12 | headers: requestHeaders, 13 | }, 14 | }) 15 | } 16 | 17 | export const config = { 18 | matcher: '/docs/:path*', 19 | } 20 | -------------------------------------------------------------------------------- /apps/web/src/utils/obfuscate.tsx: -------------------------------------------------------------------------------- 1 | /** 2 | * Obfuscate the API key by replacing the middle part with asterisks 3 | * @param {string} secret - The API key to obfuscate 4 | * @param {number} start - The number of characters to keep at the start of the key 5 | * @param {number} end - The number of characters to keep at the end of the key 6 | * @param {number} asterisks - The number of asterisks to replace the middle part with 7 | */ 8 | export function obfuscateSecret( 9 | secret: string, 10 | start: number = 7, 11 | end: number = 3, 12 | asterisks: number = 4, 13 | ) { 14 | if (!secret) { 15 | // This should ideally never happen, but just in case, until we have strict mode on 16 | console.error('obfuscateSecret(): No secret to obfuscate provided') 17 | return '' // return to avoid exceptions on following lines 18 | } 19 | return ( 20 | secret.substring(0, start) + 21 | '*'.repeat(asterisks) + 22 | secret.substring(secret.length - end) 23 | ) 24 | } 25 | -------------------------------------------------------------------------------- /apps/web/src/utils/promise.ts: -------------------------------------------------------------------------------- 1 | export function assertFulfilled( 2 | item: PromiseSettledResult, 3 | ): item is PromiseFulfilledResult { 4 | return item.status === 'fulfilled' 5 | } 6 | 7 | export function assertRejected( 8 | item: PromiseSettledResult, 9 | ): item is PromiseRejectedResult { 10 | return item.status === 'rejected' 11 | } 12 | 13 | export function createDeferredPromise() { 14 | let resolve: (value: T) => void 15 | let reject: (reason?: any) => void 16 | const promise = new Promise((res, rej) => { 17 | resolve = res 18 | reject = rej 19 | }) 20 | 21 | return { 22 | resolve: resolve!, 23 | reject: reject!, 24 | promise, 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /apps/web/src/utils/useExpiringState.ts: -------------------------------------------------------------------------------- 1 | import debounce from 'lodash.debounce' 2 | import { useCallback, useMemo, useState } from 'react' 3 | 4 | function useExpiringState({ defaultValue, timeout }) { 5 | const [value, setValue] = useState(defaultValue) 6 | 7 | const enqueExpiration = useMemo( 8 | () => 9 | debounce( 10 | () => { 11 | setValue(defaultValue) 12 | }, 13 | timeout, 14 | { 15 | leading: false, 16 | trailing: true, 17 | }, 18 | ), 19 | [timeout, defaultValue], 20 | ) 21 | 22 | const set = useCallback( 23 | newValue => { 24 | setValue(newValue) 25 | enqueExpiration() 26 | }, 27 | [enqueExpiration], 28 | ) 29 | 30 | return [value, set] 31 | } 32 | 33 | export default useExpiringState 34 | -------------------------------------------------------------------------------- /apps/web/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es6", 4 | "lib": [ 5 | "dom", 6 | "dom.iterable", 7 | "esnext" 8 | ], 9 | "allowJs": true, 10 | "skipLibCheck": true, 11 | "strict": false, // originally true 12 | "forceConsistentCasingInFileNames": true, 13 | "noEmit": true, 14 | "esModuleInterop": true, 15 | "module": "esnext", 16 | "moduleResolution": "node", // originally "bundler" 17 | "resolveJsonModule": true, 18 | "isolatedModules": true, 19 | "jsx": "preserve", 20 | "incremental": true, 21 | "plugins": [ 22 | { 23 | "name": "next" 24 | } 25 | ], 26 | "paths": { 27 | "@/*": [ 28 | "./src/*" 29 | ] 30 | }, 31 | "strictNullChecks": true 32 | }, 33 | "include": [ 34 | "next-env.d.ts", 35 | "**/*.ts", 36 | "**/*.tsx", 37 | ".next/types/**/*.ts" 38 | ], 39 | "exclude": [ 40 | "node_modules", 41 | "src/code" 42 | ] 43 | } 44 | -------------------------------------------------------------------------------- /apps/web/types.d.ts: -------------------------------------------------------------------------------- 1 | import { type SearchOptions } from 'flexsearch' 2 | 3 | declare module '@/mdx/search.mjs' { 4 | export type Result = { 5 | url: string 6 | title: string 7 | pageTitle?: string 8 | preview?: string 9 | badge?: 'Legacy' 10 | } 11 | 12 | export function search(query: string, options?: SearchOptions): Array 13 | } 14 | -------------------------------------------------------------------------------- /apps/web/typestat.json: -------------------------------------------------------------------------------- 1 | { 2 | "files": { 3 | "renameExtensions": true 4 | }, 5 | "fixes": { 6 | "incompleteTypes": true, 7 | "missingProperties": true, 8 | "noImplicitAny": true 9 | }, 10 | "cleanups": { 11 | "suppressTypeErrors": true 12 | }, 13 | "include": ["src/**/*.{js,jsx}"], 14 | "project": "./tsconfig.json" 15 | } 16 | -------------------------------------------------------------------------------- /apps/web/vercel.json: -------------------------------------------------------------------------------- 1 | { 2 | "github": { 3 | "silent": true 4 | }, 5 | "trailingSlash": false 6 | } 7 | -------------------------------------------------------------------------------- /flake.nix: -------------------------------------------------------------------------------- 1 | { 2 | description = "A basic dev shell"; 3 | 4 | inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; 5 | inputs.flake-utils.url = "github:numtide/flake-utils"; 6 | 7 | outputs = { self, nixpkgs, flake-utils, ... }: 8 | (flake-utils.lib.eachDefaultSystem (system: 9 | let pkgs = import nixpkgs { inherit system; }; 10 | in { 11 | devShells.default = 12 | pkgs.mkShell { buildInputs = [ pkgs.python39 pkgs.poetry ]; }; 13 | })); 14 | } 15 | -------------------------------------------------------------------------------- /packages/cli/.eslintrc.cjs: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | extends: '../../.eslintrc.cjs', 4 | } 5 | -------------------------------------------------------------------------------- /packages/cli/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # misc 12 | .DS_Store 13 | .env.local 14 | .env.development.local 15 | .env.test.local 16 | .env.production.local 17 | 18 | npm-debug.log* 19 | yarn-debug.log* 20 | yarn-error.log* 21 | 22 | # Optional npm cache directory 23 | .npm 24 | 25 | # Optional eslint cache 26 | .eslintcache 27 | 28 | # Output of 'npm pack' 29 | *.tgz 30 | 31 | # Yarn Integrity file 32 | .yarn-integrity 33 | 34 | # generate output 35 | dist 36 | 37 | # compiled binary addons (https://nodejs.org/api/addons.html) 38 | build/Release 39 | 40 | /test.md 41 | logs.txt 42 | /dist 43 | /files -------------------------------------------------------------------------------- /packages/cli/scripts/generate_sdk_ref.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -euo pipefail 4 | 5 | # This script generates the CLI SDK reference markdown files 6 | ## Run it in the `cli/` directory 7 | mkdir -p sdk_ref 8 | 9 | npx tsup && NODE_ENV=development node dist/index.js -cmd2md 10 | 11 | PKG_VERSION="v$(node -p "require('./package.json').version")" 12 | 13 | # move to docs web app 14 | for file in sdk_ref/*.md; do 15 | # Extract the filename without extension 16 | filename=$(basename "$file" .md) 17 | 18 | # Create the directory if it doesn't exist 19 | mkdir -p "../../apps/web/src/app/(docs)/docs/sdk-reference/cli/${PKG_VERSION}/${filename}" 20 | 21 | # Move the file to the new location and rename it to page.mdx 22 | mv "$file" "../../apps/web/src/app/(docs)/docs/sdk-reference/cli/${PKG_VERSION}/${filename}/page.mdx" 23 | done 24 | 25 | rm -rf sdk_ref 26 | -------------------------------------------------------------------------------- /packages/cli/src/commands/auth/index.ts: -------------------------------------------------------------------------------- 1 | import * as commander from 'commander' 2 | import { loginCommand } from './login' 3 | import { logoutCommand } from './logout' 4 | import { infoCommand } from './info' 5 | import { configureCommand } from './configure' 6 | 7 | export const authCommand = new commander.Command('auth') 8 | .description('authentication commands') 9 | .addCommand(loginCommand) 10 | .addCommand(logoutCommand) 11 | .addCommand(infoCommand) 12 | .addCommand(configureCommand) 13 | -------------------------------------------------------------------------------- /packages/cli/src/commands/auth/info.ts: -------------------------------------------------------------------------------- 1 | import * as commander from 'commander' 2 | 3 | import { getUserConfig } from 'src/user' 4 | import { asFormattedConfig, asFormattedError } from 'src/utils/format' 5 | 6 | export const infoCommand = new commander.Command('info') 7 | .description('get information about the current user') 8 | .action(async () => { 9 | let userConfig 10 | try { 11 | userConfig = getUserConfig() 12 | } catch (err) { 13 | console.error(asFormattedError('Failed to read user config', err)) 14 | } 15 | 16 | if (!userConfig) { 17 | console.log('Not logged in') 18 | return 19 | } 20 | 21 | console.log(asFormattedConfig(userConfig)) 22 | process.exit(0) 23 | }) 24 | -------------------------------------------------------------------------------- /packages/cli/src/commands/auth/logout.ts: -------------------------------------------------------------------------------- 1 | import * as commander from 'commander' 2 | import * as fs from 'fs' 3 | 4 | import { USER_CONFIG_PATH } from 'src/user' 5 | 6 | export const logoutCommand = new commander.Command('logout') 7 | .description('log out of CLI') 8 | .action(() => { 9 | if (fs.existsSync(USER_CONFIG_PATH)) { 10 | fs.unlinkSync(USER_CONFIG_PATH) // Delete user config 11 | console.log('Logged out.') 12 | } else { 13 | console.log('Not logged in, nothing to do') 14 | } 15 | }) 16 | -------------------------------------------------------------------------------- /packages/cli/src/commands/index.ts: -------------------------------------------------------------------------------- 1 | import * as commander from 'commander' 2 | 3 | import { asPrimary } from 'src/utils/format' 4 | import { templateCommand } from './template' 5 | import { sandboxCommand } from './sandbox' 6 | import { authCommand } from './auth' 7 | 8 | export const program = new commander.Command() 9 | .description( 10 | `Create sandbox templates from Dockerfiles by running ${asPrimary( 11 | 'e2b template build', 12 | )} then use our SDKs to create sandboxes from these templates. 13 | 14 | Visit ${asPrimary( 15 | 'E2B docs (https://e2b.dev/docs)', 16 | )} to learn how to create sandbox templates and start sandboxes. 17 | `, 18 | ) 19 | .addCommand(authCommand) 20 | .addCommand(templateCommand) 21 | .addCommand(sandboxCommand) 22 | -------------------------------------------------------------------------------- /packages/cli/src/commands/sandbox/index.ts: -------------------------------------------------------------------------------- 1 | import * as commander from 'commander' 2 | 3 | import { connectCommand } from './connect' 4 | import { listCommand } from './list' 5 | import { killCommand } from './kill' 6 | import { spawnCommand } from './spawn' 7 | import { logsCommand } from './logs' 8 | 9 | export const sandboxCommand = new commander.Command('sandbox') 10 | .description('work with sandboxes') 11 | .alias('sbx') 12 | .addCommand(connectCommand) 13 | .addCommand(listCommand) 14 | .addCommand(killCommand) 15 | .addCommand(spawnCommand) 16 | .addCommand(logsCommand) 17 | -------------------------------------------------------------------------------- /packages/cli/src/commands/template/index.ts: -------------------------------------------------------------------------------- 1 | import * as commander from 'commander' 2 | 3 | import { buildCommand } from './build' 4 | import { listCommand } from './list' 5 | import { initCommand } from './init' 6 | import { deleteCommand } from './delete' 7 | import { publishCommand, unPublishCommand } from './publish' 8 | 9 | export const templateCommand = new commander.Command('template') 10 | .description('manage sandbox templates') 11 | .alias('tpl') 12 | .addCommand(buildCommand) 13 | .addCommand(listCommand) 14 | .addCommand(initCommand) 15 | .addCommand(deleteCommand) 16 | .addCommand(publishCommand) 17 | .addCommand(unPublishCommand) 18 | -------------------------------------------------------------------------------- /packages/cli/src/docker/constants.ts: -------------------------------------------------------------------------------- 1 | export const defaultDockerfileName = 'e2b.Dockerfile' 2 | export const fallbackDockerfileName = 'Dockerfile' 3 | 4 | export const basicDockerfile = `# You can use most Debian-based base images 5 | FROM ubuntu:22.04 6 | 7 | # Install dependencies and customize sandbox 8 | ` 9 | -------------------------------------------------------------------------------- /packages/cli/src/index.ts: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env -S node --enable-source-maps 2 | 3 | import updateNotifier from 'update-notifier' 4 | import * as commander from 'commander' 5 | import * as packageJSON from '../package.json' 6 | import { program } from './commands' 7 | import { commands2md } from './utils/commands2md' 8 | 9 | export const pkg = packageJSON 10 | 11 | updateNotifier({ 12 | pkg, 13 | updateCheckInterval:1000 * 60 * 60 * 8, // 8 hours 14 | }) 15 | .notify() 16 | 17 | const prog = program.version( 18 | packageJSON.version, 19 | undefined, 20 | 'display E2B CLI version' 21 | ) 22 | 23 | if (process.env.NODE_ENV === 'development') { 24 | prog 25 | .addOption(new commander.Option('-cmd2md').hideHelp()) 26 | .on('option:-cmd2md', () => { 27 | commands2md(program.commands as any) 28 | process.exit(0) 29 | }) 30 | } 31 | 32 | prog.parse() 33 | -------------------------------------------------------------------------------- /packages/cli/src/utils/confirm.ts: -------------------------------------------------------------------------------- 1 | export async function confirm(text: string, defaultAnwser = false) { 2 | const inquirer = await import('inquirer') 3 | const confirmAnswers = await inquirer.default.prompt([ 4 | { 5 | name: 'confirm', 6 | type: 'confirm', 7 | default: defaultAnwser, 8 | message: text, 9 | }, 10 | ]) 11 | 12 | return confirmAnswers['confirm'] as boolean 13 | } 14 | -------------------------------------------------------------------------------- /packages/cli/src/utils/filesystem.ts: -------------------------------------------------------------------------------- 1 | import * as path from 'path' 2 | 3 | export function getRoot(templatePath?: string) { 4 | const defaultPath = process.cwd() 5 | if (!templatePath) return defaultPath 6 | if (path.isAbsolute(templatePath)) return templatePath 7 | return path.resolve(defaultPath, templatePath) 8 | } 9 | 10 | export function cwdRelative(absolutePath: string) { 11 | return path.relative(process.cwd(), absolutePath) 12 | } 13 | -------------------------------------------------------------------------------- /packages/cli/src/utils/templatePrompt.ts: -------------------------------------------------------------------------------- 1 | import * as e2b from 'e2b' 2 | import * as chalk from 'chalk' 3 | 4 | import { asFormattedSandboxTemplate } from 'src/utils/format' 5 | 6 | export async function getPromptTemplates( 7 | templates: e2b.components['schemas']['Template'][], 8 | text: string, 9 | ) { 10 | const inquirer = await import('inquirer') 11 | const templatesAnwsers = await inquirer.default.prompt([ 12 | { 13 | name: 'templates', 14 | message: chalk.default.underline(text), 15 | type: 'checkbox', 16 | pageSize: 50, 17 | choices: templates.map((e) => ({ 18 | name: asFormattedSandboxTemplate(e), 19 | value: e, 20 | })), 21 | }, 22 | ]) 23 | 24 | return templatesAnwsers[ 25 | 'templates' 26 | ] as e2b.components['schemas']['Template'][] 27 | } 28 | -------------------------------------------------------------------------------- /packages/cli/src/utils/templateSort.ts: -------------------------------------------------------------------------------- 1 | import * as sdk from 'e2b' 2 | 3 | export function sortTemplatesAliases< 4 | E extends sdk.components['schemas']['Template']['aliases'], 5 | >(aliases: E) { 6 | aliases?.sort() 7 | } 8 | -------------------------------------------------------------------------------- /packages/cli/src/utils/wait.ts: -------------------------------------------------------------------------------- 1 | export async function wait(ms: number) { 2 | return new Promise((resolve) => setTimeout(resolve, ms)) 3 | } 4 | -------------------------------------------------------------------------------- /packages/cli/testground/demo-basic/.dockerignore: -------------------------------------------------------------------------------- 1 | assets-to-be-ignored 2 | -------------------------------------------------------------------------------- /packages/cli/testground/demo-basic/.gitignore: -------------------------------------------------------------------------------- 1 | assets-to-be-ignored 2 | *.tar.gz 3 | -------------------------------------------------------------------------------- /packages/cli/testground/demo-basic/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:latest 2 | LABEL authors="i" 3 | 4 | ENTRYPOINT ["top", "-b"] -------------------------------------------------------------------------------- /packages/cli/testground/demo-basic/assets-to-be-ignored/cool-doge.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/e2b-dev/E2B/27e292eedcf04b52b88f5729079c2eb02ae0bc9f/packages/cli/testground/demo-basic/assets-to-be-ignored/cool-doge.gif -------------------------------------------------------------------------------- /packages/cli/testground/demo-basic/main.mjs: -------------------------------------------------------------------------------- 1 | // Console log current time with date-fns 2 | import { format } from 'date-fns' 3 | 4 | console.log(`Current time is ${format(new Date(), 'HH:mm:ss')}`) 5 | -------------------------------------------------------------------------------- /packages/cli/testground/demo-basic/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "date-fns": "^2.30.0" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /packages/cli/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es2022", 4 | "module": "es2022", 5 | "lib": ["es2022", "dom", "dom.iterable"], 6 | "allowJs": true, 7 | "declaration": true, 8 | "declarationMap": true, 9 | "moduleResolution": "node", 10 | "sourceMap": true, 11 | "strict": true, 12 | "strictNullChecks": true, 13 | "strictFunctionTypes": true, 14 | "strictBindCallApply": true, 15 | "strictPropertyInitialization": true, 16 | "noImplicitThis": true, 17 | "alwaysStrict": true, 18 | "esModuleInterop": true, 19 | "preserveSymlinks": true, 20 | "downlevelIteration": true, 21 | "resolveJsonModule": true, 22 | "forceConsistentCasingInFileNames": true, 23 | "allowSyntheticDefaultImports": true, 24 | "outDir": "dist", 25 | "baseUrl": ".", 26 | "rootDirs": ["src"], 27 | "paths": { 28 | "e2b": ["../js-sdk/src"] 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /packages/cli/tsup.config.js: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'tsup' 2 | 3 | import * as packageJSON from './package.json' 4 | 5 | const excludedPackages = ['inquirer'] 6 | 7 | export default defineConfig({ 8 | entry: ['src/index.ts'], 9 | shims: true, // Needed for "open" package, as it uses import.meta.url and we are building for cjs 10 | target: 'node18', 11 | platform: 'node', 12 | format: 'cjs', 13 | sourcemap: true, 14 | clean: true, 15 | noExternal: Object.keys(packageJSON.dependencies).filter( 16 | (f) => !excludedPackages.includes(f) 17 | ), 18 | esbuildOptions: (options) => { 19 | options.legalComments = 'none' 20 | return options 21 | }, 22 | }) 23 | -------------------------------------------------------------------------------- /packages/connect-python/.gitignore: -------------------------------------------------------------------------------- 1 | bin 2 | -------------------------------------------------------------------------------- /packages/connect-python/Makefile: -------------------------------------------------------------------------------- 1 | PY = python -m 2 | 3 | plugin = protoc-gen-connect-python 4 | 5 | dev: 6 | $(PY) pip install -r requirements-dev.txt 7 | 8 | fmt: 9 | $(PY) ruff format src 10 | 11 | lint: 12 | $(PY) ruff check src 13 | 14 | clean: 15 | rm -f bin/protoc-gen-connect-python 16 | rm -rf dist 17 | 18 | upload: clean 19 | $(PY) build 20 | $(PY) twine upload --repository=connect-python dist/* 21 | 22 | 23 | bin/$(plugin): $(wildcard cmd/$(plugin)/*.go) pyproject.toml Makefile 24 | go install -ldflags "-w -s" ./cmd/$(plugin) 25 | 26 | .PHONY: dev fmt lint upload clean build 27 | 28 | build: 29 | make bin/protoc-gen-connect-python 30 | -------------------------------------------------------------------------------- /packages/connect-python/README.md: -------------------------------------------------------------------------------- 1 | 🚧 Currently pending [an open RFC to be moved into the Connect RPC org](https://github.com/connectrpc/connectrpc.com/pull/71). Please show support. 🚧 2 | 3 | --- 4 | 5 | # connect-python 6 | 7 | Python client implementation for the [Connect](https://connect.build) RPC protocol. 8 | -------------------------------------------------------------------------------- /packages/connect-python/go.mod: -------------------------------------------------------------------------------- 1 | module go.withmatt.com/connect-python 2 | 3 | go 1.22 4 | 5 | require ( 6 | golang.org/x/exp v0.0.0-20240416160154-fe59bbe5cc7f 7 | google.golang.org/protobuf v1.33.0 8 | ) 9 | -------------------------------------------------------------------------------- /packages/connect-python/go.sum: -------------------------------------------------------------------------------- 1 | github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= 2 | github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= 3 | golang.org/x/exp v0.0.0-20240416160154-fe59bbe5cc7f h1:99ci1mjWVBWwJiEKYY6jWa4d2nTQVIEhZIptnrVb1XY= 4 | golang.org/x/exp v0.0.0-20240416160154-fe59bbe5cc7f/go.mod h1:/lliqkxwWAhPjf5oSOIJup2XcqJaw8RGS6k3TGEc7GI= 5 | google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= 6 | google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= 7 | -------------------------------------------------------------------------------- /packages/connect-python/pyproject.toml: -------------------------------------------------------------------------------- 1 | [project] 2 | name = "connect-python" 3 | version = "0.1.0.dev2" 4 | authors = [{ email = "matt@ydekproductions.com" }] 5 | description = "Client implementation for the Connect RPC protocol" 6 | readme = "README.md" 7 | requires-python = ">=3.12" 8 | classifiers = [ 9 | "Programming Language :: Python :: 3", 10 | "License :: OSI Approved :: Apache Software License", 11 | "Operating System :: OS Independent", 12 | ] 13 | dependencies = [ 14 | "protobuf", 15 | "httpcore", 16 | ] 17 | 18 | [tool.hatch.build] 19 | include = [ 20 | "/src", 21 | ] 22 | 23 | [tool.hatch.build.targets.wheel] 24 | packages = ["src/connect"] 25 | 26 | [project.urls] 27 | "Homepage" = "https://github.com/mattrobenolt/connect-python" 28 | "Bug Tracker" = "https://github.com/mattrobenolt/connect-python/issues" 29 | 30 | [project.optional-dependencies] 31 | http2 = ["h2"] 32 | 33 | [build-system] 34 | requires = ["hatchling"] 35 | build-backend = "hatchling.build" 36 | -------------------------------------------------------------------------------- /packages/connect-python/requirements-dev.txt: -------------------------------------------------------------------------------- 1 | -e .[http2] 2 | 3 | ruff 4 | build 5 | twine 6 | -------------------------------------------------------------------------------- /packages/js-sdk/.eslintrc.cjs: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | extends: '../../.eslintrc.cjs', 4 | } 5 | -------------------------------------------------------------------------------- /packages/js-sdk/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # misc 12 | .DS_Store 13 | .env.local 14 | .env.development.local 15 | .env.test.local 16 | .env.production.local 17 | 18 | npm-debug.log* 19 | yarn-debug.log* 20 | yarn-error.log* 21 | 22 | # Optional npm cache directory 23 | .npm 24 | 25 | # Optional eslint cache 26 | .eslintcache 27 | 28 | # Output of 'npm pack' 29 | *.tgz 30 | 31 | # Yarn Integrity file 32 | .yarn-integrity 33 | 34 | # generate output 35 | dist 36 | 37 | # compiled binary addons (https://nodejs.org/api/addons.html) 38 | build/Release 39 | 40 | /test.md 41 | logs.txt 42 | deno.lock 43 | 44 | __screenshots__ 45 | -------------------------------------------------------------------------------- /packages/js-sdk/scripts/post-publish.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | npm pkg set 'name'='@e2b/sdk' 4 | npm publish --no-git-checks 5 | npm pkg set 'name'='e2b' 6 | npm deprecate "@e2b/sdk@$(npm pkg get version | tr -d \")" "The package @e2b/sdk has been renamed to e2b. Please uninstall the old one and install the new by running following command: npm uninstall @e2b/sdk && npm install e2b" 7 | -------------------------------------------------------------------------------- /packages/js-sdk/src/envd/versions.ts: -------------------------------------------------------------------------------- 1 | export const ENVD_VERSION_RECURSIVE_WATCH = '0.1.4' -------------------------------------------------------------------------------- /packages/js-sdk/tests/api/info.test.ts: -------------------------------------------------------------------------------- 1 | import { expect } from 'vitest' 2 | 3 | import { sandboxTest, isDebug } from '../setup.js' 4 | 5 | sandboxTest.skipIf(isDebug)('get sandbox info', async ({ sandbox }) => { 6 | const info = await sandbox.getInfo() 7 | expect(info).toBeDefined() 8 | expect(info.sandboxId).toBe(sandbox.sandboxId) 9 | }) 10 | -------------------------------------------------------------------------------- /packages/js-sdk/tests/api/kill.test.ts: -------------------------------------------------------------------------------- 1 | import { expect } from 'vitest' 2 | 3 | import { sandboxTest, isDebug } from '../setup.js' 4 | import { Sandbox } from '../../src' 5 | 6 | sandboxTest.skipIf(isDebug)('kill existing sandbox', async ({ sandbox }) => { 7 | await Sandbox.kill(sandbox.sandboxId) 8 | 9 | const list = await Sandbox.list() 10 | expect(list.map(s => s.sandboxId)).not.toContain(sandbox.sandboxId) 11 | }) 12 | 13 | sandboxTest.skipIf(isDebug)('kill non-existing sandbox', async () => { 14 | await expect(Sandbox.kill('non-existing-sandbox')).resolves.toBe(false) 15 | }) 16 | -------------------------------------------------------------------------------- /packages/js-sdk/tests/cmdHelper.ts: -------------------------------------------------------------------------------- 1 | import { CommandHandle, CommandExitError } from '../src/index.js' 2 | import { assert } from 'vitest' 3 | 4 | export function catchCmdExitErrorInBackground(cmd: CommandHandle) { 5 | let disabled = false 6 | 7 | cmd.wait().catch((res: CommandExitError) => { 8 | if (!disabled) { 9 | assert.equal(res.exitCode, 0, `command failed with exit code ${res.exitCode}: ${res.stderr}`) 10 | } 11 | }) 12 | 13 | return () => { 14 | disabled = true 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /packages/js-sdk/tests/integration/template/README.md: -------------------------------------------------------------------------------- 1 | # Integration test template 2 | 3 | # Build the template 4 | 5 | `$ e2b template build -c "cd /basic-nextjs-app/ && sudo npm run dev"` 6 | -------------------------------------------------------------------------------- /packages/js-sdk/tests/integration/template/e2b.Dockerfile: -------------------------------------------------------------------------------- 1 | FROM e2bdev/code-interpreter:latest 2 | 3 | # Install stess-ng, a tool to load and stress computer systems 4 | RUN apt update 5 | RUN apt install -y stress-ng 6 | 7 | # Create a basic Next.js app 8 | RUN npx -y create-next-app@latest basic-nextjs-app --yes --ts --use-npm 9 | 10 | # Install dependencies 11 | RUN cd basic-nextjs-app && npm install 12 | 13 | -------------------------------------------------------------------------------- /packages/js-sdk/tests/integration/template/e2b.toml: -------------------------------------------------------------------------------- 1 | # This is a config for E2B sandbox template. 2 | # You can use template ID (2e2z80zhv34yumbrybvn) or template name (integration-test-v1) to create a sandbox: 3 | 4 | # Python SDK 5 | # from e2b import Sandbox, AsyncSandbox 6 | # sandbox = Sandbox("integration-test-v1") # Sync sandbox 7 | # sandbox = await AsyncSandbox.create("integration-test-v1") # Async sandbox 8 | 9 | # JS SDK 10 | # import { Sandbox } from 'e2b' 11 | # const sandbox = await Sandbox.create('integration-test-v1') 12 | 13 | team_id = "460355b3-4f64-48f9-9a16-4442817f79f5" 14 | memory_mb = 512 15 | start_cmd = "npm run dev" 16 | dockerfile = "e2b.Dockerfile" 17 | template_name = "integration-test-v1" 18 | template_id = "2e2z80zhv34yumbrybvn" 19 | -------------------------------------------------------------------------------- /packages/js-sdk/tests/runtimes/bun/run.test.ts: -------------------------------------------------------------------------------- 1 | import { expect, test } from 'bun:test' 2 | 3 | import { Sandbox } from '../../../src' 4 | import { template } from '../../template' 5 | 6 | test( 7 | 'Bun test', 8 | async () => { 9 | const sbx = await Sandbox.create(template, { timeoutMs: 5_000 }) 10 | try { 11 | const isRunning = await sbx.isRunning() 12 | expect(isRunning).toBeTruthy() 13 | 14 | const text = 'Hello, World!' 15 | 16 | const cmd = await sbx.commands.run(`echo "${text}"`) 17 | 18 | expect(cmd.exitCode).toBe(0) 19 | expect(cmd.stdout).toEqual(`${text}\n`) 20 | } finally { 21 | await sbx.kill() 22 | } 23 | }, 24 | { timeout: 20_000 } 25 | ) 26 | -------------------------------------------------------------------------------- /packages/js-sdk/tests/runtimes/deno/run.test.ts: -------------------------------------------------------------------------------- 1 | import { assert, assertEquals } from 'https://deno.land/std@0.224.0/assert/mod.ts' 2 | import { load } from 'https://deno.land/std@0.224.0/dotenv/mod.ts' 3 | 4 | await load({ envPath: '.env', export: true }) 5 | 6 | import { Sandbox } from '../../../dist/index.mjs' 7 | import { template } from '../../template' 8 | 9 | 10 | Deno.test('Deno test', async () => { 11 | const sbx = await Sandbox.create(template, { timeoutMs: 5_000 }) 12 | try { 13 | const isRunning = await sbx.isRunning() 14 | assert(isRunning) 15 | 16 | const text = 'Hello, World!' 17 | 18 | const cmd = await sbx.commands.run(`echo "${text}"`) 19 | 20 | assertEquals(cmd.exitCode, 0) 21 | assertEquals(cmd.stdout, `${text}\n`) 22 | } finally { 23 | await sbx.kill() 24 | } 25 | }) 26 | -------------------------------------------------------------------------------- /packages/js-sdk/tests/sandbox/commands/connect.test.ts: -------------------------------------------------------------------------------- 1 | import { assert, expect } from 'vitest' 2 | import { sandboxTest } from '../../setup.js' 3 | 4 | sandboxTest('connect to process', async ({ sandbox }) => { 5 | const cmd = await sandbox.commands.run('sleep 10', { background: true }) 6 | const pid = cmd.pid 7 | 8 | const processInfo = await sandbox.commands.connect(pid) 9 | 10 | assert.isObject(processInfo) 11 | assert.equal(processInfo.pid, pid) 12 | }) 13 | 14 | sandboxTest('connect to non-existing process', async ({ sandbox }) => { 15 | const nonExistingPid = 999999 16 | 17 | await expect(sandbox.commands.connect(nonExistingPid)).rejects.toThrowError() 18 | }) 19 | -------------------------------------------------------------------------------- /packages/js-sdk/tests/sandbox/commands/envVars.test.ts: -------------------------------------------------------------------------------- 1 | import { assert, test } from 'vitest' 2 | 3 | import { sandboxTest, isDebug, template } from '../../setup.js' 4 | import { Sandbox } from '../../../src' 5 | 6 | sandboxTest.skipIf(isDebug)('env vars', async ({ sandbox }) => { 7 | const cmd = await sandbox.commands.run('echo $FOO', { envs: { FOO: 'bar' } }) 8 | 9 | assert.equal(cmd.exitCode, 0) 10 | assert.equal(cmd.stdout.trim(), 'bar') 11 | }) 12 | 13 | test.skipIf(isDebug)('env vars on sandbox', async () => { 14 | const sandbox = await Sandbox.create(template, { envs: { FOO: 'bar' } }) 15 | 16 | try { 17 | const cmd = await sandbox.commands.run('echo "$FOO"') 18 | 19 | assert.equal(cmd.exitCode, 0) 20 | assert.equal(cmd.stdout.trim(), 'bar') 21 | } finally { 22 | await sandbox.kill() 23 | } 24 | }) 25 | -------------------------------------------------------------------------------- /packages/js-sdk/tests/sandbox/commands/kill.test.ts: -------------------------------------------------------------------------------- 1 | import { expect } from 'vitest' 2 | import { ProcessExitError } from '../../../src/index.js' 3 | 4 | import { sandboxTest } from '../../setup.js' 5 | 6 | sandboxTest('kill process', async ({ sandbox }) => { 7 | const cmd = await sandbox.commands.run('sleep 10', { background: true }) 8 | const pid = cmd.pid 9 | 10 | await sandbox.commands.kill(pid) 11 | 12 | await expect(sandbox.commands.run(`kill -0 ${pid}`)).rejects.toThrowError(ProcessExitError) 13 | }) 14 | 15 | sandboxTest('kill non-existing process', async ({ sandbox }) => { 16 | const nonExistingPid = 999999 17 | 18 | await expect(sandbox.commands.kill(nonExistingPid)).resolves.toBe(false) 19 | }) 20 | -------------------------------------------------------------------------------- /packages/js-sdk/tests/sandbox/commands/list.test.ts: -------------------------------------------------------------------------------- 1 | import { assert } from 'vitest' 2 | import { sandboxTest } from '../../setup.js' 3 | 4 | sandboxTest('list processes', async ({ sandbox }) => { 5 | // Start them firsts 6 | await sandbox.commands.run('sleep 10', { background: true }) 7 | await sandbox.commands.run('sleep 10', { background: true }) 8 | 9 | const processes = await sandbox.commands.list() 10 | 11 | assert.isArray(processes) 12 | assert.isAtLeast(processes.length, 2) 13 | 14 | processes.forEach(process => { 15 | assert.containsAllKeys(process, ['pid']) 16 | }) 17 | }) 18 | -------------------------------------------------------------------------------- /packages/js-sdk/tests/sandbox/files/exists.test.ts: -------------------------------------------------------------------------------- 1 | import { assert } from 'vitest' 2 | 3 | import { sandboxTest } from '../../setup.js' 4 | 5 | sandboxTest('file exists', async ({ sandbox }) => { 6 | const filename = 'test_exists.txt' 7 | 8 | await sandbox.files.write(filename, 'test') 9 | const exists = await sandbox.files.exists(filename) 10 | assert.isTrue(exists) 11 | }) 12 | 13 | sandboxTest('file does not exist', async ({ sandbox }) => { 14 | const filename = 'test_does_not_exist.txt' 15 | 16 | const exists = await sandbox.files.exists(filename) 17 | assert.isFalse(exists) 18 | }) 19 | -------------------------------------------------------------------------------- /packages/js-sdk/tests/sandbox/files/read.test.ts: -------------------------------------------------------------------------------- 1 | import { expect, assert } from 'vitest' 2 | 3 | import { NotFoundError } from '../../../src' 4 | import { sandboxTest } from '../../setup.js' 5 | 6 | sandboxTest('read file', async ({ sandbox }) => { 7 | const filename = 'test_read.txt' 8 | const content = 'Hello, world!' 9 | 10 | await sandbox.files.write(filename, content) 11 | const readContent = await sandbox.files.read(filename) 12 | assert.equal(readContent, content) 13 | }) 14 | 15 | sandboxTest('read non-existing file', async ({ sandbox }) => { 16 | const filename = 'non_existing_file.txt' 17 | 18 | await expect(sandbox.files.read(filename)).rejects.toThrowError(NotFoundError) 19 | }) 20 | 21 | sandboxTest('empty file', async ({ sandbox }) => { 22 | const filename = 'empty-file.txt' 23 | 24 | await sandbox.commands.run(`touch ${filename}`) 25 | const content = await sandbox.files.read(filename) 26 | expect(content).toBe('') 27 | }) 28 | -------------------------------------------------------------------------------- /packages/js-sdk/tests/sandbox/files/remove.test.ts: -------------------------------------------------------------------------------- 1 | import { assert } from 'vitest' 2 | 3 | import { sandboxTest } from '../../setup.js' 4 | 5 | sandboxTest('remove file', async ({ sandbox }) => { 6 | const filename = 'test_remove.txt' 7 | const content = 'This file will be removed.' 8 | 9 | await sandbox.files.write(filename, content) 10 | await sandbox.files.remove(filename) 11 | 12 | const exists = await sandbox.files.exists(filename) 13 | assert.isFalse(exists) 14 | }) 15 | 16 | sandboxTest('remove non-existing file', async ({ sandbox }) => { 17 | const filename = 'non_existing_file.txt' 18 | 19 | await sandbox.files.remove(filename) 20 | }) 21 | -------------------------------------------------------------------------------- /packages/js-sdk/tests/sandbox/kill.test.ts: -------------------------------------------------------------------------------- 1 | import { expect } from 'vitest' 2 | 3 | import { Sandbox } from '../../src' 4 | import { sandboxTest, isDebug } from '../setup.js' 5 | 6 | sandboxTest.skipIf(isDebug)('kill', async ({ sandbox }) => { 7 | await sandbox.kill() 8 | 9 | const list = await Sandbox.list() 10 | expect(list.map(s => s.sandboxId)).not.toContain(sandbox.sandboxId) 11 | }) 12 | -------------------------------------------------------------------------------- /packages/js-sdk/tests/sandbox/pty/ptyCreate.test.ts: -------------------------------------------------------------------------------- 1 | import { sandboxTest } from '../../setup' 2 | import { assert } from 'vitest' 3 | 4 | sandboxTest('create PTY', async ({ sandbox }) => { 5 | let output = '' 6 | const decoder = new TextDecoder() 7 | const appendData = (data: Uint8Array) => { 8 | output += decoder.decode(data) 9 | } 10 | 11 | const terminal = await sandbox.pty.create({ 12 | cols: 80, 13 | rows: 24, 14 | onData: appendData, 15 | envs: { ABC: '123' }, 16 | }) 17 | 18 | await sandbox.pty.sendInput( 19 | terminal.pid, 20 | new Uint8Array(Buffer.from('echo $ABC\nexit\n')) 21 | ) 22 | 23 | await terminal.wait() 24 | assert.equal(terminal.exitCode, 0) 25 | 26 | assert.include(output, '123') 27 | }) 28 | -------------------------------------------------------------------------------- /packages/js-sdk/tests/sandbox/pty/sendInput.test.ts: -------------------------------------------------------------------------------- 1 | import { expect } from 'vitest' 2 | import { sandboxTest } from '../../setup' 3 | 4 | sandboxTest('send input', async ({ sandbox }) => { 5 | const terminal = await sandbox.pty.create({ 6 | cols: 80, 7 | rows: 24, 8 | onData: () => null, 9 | }) 10 | 11 | await sandbox.pty.sendInput( 12 | terminal.pid, 13 | new Uint8Array(Buffer.from('exit\n')) 14 | ) 15 | 16 | await terminal.wait() 17 | expect(terminal.exitCode).toBe(0) 18 | }) 19 | -------------------------------------------------------------------------------- /packages/js-sdk/tests/sandbox/timeout.test.ts: -------------------------------------------------------------------------------- 1 | import { expect } from 'vitest' 2 | 3 | import { sandboxTest, isDebug, wait } from '../setup.js' 4 | 5 | sandboxTest.skipIf(isDebug)('shorten timeout', async ({ sandbox }) => { 6 | await sandbox.setTimeout(5000) 7 | 8 | await wait(6000) 9 | 10 | expect(await sandbox.isRunning({ requestTimeoutMs: 1000 })).toBeFalsy() 11 | }) 12 | 13 | sandboxTest.skipIf(isDebug)('shorten then lenghten timeout', async ({ sandbox }) => { 14 | await sandbox.setTimeout(5000) 15 | 16 | await wait(1000) 17 | 18 | await sandbox.setTimeout(10000) 19 | 20 | await wait(6000) 21 | 22 | expect(await sandbox.isRunning()).toBeTruthy() 23 | }) 24 | 25 | sandboxTest.skipIf(isDebug)('get sandbox timeout', async ({ sandbox }) => { 26 | const { endAt } = await sandbox.getInfo() 27 | expect(endAt).toBeInstanceOf(Date) 28 | }) -------------------------------------------------------------------------------- /packages/js-sdk/tests/template.ts: -------------------------------------------------------------------------------- 1 | export const template = 'base' 2 | -------------------------------------------------------------------------------- /packages/js-sdk/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "outDir": "dist", 4 | "target": "es6", 5 | "lib": [ 6 | "dom", 7 | "ESNext" 8 | ], 9 | "sourceMap": true, 10 | "allowJs": true, 11 | "skipLibCheck": true, 12 | "esModuleInterop": true, 13 | "allowSyntheticDefaultImports": true, 14 | "strict": true, 15 | "forceConsistentCasingInFileNames": true, 16 | "noFallthroughCasesInSwitch": true, 17 | "moduleResolution": "node", 18 | "resolveJsonModule": true, 19 | "isolatedModules": true, 20 | "declaration": true, 21 | }, 22 | "include": [ 23 | "src" 24 | ], 25 | "exclude": [ 26 | "dist", 27 | "node_modules", 28 | "tsup.config.js" 29 | ] 30 | } 31 | -------------------------------------------------------------------------------- /packages/js-sdk/tsup.config.js: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'tsup' 2 | 3 | export default defineConfig({ 4 | minify: false, 5 | target: ['es2017'], 6 | sourcemap: true, 7 | dts: true, 8 | format: ['esm', 'cjs'], 9 | clean: true, 10 | entry: { 11 | index: './src/index.ts', 12 | }, 13 | esbuildOptions: (options) => { 14 | options.legalComments = 'none' 15 | return options 16 | }, 17 | }) 18 | -------------------------------------------------------------------------------- /packages/js-sdk/typedoc.json: -------------------------------------------------------------------------------- 1 | { 2 | "out": "sdk_ref", 3 | "plugin": ["typedoc-plugin-markdown", "./scripts/CustomMarkdownTheme.js"], 4 | "exclude": ["**/*.spec.ts"], 5 | "entryPoints": [ 6 | "src/sandbox/index.ts", 7 | "src/sandbox/filesystem/index.ts", 8 | "src/sandbox/process/index.ts", 9 | "src/sandbox/commands/index.ts", 10 | "src/errors.ts" 11 | ], 12 | "excludeExternals": true, 13 | "excludePrivate": true, 14 | "excludeProtected": true, 15 | "navigation": { 16 | "includeGroups": false, 17 | "includeCategories": false 18 | }, 19 | "outputFileStrategy": "modules", 20 | "readme": "none", 21 | "disableSources": true, 22 | // typedoc-plugin-markdown options 23 | "classPropertiesFormat": "table", 24 | "typeDeclarationFormat": "table", 25 | "enumMembersFormat": "table", 26 | "parametersFormat": "table", 27 | "expandParameters": true, 28 | "useCodeBlocks": true, 29 | "hidePageTitle": true, 30 | "hideBreadcrumbs": true 31 | } 32 | -------------------------------------------------------------------------------- /packages/python-sdk/Makefile: -------------------------------------------------------------------------------- 1 | generate-api: 2 | python ./../../spec/remove_extra_tags.py sandboxes 3 | openapi-python-client generate --output-path e2b/api/api --overwrite --path ../../spec/openapi_generated.yml 4 | rm -rf e2b/api/client 5 | mv e2b/api/api/e2b_api_client e2b/api/client 6 | rm -rf e2b/api/api 7 | 8 | init: 9 | pip install openapi-python-client 10 | 11 | lint: 12 | ruff check . 13 | -------------------------------------------------------------------------------- /packages/python-sdk/e2b/api/client/__init__.py: -------------------------------------------------------------------------------- 1 | """A client library for accessing E2B API""" 2 | 3 | from .client import AuthenticatedClient, Client 4 | 5 | __all__ = ( 6 | "AuthenticatedClient", 7 | "Client", 8 | ) 9 | -------------------------------------------------------------------------------- /packages/python-sdk/e2b/api/client/api/__init__.py: -------------------------------------------------------------------------------- 1 | """Contains methods for accessing the API""" 2 | -------------------------------------------------------------------------------- /packages/python-sdk/e2b/api/client/api/sandboxes/__init__.py: -------------------------------------------------------------------------------- 1 | """Contains endpoint functions for accessing the API""" 2 | -------------------------------------------------------------------------------- /packages/python-sdk/e2b/api/client/errors.py: -------------------------------------------------------------------------------- 1 | """Contains shared errors types that can be raised from API functions""" 2 | 3 | 4 | class UnexpectedStatus(Exception): 5 | """Raised by api functions when the response status an undocumented status and Client.raise_on_unexpected_status is True""" 6 | 7 | def __init__(self, status_code: int, content: bytes): 8 | self.status_code = status_code 9 | self.content = content 10 | 11 | super().__init__( 12 | f"Unexpected status code: {status_code}\n\nResponse content:\n{content.decode(errors='ignore')}" 13 | ) 14 | 15 | 16 | __all__ = ["UnexpectedStatus"] 17 | -------------------------------------------------------------------------------- /packages/python-sdk/e2b/api/client/models/node_status.py: -------------------------------------------------------------------------------- 1 | from enum import Enum 2 | 3 | 4 | class NodeStatus(str, Enum): 5 | CONNECTING = "connecting" 6 | DRAINING = "draining" 7 | READY = "ready" 8 | UNHEALTHY = "unhealthy" 9 | 10 | def __str__(self) -> str: 11 | return str(self.value) 12 | -------------------------------------------------------------------------------- /packages/python-sdk/e2b/api/client/models/sandbox_state.py: -------------------------------------------------------------------------------- 1 | from enum import Enum 2 | 3 | 4 | class SandboxState(str, Enum): 5 | PAUSED = "paused" 6 | RUNNING = "running" 7 | 8 | def __str__(self) -> str: 9 | return str(self.value) 10 | -------------------------------------------------------------------------------- /packages/python-sdk/e2b/api/client/models/template_build_status.py: -------------------------------------------------------------------------------- 1 | from enum import Enum 2 | 3 | 4 | class TemplateBuildStatus(str, Enum): 5 | BUILDING = "building" 6 | ERROR = "error" 7 | READY = "ready" 8 | WAITING = "waiting" 9 | 10 | def __str__(self) -> str: 11 | return str(self.value) 12 | -------------------------------------------------------------------------------- /packages/python-sdk/e2b/api/client/py.typed: -------------------------------------------------------------------------------- 1 | # Marker file for PEP 561 -------------------------------------------------------------------------------- /packages/python-sdk/e2b/api/metadata.py: -------------------------------------------------------------------------------- 1 | import platform 2 | 3 | from importlib import metadata 4 | 5 | default_headers = { 6 | "lang": "python", 7 | "lang_version": platform.python_version(), 8 | "machine": platform.machine(), 9 | "os": platform.platform(), 10 | "package_version": metadata.version("e2b"), 11 | "processor": platform.processor(), 12 | "publisher": "e2b", 13 | "release": platform.release(), 14 | "sdk_runtime": "python", 15 | "system": platform.system(), 16 | } 17 | -------------------------------------------------------------------------------- /packages/python-sdk/e2b/envd/versions.py: -------------------------------------------------------------------------------- 1 | from packaging.version import Version 2 | 3 | ENVD_VERSION_RECURSIVE_WATCH = Version("0.1.4") 4 | -------------------------------------------------------------------------------- /packages/python-sdk/e2b/sandbox/commands/main.py: -------------------------------------------------------------------------------- 1 | from dataclasses import dataclass 2 | from typing import Dict, List, Optional 3 | 4 | 5 | @dataclass 6 | class ProcessInfo: 7 | """ 8 | Information about a command, PTY session or start command running in the sandbox as process. 9 | """ 10 | 11 | pid: int 12 | """ 13 | Process ID. 14 | """ 15 | 16 | tag: Optional[str] 17 | """ 18 | Custom tag used for identifying special commands like start command in the custom template. 19 | """ 20 | 21 | cmd: str 22 | """ 23 | Command that was executed. 24 | """ 25 | 26 | args: List[str] 27 | """ 28 | Command arguments. 29 | """ 30 | 31 | envs: Dict[str, str] 32 | """ 33 | Environment variables used for the command. 34 | """ 35 | 36 | cwd: Optional[str] 37 | """ 38 | Executed command working directory. 39 | """ 40 | -------------------------------------------------------------------------------- /packages/python-sdk/e2b/sandbox_async/utils.py: -------------------------------------------------------------------------------- 1 | from typing import TypeVar, Union, Callable, Awaitable 2 | 3 | T = TypeVar("T") 4 | OutputHandler = Union[ 5 | Callable[[T], None], 6 | Callable[[T], Awaitable[None]], 7 | ] 8 | -------------------------------------------------------------------------------- /packages/python-sdk/e2b_connect/__init__.py: -------------------------------------------------------------------------------- 1 | from .client import Client, GzipCompressor, ConnectException, Code # noqa: F401 2 | -------------------------------------------------------------------------------- /packages/python-sdk/example.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | import logging 3 | from e2b import AsyncSandbox 4 | 5 | import dotenv 6 | 7 | dotenv.load_dotenv() 8 | 9 | logging.basicConfig(level=logging.ERROR) 10 | 11 | 12 | async def main(): 13 | sbx = await AsyncSandbox.create(timeout=10, debug=True) 14 | await sbx.set_timeout(20) 15 | 16 | 17 | if __name__ == "__main__": 18 | asyncio.run(main()) 19 | -------------------------------------------------------------------------------- /packages/python-sdk/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@e2b/python-sdk", 3 | "private": true, 4 | "version": "1.5.1", 5 | "scripts": { 6 | "example": "poetry run python example.py", 7 | "test": "poetry run pytest -n 4 --verbose -x", 8 | "postVersion": "poetry version $(pnpm pkg get version --workspaces=false | tr -d \\\")", 9 | "postPublish": "poetry build && poetry config pypi-token.pypi ${PYPI_TOKEN} && poetry publish --skip-existing", 10 | "pretest": "poetry install", 11 | "generate-ref": "poetry install && ./scripts/generate_sdk_ref.sh" 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /packages/python-sdk/pytest.ini: -------------------------------------------------------------------------------- 1 | # content of pytest.ini 2 | [pytest] 3 | markers = 4 | skip_debug: skip test if E2B_DEBUG is set. 5 | 6 | asyncio_mode=auto 7 | addopts = "--import-mode=importlib" "--numprocesses=2" 8 | -------------------------------------------------------------------------------- /packages/python-sdk/scripts/fix-python-pb.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | rm -rf e2b/envd/__pycache__ 4 | rm -rf e2b/envd/filesystem/__pycache__ 5 | rm -rf e2b/envd/process/__pycache__ 6 | 7 | sed -i.bak 's/from\ process\ import/from e2b.envd.process import/g' e2b/envd/process/* e2b/envd/filesystem/* 8 | sed -i.bak 's/from\ filesystem\ import/from e2b.envd.filesystem import/g' e2b/envd/process/* e2b/envd/filesystem/* 9 | 10 | rm -f e2b/envd/process/*.bak 11 | rm -f e2b/envd/filesystem/*.bak 12 | -------------------------------------------------------------------------------- /packages/python-sdk/tests/async/api_async/test_sbx_info.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | 3 | from e2b import AsyncSandbox 4 | 5 | 6 | @pytest.mark.skip_debug() 7 | async def test_get_info(async_sandbox: AsyncSandbox): 8 | info = await async_sandbox.get_info() 9 | assert info.sandbox_id == async_sandbox.sandbox_id 10 | -------------------------------------------------------------------------------- /packages/python-sdk/tests/async/api_async/test_sbx_kill.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | 3 | from e2b import AsyncSandbox 4 | 5 | 6 | @pytest.mark.skip_debug() 7 | async def test_kill_existing_sandbox(async_sandbox: AsyncSandbox): 8 | assert await AsyncSandbox.kill(async_sandbox.sandbox_id) 9 | 10 | list = await AsyncSandbox.list() 11 | assert async_sandbox.sandbox_id not in [s.sandbox_id for s in list] 12 | 13 | 14 | @pytest.mark.skip_debug() 15 | async def test_kill_non_existing_sandbox(): 16 | assert not await AsyncSandbox.kill("non-existing-sandbox") 17 | -------------------------------------------------------------------------------- /packages/python-sdk/tests/async/sandbox_async/commands/test_cmd_connect.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | 3 | from e2b import NotFoundException, AsyncSandbox 4 | 5 | 6 | async def test_connect_to_process(async_sandbox: AsyncSandbox): 7 | cmd = await async_sandbox.commands.run("sleep 10", background=True) 8 | pid = cmd.pid 9 | 10 | process_info = await async_sandbox.commands.connect(pid) 11 | assert process_info.pid == pid 12 | 13 | 14 | async def test_connect_to_non_existing_process(async_sandbox: AsyncSandbox): 15 | non_existing_pid = 999999 16 | 17 | with pytest.raises(NotFoundException): 18 | await async_sandbox.commands.connect(non_existing_pid) 19 | -------------------------------------------------------------------------------- /packages/python-sdk/tests/async/sandbox_async/commands/test_cmd_kill.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | 3 | from e2b import AsyncSandbox, CommandExitException 4 | 5 | 6 | async def test_kill_process(async_sandbox: AsyncSandbox): 7 | cmd = await async_sandbox.commands.run("sleep 10", background=True) 8 | pid = cmd.pid 9 | 10 | await async_sandbox.commands.kill(pid) 11 | 12 | with pytest.raises(CommandExitException): 13 | await async_sandbox.commands.run(f"kill -0 {pid}") 14 | 15 | 16 | async def test_kill_non_existing_process(async_sandbox: AsyncSandbox): 17 | non_existing_pid = 999999 18 | 19 | assert not await async_sandbox.commands.kill(non_existing_pid) 20 | -------------------------------------------------------------------------------- /packages/python-sdk/tests/async/sandbox_async/commands/test_cmd_list.py: -------------------------------------------------------------------------------- 1 | 2 | from e2b import AsyncSandbox 3 | 4 | 5 | async def test_kill_process(async_sandbox: AsyncSandbox): 6 | c1 = await async_sandbox.commands.run("sleep 10", background=True) 7 | c2 = await async_sandbox.commands.run("sleep 10", background=True) 8 | 9 | processes = await async_sandbox.commands.list() 10 | 11 | assert len(processes) >= 2 12 | pids = [p.pid for p in processes] 13 | assert c1.pid in pids 14 | assert c2.pid in pids 15 | -------------------------------------------------------------------------------- /packages/python-sdk/tests/async/sandbox_async/commands/test_env_vars.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | 3 | from e2b import AsyncSandbox 4 | 5 | 6 | async def test_command_envs(async_sandbox: AsyncSandbox): 7 | cmd = await async_sandbox.commands.run("echo $FOO", envs={"FOO": "bar"}) 8 | assert cmd.stdout.strip() == "bar" 9 | 10 | 11 | @pytest.mark.skip_debug() 12 | async def test_sandbox_envs(template): 13 | try: 14 | sbx = await AsyncSandbox.create(template, envs={"FOO": "bar"}) 15 | cmd = await sbx.commands.run("echo $FOO") 16 | assert cmd.stdout.strip() == "bar" 17 | finally: 18 | await sbx.kill() 19 | -------------------------------------------------------------------------------- /packages/python-sdk/tests/async/sandbox_async/files/test_exists.py: -------------------------------------------------------------------------------- 1 | 2 | from e2b import AsyncSandbox 3 | 4 | 5 | async def test_exists(async_sandbox: AsyncSandbox): 6 | filename = "test_exists.txt" 7 | 8 | await async_sandbox.files.write(filename, "test") 9 | assert await async_sandbox.files.exists(filename) 10 | -------------------------------------------------------------------------------- /packages/python-sdk/tests/async/sandbox_async/files/test_read.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | 3 | from e2b import NotFoundException, AsyncSandbox 4 | 5 | 6 | async def test_read_file(async_sandbox: AsyncSandbox): 7 | filename = "test_read.txt" 8 | content = "Hello, world!" 9 | 10 | await async_sandbox.files.write(filename, content) 11 | read_content = await async_sandbox.files.read(filename) 12 | assert read_content == content 13 | 14 | 15 | async def test_read_non_existing_file(async_sandbox: AsyncSandbox): 16 | filename = "non_existing_file.txt" 17 | 18 | with pytest.raises(NotFoundException): 19 | await async_sandbox.files.read(filename) 20 | 21 | 22 | async def test_read_empty_file(async_sandbox: AsyncSandbox): 23 | filename = "empty_file.txt" 24 | content = "" 25 | 26 | await async_sandbox.commands.run(f"touch {filename}") 27 | read_content = await async_sandbox.files.read(filename) 28 | assert read_content == content 29 | -------------------------------------------------------------------------------- /packages/python-sdk/tests/async/sandbox_async/files/test_remove.py: -------------------------------------------------------------------------------- 1 | 2 | from e2b import AsyncSandbox 3 | 4 | 5 | async def test_remove_file(async_sandbox: AsyncSandbox): 6 | filename = "test_remove.txt" 7 | content = "This file will be removed." 8 | 9 | await async_sandbox.files.write(filename, content) 10 | 11 | await async_sandbox.files.remove(filename) 12 | 13 | exists = await async_sandbox.files.exists(filename) 14 | assert not exists 15 | 16 | 17 | async def test_remove_non_existing_file(async_sandbox: AsyncSandbox): 18 | filename = "non_existing_file.txt" 19 | await async_sandbox.files.remove(filename) 20 | -------------------------------------------------------------------------------- /packages/python-sdk/tests/async/sandbox_async/pty/test_pty_create.py: -------------------------------------------------------------------------------- 1 | from e2b import AsyncSandbox 2 | from e2b.sandbox.commands.command_handle import PtySize 3 | 4 | 5 | async def test_pty_create(async_sandbox: AsyncSandbox): 6 | output = [] 7 | 8 | def append_data(data: list, x: bytes): 9 | data.append(x.decode("utf-8")) 10 | 11 | terminal = await async_sandbox.pty.create( 12 | PtySize(80, 24), on_data=lambda x: append_data(output, x), envs={"ABC": "123"} 13 | ) 14 | 15 | await async_sandbox.pty.send_stdin(terminal.pid, b"echo $ABC\n") 16 | await async_sandbox.pty.send_stdin(terminal.pid, b"exit\n") 17 | 18 | await terminal.wait() 19 | assert terminal.exit_code == 0 20 | 21 | assert "123" in "".join(output) 22 | -------------------------------------------------------------------------------- /packages/python-sdk/tests/async/sandbox_async/pty/test_send_input.py: -------------------------------------------------------------------------------- 1 | from e2b import AsyncSandbox 2 | from e2b.sandbox.commands.command_handle import PtySize 3 | 4 | 5 | async def test_send_input(async_sandbox: AsyncSandbox): 6 | terminal = await async_sandbox.pty.create( 7 | PtySize(cols=80, rows=24), on_data=lambda x: print(x) 8 | ) 9 | await async_sandbox.pty.send_stdin(terminal.pid, b"exit\n") 10 | await terminal.wait() 11 | assert terminal.exit_code == 0 12 | -------------------------------------------------------------------------------- /packages/python-sdk/tests/async/sandbox_async/test_host.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | 3 | import httpx 4 | 5 | from e2b import AsyncSandbox 6 | 7 | 8 | async def test_ping_server(async_sandbox: AsyncSandbox, debug, helpers): 9 | cmd = await async_sandbox.commands.run( 10 | "python -m http.server 8000", 11 | background=True, 12 | ) 13 | 14 | disable = helpers.catch_cmd_exit_error_in_background(cmd) 15 | 16 | try: 17 | host = async_sandbox.get_host(8000) 18 | 19 | status_code = None 20 | async with httpx.AsyncClient() as client: 21 | for _ in range(20): 22 | res = await client.get(f"{'http' if debug else 'https'}://{host}") 23 | status_code = res.status_code 24 | if res.status_code == 200: 25 | break 26 | await asyncio.sleep(0.5) 27 | assert status_code == 200 28 | disable() 29 | finally: 30 | await cmd.kill() 31 | -------------------------------------------------------------------------------- /packages/python-sdk/tests/async/sandbox_async/test_kill.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | 3 | from e2b import AsyncSandbox 4 | 5 | 6 | @pytest.mark.skip_debug() 7 | async def test_kill(async_sandbox: AsyncSandbox): 8 | await async_sandbox.kill() 9 | 10 | list = await AsyncSandbox.list() 11 | assert async_sandbox.sandbox_id not in [s.sandbox_id for s in list] 12 | -------------------------------------------------------------------------------- /packages/python-sdk/tests/async/sandbox_async/test_timeout.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | from datetime import datetime 3 | 4 | from time import sleep 5 | 6 | from e2b import AsyncSandbox 7 | 8 | 9 | @pytest.mark.skip_debug() 10 | async def test_shorten_timeout(async_sandbox: AsyncSandbox): 11 | await async_sandbox.set_timeout(5) 12 | sleep(6) 13 | 14 | is_running = await async_sandbox.is_running() 15 | assert is_running is False 16 | 17 | 18 | @pytest.mark.skip_debug() 19 | async def test_shorten_then_lengthen_timeout(async_sandbox: AsyncSandbox): 20 | await async_sandbox.set_timeout(5) 21 | sleep(1) 22 | await async_sandbox.set_timeout(10) 23 | sleep(6) 24 | await async_sandbox.is_running() 25 | 26 | 27 | @pytest.mark.skip_debug() 28 | async def test_get_timeout(async_sandbox: AsyncSandbox): 29 | info = await async_sandbox.get_info() 30 | assert isinstance(info.end_at, datetime) 31 | -------------------------------------------------------------------------------- /packages/python-sdk/tests/sync/api_sync/test_sbx_info.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | 3 | from e2b import Sandbox 4 | 5 | 6 | @pytest.mark.skip_debug() 7 | def test_get_info(sandbox: Sandbox): 8 | info = sandbox.get_info() 9 | assert info.sandbox_id == sandbox.sandbox_id 10 | -------------------------------------------------------------------------------- /packages/python-sdk/tests/sync/api_sync/test_sbx_kill.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | 3 | from e2b import Sandbox 4 | 5 | 6 | @pytest.mark.skip_debug() 7 | def test_kill_existing_sandbox(sandbox: Sandbox): 8 | assert Sandbox.kill(sandbox.sandbox_id) 9 | 10 | list = Sandbox.list() 11 | assert sandbox.sandbox_id not in [s.sandbox_id for s in list] 12 | 13 | 14 | @pytest.mark.skip_debug() 15 | def test_kill_non_existing_sandbox(): 16 | assert not Sandbox.kill("non-existing-sandbox") 17 | -------------------------------------------------------------------------------- /packages/python-sdk/tests/sync/sandbox_sync/commands/test_cmd_connect.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | 3 | from e2b import NotFoundException 4 | 5 | 6 | def test_connect_to_process(sandbox): 7 | cmd = sandbox.commands.run("sleep 10", background=True) 8 | pid = cmd.pid 9 | 10 | process_info = sandbox.commands.connect(pid) 11 | assert process_info.pid == pid 12 | 13 | 14 | def test_connect_to_non_existing_process(sandbox): 15 | non_existing_pid = 999999 16 | 17 | with pytest.raises(NotFoundException): 18 | sandbox.commands.connect(non_existing_pid) 19 | -------------------------------------------------------------------------------- /packages/python-sdk/tests/sync/sandbox_sync/commands/test_cmd_kill.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | 3 | from e2b import Sandbox, CommandExitException 4 | 5 | 6 | def test_kill_process(sandbox: Sandbox): 7 | cmd = sandbox.commands.run("sleep 10", background=True) 8 | pid = cmd.pid 9 | 10 | sandbox.commands.kill(pid) 11 | 12 | with pytest.raises(CommandExitException): 13 | sandbox.commands.run(f"kill -0 {pid}") 14 | 15 | 16 | def test_kill_non_existing_process(sandbox): 17 | non_existing_pid = 999999 18 | 19 | assert not sandbox.commands.kill(non_existing_pid) 20 | -------------------------------------------------------------------------------- /packages/python-sdk/tests/sync/sandbox_sync/commands/test_cmd_list.py: -------------------------------------------------------------------------------- 1 | from e2b import Sandbox 2 | 3 | 4 | def test_kill_process(sandbox: Sandbox): 5 | c1 = sandbox.commands.run("sleep 10", background=True) 6 | c2 = sandbox.commands.run("sleep 10", background=True) 7 | 8 | processes = sandbox.commands.list() 9 | 10 | assert len(processes) >= 2 11 | pids = [p.pid for p in processes] 12 | assert c1.pid in pids 13 | assert c2.pid in pids 14 | -------------------------------------------------------------------------------- /packages/python-sdk/tests/sync/sandbox_sync/commands/test_env_vars.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | 3 | from e2b import Sandbox 4 | 5 | 6 | def test_command_envs(sandbox: Sandbox): 7 | cmd = sandbox.commands.run("echo $FOO", envs={"FOO": "bar"}) 8 | assert cmd.stdout.strip() == "bar" 9 | 10 | 11 | @pytest.mark.skip_debug() 12 | def test_sandbox_envs(template): 13 | sandbox = Sandbox(template, envs={"FOO": "bar"}) 14 | try: 15 | cmd = sandbox.commands.run("echo $FOO") 16 | assert cmd.stdout.strip() == "bar" 17 | finally: 18 | sandbox.kill() 19 | -------------------------------------------------------------------------------- /packages/python-sdk/tests/sync/sandbox_sync/commands/test_send_stdin.py: -------------------------------------------------------------------------------- 1 | from e2b import Sandbox 2 | 3 | 4 | def test_send_stdin_to_process(sandbox: Sandbox): 5 | cmd = sandbox.commands.run("cat", background=True) 6 | sandbox.commands.send_stdin(cmd.pid, "Hello, World!") 7 | 8 | for stdout, _, _ in cmd: 9 | assert stdout == "Hello, World!" 10 | break 11 | 12 | 13 | def test_send_special_characters_to_process(sandbox: Sandbox): 14 | cmd = sandbox.commands.run("cat", background=True) 15 | sandbox.commands.send_stdin(cmd.pid, "!@#$%^&*()_+") 16 | 17 | for stdout, _, _ in cmd: 18 | assert stdout == "!@#$%^&*()_+" 19 | break 20 | 21 | 22 | def test_send_multiline_string_to_process(sandbox: Sandbox): 23 | cmd = sandbox.commands.run("cat", background=True) 24 | sandbox.commands.send_stdin(cmd.pid, "Hello,\nWorld!") 25 | 26 | for stdout, _, _ in cmd: 27 | assert stdout == "Hello,\nWorld!" 28 | break 29 | -------------------------------------------------------------------------------- /packages/python-sdk/tests/sync/sandbox_sync/files/test_exists.py: -------------------------------------------------------------------------------- 1 | from e2b import Sandbox 2 | 3 | 4 | def test_exists(sandbox: Sandbox): 5 | filename = "test_exists.txt" 6 | 7 | sandbox.files.write(filename, "test") 8 | assert sandbox.files.exists(filename) 9 | -------------------------------------------------------------------------------- /packages/python-sdk/tests/sync/sandbox_sync/files/test_make_dir.py: -------------------------------------------------------------------------------- 1 | import uuid 2 | 3 | from e2b import Sandbox 4 | 5 | 6 | def test_make_directory(sandbox: Sandbox): 7 | dir_name = f"test_directory_{uuid.uuid4()}" 8 | 9 | sandbox.files.make_dir(dir_name) 10 | exists = sandbox.files.exists(dir_name) 11 | assert exists 12 | 13 | 14 | async def test_make_directory_already_exists(sandbox: Sandbox): 15 | dir_name = f"test_directory_{uuid.uuid4()}" 16 | 17 | created = sandbox.files.make_dir(dir_name) 18 | assert created 19 | 20 | created = sandbox.files.make_dir(dir_name) 21 | assert not created 22 | 23 | 24 | def test_make_nested_directory(sandbox: Sandbox): 25 | nested_dir_name = f"test_directory_{uuid.uuid4()}/nested_directory" 26 | 27 | sandbox.files.make_dir(nested_dir_name) 28 | exists = sandbox.files.exists(nested_dir_name) 29 | assert exists 30 | -------------------------------------------------------------------------------- /packages/python-sdk/tests/sync/sandbox_sync/files/test_read.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | from e2b import NotFoundException 3 | 4 | 5 | def test_read_file(sandbox): 6 | filename = "test_read.txt" 7 | content = "Hello, world!" 8 | 9 | sandbox.files.write(filename, content) 10 | read_content = sandbox.files.read(filename) 11 | assert read_content == content 12 | 13 | 14 | def test_read_non_existing_file(sandbox): 15 | filename = "non_existing_file.txt" 16 | 17 | with pytest.raises(NotFoundException): 18 | sandbox.files.read(filename) 19 | 20 | 21 | def test_read_empty_file(sandbox): 22 | filename = "empty_file.txt" 23 | content = "" 24 | 25 | sandbox.commands.run(f"touch {filename}") 26 | read_content = sandbox.files.read(filename) 27 | assert read_content == content 28 | -------------------------------------------------------------------------------- /packages/python-sdk/tests/sync/sandbox_sync/files/test_remove.py: -------------------------------------------------------------------------------- 1 | from e2b import Sandbox 2 | 3 | 4 | def test_remove_file(sandbox: Sandbox): 5 | filename = "test_remove.txt" 6 | content = "This file will be removed." 7 | 8 | sandbox.files.write(filename, content) 9 | 10 | sandbox.files.remove(filename) 11 | 12 | exists = sandbox.files.exists(filename) 13 | assert not exists 14 | 15 | 16 | def test_remove_non_existing_file(sandbox): 17 | filename = "non_existing_file.txt" 18 | sandbox.files.remove(filename) 19 | -------------------------------------------------------------------------------- /packages/python-sdk/tests/sync/sandbox_sync/pty/test_pty.py: -------------------------------------------------------------------------------- 1 | from e2b import Sandbox 2 | from e2b.sandbox.commands.command_handle import PtySize 3 | 4 | 5 | def test_pty(sandbox: Sandbox): 6 | def append_data(data: list, x: bytes): 7 | data.append(x.decode("utf-8")) 8 | 9 | terminal = sandbox.pty.create(PtySize(80, 24), envs={"ABC": "123"}, cwd="/") 10 | 11 | sandbox.pty.send_stdin(terminal.pid, b"echo $ABC\nexit\n") 12 | 13 | output = [] 14 | result = terminal.wait(on_pty=lambda x: append_data(output, x)) 15 | assert result.exit_code == 0 16 | 17 | assert "123" in "\n".join(output) 18 | -------------------------------------------------------------------------------- /packages/python-sdk/tests/sync/sandbox_sync/pty/test_resize.py: -------------------------------------------------------------------------------- 1 | from e2b import Sandbox 2 | from e2b.sandbox.commands.command_handle import PtySize 3 | 4 | 5 | def test_resize(sandbox: Sandbox): 6 | def append_data(data: list, x: bytes): 7 | data.append(x.decode("utf-8")) 8 | 9 | terminal = sandbox.pty.create(PtySize(cols=80, rows=24)) 10 | 11 | sandbox.pty.send_stdin(terminal.pid, b"tput cols\nexit\n") 12 | 13 | output = [] 14 | result = terminal.wait(on_pty=lambda x: append_data(output, x)) 15 | assert result.exit_code == 0 16 | 17 | assert "80" in "".join(output) 18 | 19 | terminal = sandbox.pty.create(PtySize(cols=80, rows=24)) 20 | 21 | sandbox.pty.resize(terminal.pid, PtySize(cols=100, rows=24)) 22 | sandbox.pty.send_stdin(terminal.pid, b"tput cols\nexit\n") 23 | 24 | output = [] 25 | result = terminal.wait(on_pty=lambda x: append_data(output, x)) 26 | assert result.exit_code == 0 27 | 28 | assert "100" in "".join(output) 29 | -------------------------------------------------------------------------------- /packages/python-sdk/tests/sync/sandbox_sync/pty/test_send_input.py: -------------------------------------------------------------------------------- 1 | from e2b import Sandbox 2 | from e2b.sandbox.commands.command_handle import PtySize 3 | 4 | 5 | def test_send_input(sandbox: Sandbox): 6 | terminal = sandbox.pty.create(PtySize(cols=80, rows=24)) 7 | sandbox.pty.send_stdin(terminal.pid, b"exit\n") 8 | result = terminal.wait() 9 | assert result.exit_code == 0 10 | -------------------------------------------------------------------------------- /packages/python-sdk/tests/sync/sandbox_sync/test_connect.py: -------------------------------------------------------------------------------- 1 | import uuid 2 | import pytest 3 | 4 | from e2b import Sandbox 5 | 6 | 7 | @pytest.mark.skip_debug() 8 | def test_connect(template): 9 | sbx = Sandbox(template, timeout=10) 10 | try: 11 | assert sbx.is_running() 12 | 13 | sbx_connection = Sandbox.connect(sbx.sandbox_id) 14 | assert sbx_connection.is_running() 15 | finally: 16 | sbx.kill() 17 | 18 | 19 | @pytest.mark.skip_debug() 20 | def test_connect_with_secure(template): 21 | dir_name = f"test_directory_{uuid.uuid4()}" 22 | 23 | sbx = Sandbox(template, timeout=10, secure=True) 24 | try: 25 | assert sbx.is_running() 26 | 27 | sbx_connection = Sandbox.connect(sbx.sandbox_id) 28 | 29 | sbx_connection.files.make_dir(dir_name) 30 | files = sbx_connection.files.list(dir_name) 31 | assert len(files) == 0 32 | 33 | finally: 34 | sbx.kill() 35 | -------------------------------------------------------------------------------- /packages/python-sdk/tests/sync/sandbox_sync/test_create.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | 3 | from e2b import Sandbox 4 | 5 | 6 | @pytest.mark.skip_debug() 7 | def test_start(template): 8 | sbx = Sandbox(template, timeout=5) 9 | try: 10 | assert sbx.is_running() 11 | assert sbx._envd_version is not None 12 | finally: 13 | sbx.kill() 14 | 15 | 16 | @pytest.mark.skip_debug() 17 | def test_metadata(template): 18 | sbx = Sandbox(template, timeout=5, metadata={"test-key": "test-value"}) 19 | 20 | try: 21 | sbxs = Sandbox.list() 22 | 23 | for sbx_info in sbxs: 24 | if sbx.sandbox_id == sbx_info.sandbox_id: 25 | assert sbx_info.metadata is not None 26 | assert sbx_info.metadata["test-key"] == "test-value" 27 | break 28 | else: 29 | assert False, "Sandbox not found" 30 | finally: 31 | sbx.kill() 32 | -------------------------------------------------------------------------------- /packages/python-sdk/tests/sync/sandbox_sync/test_host.py: -------------------------------------------------------------------------------- 1 | import httpx 2 | 3 | from time import sleep 4 | 5 | 6 | def test_ping_server(sandbox, debug, helpers): 7 | cmd = sandbox.commands.run("python -m http.server 8001", background=True) 8 | 9 | try: 10 | host = sandbox.get_host(8001) 11 | status_code = None 12 | for _ in range(20): 13 | res = httpx.get(f"{'http' if debug else 'https'}://{host}") 14 | status_code = res.status_code 15 | if res.status_code == 200: 16 | break 17 | sleep(0.5) 18 | 19 | assert status_code == 200 20 | except Exception as e: 21 | helpers.check_cmd_exit_error(cmd) 22 | raise e 23 | finally: 24 | cmd.kill() 25 | -------------------------------------------------------------------------------- /packages/python-sdk/tests/sync/sandbox_sync/test_kill.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | 3 | from e2b import Sandbox 4 | 5 | 6 | @pytest.mark.skip_debug() 7 | def test_kill(sandbox: Sandbox): 8 | sandbox.kill() 9 | 10 | list = Sandbox.list() 11 | assert sandbox.sandbox_id not in [s.sandbox_id for s in list] 12 | -------------------------------------------------------------------------------- /packages/python-sdk/tests/sync/sandbox_sync/test_secure.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | 3 | from e2b import Sandbox 4 | 5 | @pytest.mark.skip_debug() 6 | def test_start_secured(template): 7 | sbx = Sandbox(template, timeout=5, secure=True) 8 | try: 9 | assert sbx.is_running() 10 | assert sbx._envd_version is not None 11 | assert sbx._envd_access_token is not None 12 | finally: 13 | sbx.kill() 14 | 15 | @pytest.mark.skip_debug() 16 | def test_connect_to_secured(template): 17 | sbx = Sandbox(template, timeout=5, secure=True) 18 | try: 19 | assert sbx.is_running() 20 | assert sbx._envd_version is not None 21 | assert sbx._envd_access_token is not None 22 | 23 | sbx_connection = Sandbox.connect(sbx.sandbox_id) 24 | assert sbx_connection.is_running() 25 | assert sbx_connection._envd_version is not None 26 | assert sbx_connection._envd_access_token is not None 27 | finally: 28 | sbx.kill() 29 | -------------------------------------------------------------------------------- /packages/python-sdk/tests/sync/sandbox_sync/test_timeout.py: -------------------------------------------------------------------------------- 1 | from time import sleep 2 | from datetime import datetime 3 | 4 | import pytest 5 | 6 | 7 | @pytest.mark.skip_debug() 8 | def test_shorten_timeout(sandbox): 9 | sandbox.set_timeout(5) 10 | sleep(6) 11 | 12 | is_running = sandbox.is_running(request_timeout=5) 13 | assert is_running is False 14 | 15 | 16 | @pytest.mark.skip_debug() 17 | def test_shorten_then_lengthen_timeout(sandbox): 18 | sandbox.set_timeout(5) 19 | sleep(1) 20 | sandbox.set_timeout(10) 21 | sleep(6) 22 | sandbox.is_running() 23 | 24 | 25 | @pytest.mark.skip_debug() 26 | def test_get_timeout(sandbox): 27 | info = sandbox.get_info() 28 | assert isinstance(info.end_at, datetime) 29 | -------------------------------------------------------------------------------- /pnpm-workspace.yaml: -------------------------------------------------------------------------------- 1 | packages: 2 | - apps/* 3 | - packages/* 4 | -------------------------------------------------------------------------------- /readme-assets/e2b-sdk-dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/e2b-dev/E2B/27e292eedcf04b52b88f5729079c2eb02ae0bc9f/readme-assets/e2b-sdk-dark.png -------------------------------------------------------------------------------- /readme-assets/e2b-sdk-light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/e2b-dev/E2B/27e292eedcf04b52b88f5729079c2eb02ae0bc9f/readme-assets/e2b-sdk-light.png -------------------------------------------------------------------------------- /readme-assets/logo-circle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/e2b-dev/E2B/27e292eedcf04b52b88f5729079c2eb02ae0bc9f/readme-assets/logo-circle.png -------------------------------------------------------------------------------- /readme-assets/preview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/e2b-dev/E2B/27e292eedcf04b52b88f5729079c2eb02ae0bc9f/readme-assets/preview.png -------------------------------------------------------------------------------- /scripts/codegen.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -eu 4 | 5 | # This script is used for codegen from openapi and envd spec in a docker container 6 | # run this script from the root of the repo 7 | 8 | docker run -v "$(pwd):/workspace" $(docker build -q -t codegen-env . -f codegen.Dockerfile) 9 | -------------------------------------------------------------------------------- /scripts/update-api-spec.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -eu 4 | 5 | # This script is used to update the spec/openapi.yml file from the api repo 6 | 7 | # Check if the remote is set 8 | if [ -z "$(git remote get-url api)" ]; then 9 | git remote add api git@github.com:e2b-dev/infra.git 10 | fi 11 | 12 | # Get the current branch 13 | BRANCH=$(git rev-parse --abbrev-ref HEAD) 14 | 15 | # Fetch the latest changes 16 | git fetch api 17 | 18 | # Checkout the latest changes 19 | git checkout api/main -B temp_api_branch 20 | 21 | # Create a temporary branch to store the spec 22 | git subtree split --prefix=spec -b temp_spec_branch 23 | 24 | # Checkout the branch 25 | git checkout "$BRANCH" 26 | 27 | # Merge the changes 28 | git subtree merge --prefix=spec temp_spec_branch --squash 29 | 30 | # Remove the temporary branch 31 | git branch -D temp_spec_branch 32 | git branch -D temp_api_branch 33 | -------------------------------------------------------------------------------- /spec/envd/buf-js.gen.yaml: -------------------------------------------------------------------------------- 1 | # buf.gen.yaml defines a local generation template. 2 | # For details, see https://buf.build/docs/configuration/v1/buf-gen-yaml 3 | version: v1 4 | plugins: 5 | - plugin: es 6 | out: ../../packages/js-sdk/src/envd 7 | opt: 8 | - target=ts 9 | - plugin: connect-es 10 | out: ../../packages/js-sdk/src/envd 11 | opt: 12 | - target=ts 13 | 14 | managed: 15 | enabled: true 16 | optimize_for: SPEED 17 | -------------------------------------------------------------------------------- /spec/envd/buf-python.gen.yaml: -------------------------------------------------------------------------------- 1 | # buf.gen.yaml defines a local generation template. 2 | # For details, see https://buf.build/docs/configuration/v1/buf-gen-yaml 3 | version: v1 4 | plugins: 5 | - plugin: python 6 | out: ../../packages/python-sdk/e2b/envd 7 | opt: 8 | - pyi_out=../../packages/python-sdk/e2b/envd 9 | - name: connect-python 10 | out: ../../packages/python-sdk/e2b/envd 11 | path: /go/bin/protoc-gen-connect-python 12 | 13 | managed: 14 | enabled: true 15 | optimize_for: SPEED 16 | -------------------------------------------------------------------------------- /supabase/.gitignore: -------------------------------------------------------------------------------- 1 | # Supabase 2 | .branches 3 | .temp 4 | -------------------------------------------------------------------------------- /templates/base/e2b.toml: -------------------------------------------------------------------------------- 1 | # This is a config for E2B sandbox template. 2 | # You can use template ID (rki5dems9wqfm4r03t7g) or template name (base) to create a sandbox: 3 | 4 | # Python SDK 5 | # from e2b import Sandbox, AsyncSandbox 6 | # sandbox = Sandbox("base") # Sync sandbox 7 | # sandbox = await AsyncSandbox.create("base") # Async sandbox 8 | 9 | # JS SDK 10 | # import { Sandbox } from 'e2b' 11 | # const sandbox = await Sandbox.create('base') 12 | 13 | team_id = "460355b3-4f64-48f9-9a16-4442817f79f5" 14 | memory_mb = 512 15 | dockerfile = "e2b.Dockerfile" 16 | template_name = "base" 17 | template_id = "rki5dems9wqfm4r03t7g" 18 | --------------------------------------------------------------------------------