Open-source, secure environment with real-world tools for enterprise-grade agents.
Python agentaiai-agentai-agentscode-interpretercopilotdevelopmentdevtoolsgptgpt-4javascriptllmnextjsopenaipythonreactsoftwaretypescript
Add development readme instruction for JS SDK
Tomas Valenta7c529ee13d72
diff --git a/README.md b/README.mdindex 85317787e..f73018a81 100644--- a/README.md+++ b/README.md@@ -48,6 +48,7 @@ tools as humans do. For example:---### Code interpreter SDK+We have built a [dedicated SDK](https://github.com/e2b-dev/code-interpreter) for building custom code interpreters in your AI apps. It's build on top of E2B and our core E2B SDK.### Getting started & documentation@@ -110,3 +111,40 @@ This repository is a monorepo containing:1. [JS SDK](/packages/js-sdk)1. [CLI](/packages/cli)1. [Documentation](/apps/web/)++## Development++### Generating API clients used by SDKs++Install the following dependencies:++- [Buf CLI](https://buf.build/docs/installation)+- `npm i @connectrpc/protoc-gen-connect-es @bufbuild/protoc-gen-es -g`++#### Generating clients++To generate clients from the [API definitions](./spec/) run the commands from the top level [`Makefile`](./Makefile) after updating the API definitions according to the changes in the definitions from the [infra repo](https://github.com/e2b-dev/infra).++To generate JS & TS clients run:++```bash+make generate-js+```++To generate Python clients run:++```bash+make generate-python+```++This will generate clients for both SDKs from the following specs:++- E2B OpenAPI spec (used for managing sandboxes)+ - [Location in infra repo](https://github.com/e2b-dev/infra/blob/main/spec/openapi.yml)+ - [Location in E2B repo](./spec/openapi.yml)+- E2B envd [ConnectRPC API](https://connectrpc.com/) spec (used for interacting with the sandbox)+ - [Location in infra repo](https://github.com/e2b-dev/infra/blob/main/packages/envd/spec)+ - [Location in E2B repo](./spec/envd)+- E2B envd REST API (used for specific interactions with the sandbox like file upload/download)+ - [Location in infra repo](https://github.com/e2b-dev/infra/blob/main/packages/envd/spec/envd.yaml)+ - [Location in E2B repo](./spec/envd/envd.yaml)diff --git a/packages/js-sdk/README.md b/packages/js-sdk/README.mdindex 83402e5e1..ff7ee6edd 100644--- a/packages/js-sdk/README.md+++ b/packages/js-sdk/README.md@@ -71,3 +71,34 @@ const sandbox = await Sandbox.create();// Close sandbox once doneawait sandbox.close();```++## Development++You can use the SDK with a locally running [`envd`](https://github.com/e2b-dev/infra/blob/main/packages/envd) (that usually runs inside the sandbox and allows the SDK to interact with it) by passing `E2B_DEBUG=true` to `.env` or by using `debug: true` in the `Sandbox.create` or `Sandbox.connect` method options.++### Install dependencies++```bash+pnpm install+```++### Generating API clients used by SDK++Check out top-level [README](../../README.md#generating-clients).++The API clients are not automatically publicly accessible from the SDK — we are doing some additional work to make the experience of using the APIs better by providing a more user-friendly interface.++### Building++For development, you can run the following command to build the SDK on every change:++```bash+pnpm dev+```++### Testing++Use `pnpm test` to run the test suite or `pnpm example` to run the example code.+Pass `E2B_DEBUG=true` to `.env` to run against the locally running envd (usually run via Docker).++> When running with a local environment the environment is not cleaned up after every test run as when running the test againts production. This might lead to some issues when running the tests multiple times and it is good to keep in mind.