Open-source, secure environment with real-world tools for enterprise-grade agents.
Python agentaiai-agentai-agentscode-interpretercopilotdevelopmentdevtoolsgptgpt-4javascriptllmnextjsopenaipythonreactsoftwaretypescript
Prepare new docs navigation [WIP]
Vasek Mlejnsky9e0721cc8506
diff --git a/apps/web/src/app/(docs)/docs/legacy/api/cli/page.tsx b/apps/web/src/app/(docs)/docs/legacy/api/cli/page.tsxnew file mode 100644index 000000000..3b497e0b3--- /dev/null+++ b/apps/web/src/app/(docs)/docs/legacy/api/cli/page.tsx@@ -0,0 +1,161 @@+'use client'++import Link from 'next/link'+import { useSearchParams } from 'next/navigation'+import { useApiKey, useUser } from '@/utils/useUser'+import { DialogAnimated } from '@/components/DialogAnimated'+import { CloudIcon, LaptopIcon, Link2Icon } from 'lucide-react'+import { Button } from '@/components/Button'+import { usePostHog } from 'posthog-js/react'+import { Suspense, useEffect } from 'react'++type UserConfig = {+ email: string;+ accessToken: string;+ defaultTeamApiKey: string;+ defaultTeamId: string;+}++export default function Page() {+ const posthog = usePostHog()+ const { user, isLoading: userIsLoading } = useUser()+ const apiKey = useApiKey()++ useEffect(+ function sendAuthorizationStartAnalytics() {+ posthog?.capture('opened CLI authorization page')+ },+ [posthog]+ )++ return (+ <div>+ {/* It's not easy to override RootLayout without grouping everything into `(root)` dir */}+ {/* So I'm hacking a custom layout with full modal overlay */}+ {/* https://github.com/vercel/next.js/issues/50591 */}+ <DialogAnimated+ open={true}+ setOpen={() => {}} // intentionally prevent closing+ >+ <div className="py-6 sm:py-12">+ <div className="mx-auto px-6 lg:px-8">+ <div className="mx-auto sm:text-center">+ <p+ className="+ flex items-center justify-center gap-4+ text-3xl font-bold tracking-tight sm:text-4xl+ "+ >+ <span className="text-gray-200">+ <LaptopIcon size={60} />+ </span>+ <span className="text-gray-400">+ <Link2Icon size={30} />+ </span>+ <span className="text-gray-200">+ <CloudIcon size={60} />+ </span>+ </p>+ <h2 className="mt-6 text-base font-semibold leading-7">+ Linking CLI with your account+ </h2>+ <Suspense>+ <AuthState+ user={user}+ apiKey={apiKey}+ posthog={posthog}+ userIsLoading={userIsLoading}+ />+ </Suspense>+ </div>+ </div>+ </div>+ </DialogAnimated>+ </div>+ )+}++function AuthState({ user, apiKey, posthog, userIsLoading }) {+ const searchParams = useSearchParams()+ const searchParamsObj = searchParams ? Object.fromEntries(searchParams) : {}+ const { next, state } = searchParamsObj++ // TODO: Consider sending back onetime code to be used to get access token+ function redirectToCLI() {+ if (!next) return+ if (!(user?.email && apiKey)) return++ posthog?.capture('started CLI authorization', { email: user.email })++ const { email, accessToken, defaultTeamId } = user+ const newUrl = new URL(next)+ const searchParamsObj: UserConfig = {+ email,+ defaultTeamApiKey: apiKey,+ accessToken,+ defaultTeamId,+ }+ newUrl.search = new URLSearchParams(searchParamsObj).toString()+ window.location.href = newUrl.toString()+ }++ useEffect(+ function sendAuthorizationAnalytics() {+ if (state === 'success') {+ posthog?.capture('successfully authorized CLI')+ } else if (state === 'error') {+ posthog?.capture('failed to authorize CLI', {+ error: searchParamsObj.error,+ })+ }+ },+ [state, posthog, searchParamsObj.error]+ )++ let content+ if (state === 'error') {+ content = (+ <>+ <div className="font-bold text-red-500">Error</div>+ <div>Something went wrong, please try again</div>+ <pre>{searchParamsObj.error}</pre>+ {/* TODO: Nicer, but it should never happen */}+ </>+ )+ } else if (state === 'success') {+ content = (+ <>+ <div className="font-bold text-brand-400">Successfully linked</div>+ <div>You can close this page and start using CLI.</div>+ </>+ )+ } else {+ const isNextValid = next.startsWith('http://localhost')+ if (!isNextValid) {+ content = (+ <>+ <div className="font-bold text-red-500">Error</div>+ <div>Invalid redirect URL, only localhost is allowed</div>+ </>+ )+ } else if (userIsLoading) {+ content = <span className="text-gray-300">Loading, please wait</span>+ } else if (!user) {+ content = (+ <Link href="/auth/sign-in">+ <Button>Sign In to continue</Button>+ </Link>+ )+ } else {+ content = (+ <>+ <Button onClick={() => redirectToCLI()}>+ Authorize CLI to use your account+ </Button>+ </>+ )+ }+ }++ return <p className="mt-12 leading-8">{content}</p>+}diff --git a/apps/web/src/app/(docs)/docs/legacy/cli/commands/page.mdx b/apps/web/src/app/(docs)/docs/legacy/cli/commands/page.mdxnew file mode 100644index 000000000..6397c7fcd--- /dev/null+++ b/apps/web/src/app/(docs)/docs/legacy/cli/commands/page.mdx@@ -0,0 +1,318 @@+# CLI Commands++Build your sandbox with our CLI. {{ className: 'lead' }}++<Note>+You can use `--help` flag for more information about commands.+</Note>++---++# Auth++<br/>++## `auth login`++Log in to the CLI. It will save your access token in `~/.e2b` file.++```bash+e2b auth login+```++## `auth logout`++Log out of the CLI. It will remove your access token from `~/.e2b` file.++```+e2b auth logout+```++## `auth configure`++Configure the default team for the CLI. It will be used for all commands that require a team.++```bash+e2b auth configure+```++## `auth info`++Get info about your current user.++```+e2b auth info+```++---++# Templates++<br/>++## `template init`++Creates a basic Dockerfile (`./e2b.Dockerfile`) in current directory.+You can then run `e2b template build` to build sandbox template from this Dockerfile.++```bash+e2b template init+```++#### **Options**++<Options>+ <Option name="path" type="-p, --path">+ Change the root directory where the command is executed to `path` directory.+ </Option>+</Options>+++## `template build`++Builds a sandbox template defined by `./e2b.Dockerfile` or `./Dockerfile` from the root directory.+By default, the root directory is the current working directory.+This command also creates the `e2b.toml` config.++```bash+e2b template build+```++<Note>+Running `e2b template build` without specifying a template with the `[template]` argument will rebuild template defined by the `e2b.toml` config.++If there is no `e2b.toml` config a new template will be created.+</Note>++#### **Arguments**++<Options>+ <Option type="[template]">+ Specify the template you want to rebuild. You can use the template name or ID.+ </Option>+</Options>+++#### **Options**++<Options>+ <Option type="-c, --cmd" name="start-command">+ Specify the command that should be running when a sandbox starts.+ </Option>+ <Option type="--config" name="e2b-toml">+ Specify the path to the config file. By default, E2B tries to find `e2b.toml` in the root directory.+ </Option>+ <Option type="-n, --name" name="template-name">+ Specify the name of the sandbox template. You can use the template name to start the sandbox in the SDK. The name must be lowercase and contain only letters, numbers, dashes, and underscores.+ </Option>+ <Option type="-p, --path" name="path">+ Change the root directory where the command is executed to the `path` directory.+ </Option>+ <Option type="-d, --dockerfile" name="dockerfile">+ Specify the path to Dockerfile. By default E2B tries to find `e2b.Dockerfile` or `Dockerfile` in the root directory.+ </Option>+ <Option type="-t, --team" name="team">+ Specify the team that will be used for the sandbox template. You can find team ID in the team settings in the [E2B dashboard](https://e2b.dev/dashboard?tab=team).+ </Option>+ <Option type="--cpu-count" name="cpu-count">+ Specify the number of CPUs that will be used to run the sandbox. The default value is 2.+ </Option>+ <Option type="--memory-mb" name="memory-mb">+ Specify the amount of memory in megabytes that will be used to run the sandbox. Must be an even number. The default value is 512.+ </Option>+ <Option type="--build-arg" name="build-arg">+ Specify a build argument for the Dockerfile. The format is `key=value`. You can use this option multiple times.+ </Option>+</Options>++## `template delete`++Delete the sandbox template specified by the `[template]` argument, `e2b.toml` config in the working directory, or by an interactive selection.+By default, the root directory is the current working directory.++This command also deletes the `e2b.toml` config.++```bash+e2b template delete+```++<Note>+Running `e2b template delete` without specifying a template with the `[template]` argument will delete the template defined by the `e2b.toml` config.+</Note>++#### **Arguments**++<Options>+ <Option type="[template]">+ Specify the template you want to delete. You can use the template name or ID.+ </Option>+</Options>+++#### **Options**++<Options>+ <Option type="-p, --path" name="path">+ Change the root directory where the command is executed to the `path` directory.+ </Option>+ <Option type="--config" name="e2b-toml">+ Specify the path to the config file. By default, E2B tries to find `e2b.toml` in the root directory.+ </Option>+ <Option type="-s, --select">+ Interactively select sandbox templates you want to delete.+ </Option>+ <Option type="-y, --yes">+ Don't ask for confirmation before deleting the sandbox template.+ </Option>+ <Option type="-t, --team" name="team">+ Specify the team that will be used for the sandbox template. You can find team ID in the team settings in the [E2B dashboard](https://e2b.dev/dashboard?tab=team).+ </Option>+</Options>+++## `template list`++List your sandbox templates.++```bash+e2b template list+```++#### **Options**++<Options>+ <Option type="-t, --team" name="team">+ Specify the team that will be used for the sandbox template. You can find team ID in the team settings in the [E2B dashboard](https://e2b.dev/dashboard?tab=team).+ </Option>+</Options>+++---++# Sandboxes++<br/>++## `sandbox list`++List your spawned sandboxes that are running right now.++```bash+e2b sandbox list+```+++## `sandbox logs`+Starts printing logs from the specified sandbox.+If the sandbox is running new logs will be streamed to the terminal.++The timestamps are in the UTC format.++This command is useful if you need to debug a running sandbox or check logs from a sandbox that was already closed.++```bash+e2b sandbox logs <sandboxID>+```++<Note>+You can use `e2b sandbox list` to get a list of running sandboxes and their IDs that can be used with `e2b sandbox logs <sandboxID>` command.+</Note>++#### **Arguments**++<Options>+ <Option type="<sandboxID>">+ Specify the ID of the sandbox you want to get logs from.+ </Option>+</Options>++#### **Options**++<Options>+ <Option name="level" type="--level">+ Filter logs by level — allowed values are `DEBUG`, `INFO`, `WARN`, `ERROR`.+ The logs with the higher levels will be also shown.++ Default value is `DEBUG`.+ </Option>+ <Option type="-f, --follow">+ Enable streaming logs until the sandbox is closed.+ </Option>+ <Option name="format" type="--format">+ Specify format for printing logs — allowed values are `pretty`, `json`.++ Default value is `pretty`.+ </Option>+ <Option name="loggers" type="--loggers">+ Specify enabled loggers — allowed values are `process`, `filesystem`, `terminal`, `network` and `file`.+ You can specify multiple loggers by separating them with a comma.++ Default value is `process,filesystem`.+ </Option>+</Options>++## `sandbox connect`++Connects your terminal to a running sandbox that you spawned via the E2B SDK.+This command is useful if you need to debug a running sandbox.++This command works similar to the `docker exec -it <container> bash` command in Docker.++```bash+e2b sandbox connect <sandboxID>+```++<Note>+You can use `e2b sandbox list` to get a list of running sandboxes and their IDs that can be used with `e2b sandbox connect <sandboxID>` command.+</Note>++#### **Arguments**++<Options>+ <Option type="<sandboxID>">+ Specify the ID of a running sandbox you want to connect to.+ </Option>+</Options>++## `sandbox spawn`++Spawns a sandbox and connects your terminal to the sandbox.+This command can be used to debug your sandbox template.++This command works similar to the `docker run -it <image> bash` command in Docker.++```bash+e2b sandbox spawn+```++<Note>+Running `e2b sandbox spawn` without specifying a template with the `[template]` argument will spawn sandbox defined by the `e2b.toml` config.+</Note>++#### **Arguments**++<Options>+ <Option type="[template]">+ Specify the template you want to spawn sandbox from. You can use the template name or ID.+ </Option>+</Options>+++#### **Options**++<Options>+ <Option name="path" type="-p, --path">+ Change the root directory where the command is executed to `path` directory.+ </Option>+ <Option type="--config" name="e2b-toml">+ Specify the path to the config file. By default, E2B tries to find `e2b.toml` in the root directory.+ </Option>+</Options>++## `sandbox kill`++Immediately kill a running sandbox.++```bash+e2b sandbox kill <sandboxID>+```diff --git a/apps/web/src/app/(docs)/docs/legacy/cli/installation/page.mdx b/apps/web/src/app/(docs)/docs/legacy/cli/installation/page.mdxnew file mode 100644index 000000000..2cbfbc284--- /dev/null+++ b/apps/web/src/app/(docs)/docs/legacy/cli/installation/page.mdx@@ -0,0 +1,22 @@+# Installation++You build and manage sandbox templates with our CLI. {{ className: 'lead' }}++The CLI is distributed as an [NPM package](https://www.npmjs.com/package/e2b).++## Download CLI++You can install the CLI with following command:++```bash+npm install -g @e2b/cli@latest+```++## Login++You'll need to login to your account to start using the CLI.+You'll be redirected to the browser after running the following command to finish the login.++```bash+e2b auth login+```\ No newline at end of filediff --git a/apps/web/src/app/(docs)/docs/legacy/code-interpreter/examples/page.mdx b/apps/web/src/app/(docs)/docs/legacy/code-interpreter/examples/page.mdxnew file mode 100644index 000000000..0740a3fe2--- /dev/null+++ b/apps/web/src/app/(docs)/docs/legacy/code-interpreter/examples/page.mdx@@ -0,0 +1,144 @@+# Examples++Here are some examples of how to use the E2B Code Interpreter package. If you are missing something, please let us know.++## Minimal example with the sharing context++The following example demonstrates how to create a shared context between multiple code executions. This is useful when you want to share variables between different code cells.++<CodeGroup isRunnable={false}>+```js+import { CodeInterpreter } from '@e2b/code-interpreter'++const sandbox = await CodeInterpreter.create()+await sandbox.notebook.execCell('x = 1')++const execution = await sandbox.notebook.execCell('x+=1; x')+console.log(execution.text) // outputs 2++await sandbox.close()+```+```python+from e2b_code_interpreter import CodeInterpreter++with CodeInterpreter() as sandbox:+ sandbox.notebook.exec_cell("x = 1")++ execution = sandbox.notebook.exec_cell("x+=1; x")+ print(execution.text) # outputs 2++```+</CodeGroup>++## Get charts and any display-able data++<CodeGroup isRunnable={false}>+```js+import { CodeInterpreter } from '@e2b/code-interpreter'++const sandbox = await CodeInterpreter.create()++const code = `+import matplotlib.pyplot as plt+import numpy as np++x = np.linspace(0, 20, 100)+y = np.sin(x)++plt.plot(x, y)+plt.show()+`;++// you can install dependencies in "jupyter notebook style"+await sandbox.notebook.execCell("!pip install matplotlib")++const execution = await sandbox.notebook.execCell(code)++// this contains the image data, you can e.g. save it to file or send to frontend+execution.results[0].png++await sandbox.close()+```+```python+import base64+import io++from matplotlib import image as mpimg, pyplot as plt++from e2b_code_interpreter import CodeInterpreter++code = """+import matplotlib.pyplot as plt+import numpy as np++x = np.linspace(0, 20, 100)+y = np.sin(x)++plt.plot(x, y)+plt.show()+"""++with CodeInterpreter() as sandbox:+ # you can install dependencies in "jupyter notebook style"+ sandbox.notebook.exec_cell("!pip install matplotlib")++ # plot random graph+ execution = sandbox.notebook.exec_cell(code)++# there's your image+image = execution.results[0].png++# example how to show the image / prove it works+i = base64.b64decode(image)+i = io.BytesIO(i)+i = mpimg.imread(i, format='PNG')++plt.imshow(i, interpolation='nearest')+plt.show()+```+</CodeGroup>++## Streaming code output++<CodeGroup isRunnable={false}>+```js+import { CodeInterpreter } from "@e2b/code-interpreter";++code = `+import time+import pandas as pd++print("hello")+time.sleep(3)+data = pd.DataFrame(data=[[1, 2], [3, 4]], columns=["A", "B"])+display(data.head(10))+time.sleep(3)+print("world")+`++const sandbox = await CodeInterpreter.create()++await sandbox.notebook.execCell(code, {+ onStdout: (out) => console.log(out),+ onStderr: (outErr) => console.error(outErr),+ onResult: (result) => console.log(result.text)+})+````+```python+from e2b_code_interpreter import CodeInterpreter++code = """+import time+import pandas as pd++print("hello")+time.sleep(3)+data = pd.DataFrame(data=[[1, 2], [3, 4]], columns=["A", "B"])+display(data.head(10))+time.sleep(3)+print("world")+"""+with CodeInterpreter() as sandbox:+ sandbox.notebook.exec_cell(code, on_stdout=print, on_stderr=print, on_result=(lambda result: print(result.text)))+```+</ CodeGroup>diff --git a/apps/web/src/app/(docs)/docs/legacy/code-interpreter/execution/page.mdx b/apps/web/src/app/(docs)/docs/legacy/code-interpreter/execution/page.mdxnew file mode 100644index 000000000..7dee1435f--- /dev/null+++ b/apps/web/src/app/(docs)/docs/legacy/code-interpreter/execution/page.mdx@@ -0,0 +1,195 @@+import Link from 'next/link'++# Code Execution++You can execute code using the notebook module, using the `execCell` method. The method takes a string of code as an argument and returns an object with the results of the execution.++<CodeGroup isRunnable={false}>+```js+import { CodeInterpreter } from '@e2b/code-interpreter'++const code = 'print("Hello, World!")'++const sandbox = CodeInterpreter.create()+const execution = await sandbox.notebook.execCell(code)+```++```python+from e2b_code_interpreter import CodeInterpreter++code = "print('Hello, World!')"++sandbox = CodeInterpreter.create()+execution = sandbox.notebook.exec_cell(code)+```+</CodeGroup>++The `execCell` method also accepts following optional arguments:+- `kernel id`: The ID of the kernel to execute the code on. If not provided, the default kernel is used. See <Link href="/code-interpreter/kernels">here</Link> for more info on kernels.+- `on stdout`: A callback function to handle standard output messages from the code execution.+- `on_stderr`: A callback function to handle standard error messages from the code execution.+- `on_result`: A callback function to handle the result and display calls of the code execution.++## Streaming response++You can use the `on_*` callbacks to handle the output of the code execution as it happens. This is useful for long-running code. You can stream the output to the user as it is generated.++## Execution object++The object returned by the `exec cell` method is little bit more complex, it's based on Jupyter. Here's an detailed explanation in the [Jupyter documentation](https://jupyter-client.readthedocs.io/en/stable/messaging.html).++It contains the following fields:++- `results`: A list containing result of the cell (interactively interpreted last line) and display calls (e.g. matplotlib plots).+- `logs`: Logs printed to stdout and stderr during execution.+- `error`: An error message, if there was an error during execution of the cell. It works only for Python code, not for system (`!` e.g `!pip install e2b`) commands.++### Result object++This object can be created in two different ways:+- Evaluation of the last line: If the last line of the code is an expression, the result is the value of that expression. As you would expect in REPL environments.+- Display calls: Calls to display functions, which can be used to display rich output in the notebook. E.g. [`img.show()`](https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.show.html), [`display(img)`](https://ipython.readthedocs.io/en/stable/api/generated/IPython.display.html), etc.++Represents the data to be displayed as a result of executing a cell in a Jupyter notebook.+The result is similar to the structure returned by [ipython kernel](https://ipython.readthedocs.io/en/stable/development/execution.html#execution-semantics)++The result can contain multiple types of data, such as text, images, plots, etc. Each type of data is represented+as a string, and the result can contain multiple types of data. The display calls don't have to have text representation, it's always present for the actual result,+the other representations are optional.++The result has those basic data types:++#### Text types:+- `text`: text representation of the result+- `html`: html representation of the result+- `markdown`: markdown representation of the result+- `latex`: latex representation of the result++#### Image types:+ - `png`: "base64 encoded png image",+ - `jpeg`: "base64 encoded jpeg image",+ - `svg`": "svg image",++#### Other types:+ - `json`: "json representation",+ - `javascript`: "javascript representation",+ - `pdf`: "base64 encoded pdf"++<Note>+ If you want to integrate your own display formats or how to implement them for your classes, you can read more in [here](https://github.com/ipython/ipython/blob/main/examples/IPython%20Kernel/Custom%20Display%20Logic.ipynb)+</Note>++### Logs object++Logs printed to stdout and stderr during execution. Examples of logs are print statements, warnings, subprocess output, etc.++It contains two fields:+- `stdout`: List of strings, each string is a line printed to stdout.+- `stderr`: List of strings, each string is a line printed to stderr.++### Error object++An error message, if there was an error during execution of the cell.+<Note>+ It works only for Python code, not for system (e.g. `!pip install non_existent_package`) commands. The system commands are executed in a separate process and the output is in stdout/stderr.+</Note>++It contains three fields:+- `name`: Name of the error, e.g. `NameError`, `ValueError`, etc.+- `value`: Value of the error, e.g. `name 'non_existent_variable' is not defined`, etc.+- `traceback`: Traceback of the error.+++## Example how to interpret the results to LLM++Here's an example how to return the results to LLM:++<CodeGroup isRunnable={false}>+```js+const code = '<CODE GENERATED BY LLM>'+const execution = await sandbox.notebook.execCell(code)++// There was an error during execution, return the error and its traceback+if (execution.error) {+ return `There was an error during execution: ${execution.error.name}: ${execution.error.value}.\n+ ${execution.error.traceback}`+}++// The execution has some result, summarize to LLM, what are the results+if (execution.results.length > 0) {+ let message = 'These are results of the execution:\n'+ let counter = 1+ for (const result of execution.results) {+ message += `Result ${counter++}:\n`+ if (result.isMainResult) {+ message += `[Main result]: ${result.text}\n`+ } else {+ message += `[Display data]: ${result.text}\n`+ }+ if (result.formats().length > 0) {+ message += `It has following formats: ${result.formats()}\n`+ }+ }++ return message+}++// There were no results, check if there was something is stdout/err+if (+ execution.logs.stdout.length > 0 ||+ execution.logs.stderr.length > 0+) {+ let message = 'There was no result of the execution, but here are the logs:\n'+ if (execution.logs.stdout.length > 0) {+ message += `Stdout: ${execution.logs.stdout.join('\n')}\n`+ }+ if (execution.logs.stderr.length > 0) {+ message += `Stderr: ${execution.logs.stderr.join('\n')}\n`+ }++ return message+}++return 'There was no output of the execution.'+```++```python+code = "<CODE GENERATED BY LLM>"+execution = sandbox.notebook.exec_cell(code)++# There was an error during execution, return the error and its traceback+if execution.error:+ return (+ f"There was an error during execution: {execution.error.name}: {execution.error.value}.\n"+ f"{execution.error.traceback}"+ )++# The execution has some result, summarize to LLM, what are the results+if execution.results:+ message = "These are results of the execution:\n"+ for i, result in enumerate(execution.results):+ message += f"Result {i + 1}:\n"+ if result.is_main_result:+ message += f"[Main result]: {result.text}\n"+ else:+ message += f"[Display data]: {result.text}\n"++ if result.formats():+ message += f"It has also following formats: {result.formats()}\n"++ return message++# There were no results, check if there was something is stdout/err+if execution.logs.stdout or execution.logs.stderr:+ message = "There was no result of the execution, but here are the logs:\n"+ if execution.logs.stdout:+ message += "Stdout: " + "\n".join(execution.logs.stdout) + "\n"++ if execution.logs.stderr:+ message += "Stderr: " + "\n".join(execution.logs.stderr) + "\n"++ return message++return "There was no output of the execution."+```+</CodeGroup>diff --git a/apps/web/src/app/(docs)/docs/legacy/code-interpreter/installation/page.mdx b/apps/web/src/app/(docs)/docs/legacy/code-interpreter/installation/page.mdxnew file mode 100644index 000000000..5408877d9--- /dev/null+++ b/apps/web/src/app/(docs)/docs/legacy/code-interpreter/installation/page.mdx@@ -0,0 +1,54 @@+# Code Interpreter SDK+E2B's [Code Interpreter SDK](https://github.com/e2b-dev/code-interpreter) allows you to add code interpreting capabilities to your AI apps.++The code interpreter runs inside the [E2B Sandbox](https://github.com/e2b-dev/e2b) - an open-source secure sandbox made for running untrusted AI-generated code and AI agents.+- ✅ Works with any LLM and AI framework+- ✅ Supports streaming content like charts and stdout, stderr+- ✅ Python & JS SDK+- ✅ Runs on serverless and edge functions+- ✅ Runs AI-generated code in secure sandboxed environments+- ✅ 100% open source (including [infrastructure](https://github.com/e2b-dev/infra))++## Quickstart++### 1. Install SDK++JavaScript/TypeScript+```+npm i @e2b/code-interpreter+```++Python+```+pip install e2b_code_interpreter+```++### 2. Execute code with code interpreter inside sandbox++**JavaScript**+```ts+import { CodeInterpreter } from '@e2b/code-interpreter'++const sandbox = await CodeInterpreter.create()+await sandbox.notebook.execCell('x = 1')++const execution = await sandbox.notebook.execCell('x+=1; x')+console.log(execution.text) // outputs 2++await sandbox.close()+```++**Python**+```py+from e2b_code_interpreter import CodeInterpreter++with CodeInterpreter() as sandbox:+ sandbox.notebook.exec_cell("x = 1")++ execution = sandbox.notebook.exec_cell("x+=1; x")+ print(execution.text) # outputs 2+```++### 3. Hello World guide+Dive depeer and check out the [JavaScript](/docs/hello-world/js) and [Python](/docs/hello-world/py) the Hello World guides to learn how o connect code interpreter LLMs.+diff --git a/apps/web/src/app/(docs)/docs/legacy/code-interpreter/kernels/page.mdx b/apps/web/src/app/(docs)/docs/legacy/code-interpreter/kernels/page.mdxnew file mode 100644index 000000000..d6ed0bfa4--- /dev/null+++ b/apps/web/src/app/(docs)/docs/legacy/code-interpreter/kernels/page.mdx@@ -0,0 +1,27 @@+import Link from 'next/link'++# Kernels++In this section you can find information about kernels and how to use them in Code Interpreter SDK. Having multiple kernels allows you to run code in separate contexts and optionally also languages.++By default the template starts with one default kernel. This kernel is used to execute code, if you don't specify `kernelID`. You can imagine kernel as a separate environment where code is executed. You can have multiple kernels running at the same time. Each kernel has its own state, so you can have multiple kernels running different code at the same time.++Kernel will be kept alive with the sandbox even if you disconnect.++## Creating a new kernel++To create a new kernel there's a `create_kernel` in Python and `createKernel()` in JavaScript/TypeScript method in the `CodeInterpreter` class. This method takes two optional arguments:+- `cwd` - working directory for the kernel, all system commands and file operations will be executed in this directory+- `kernel name` - kernel spec name (defaults to default kernel spec for server). In our case it's `python3`. If you want to use another kernel, you have to install in the template first. In that case you probably want to use <Link href='/code-interpreter/template'>Custom Template</Link>.++## Restarting a kernel++To restart a kernel you can use `restart` method. This method takes one argument - `kernelID`, if not specifed it will restart the default kernel. This method will restart the kernel and clear its state.++## Listing kernels++To list all kernels you can use `list` method. This method returns an array of all running kernels with their IDs and kernel spec names.++## Shutting down a kernel++To shutdown a kernel you can use `shutdown` method. This method takes one argument - `kernelID`, if not specifed it will delete the default kernel. This method will delete the kernel and all its state.diff --git a/apps/web/src/app/(docs)/docs/legacy/code-interpreter/template/page.mdx b/apps/web/src/app/(docs)/docs/legacy/code-interpreter/template/page.mdxnew file mode 100644index 000000000..5e713bda9--- /dev/null+++ b/apps/web/src/app/(docs)/docs/legacy/code-interpreter/template/page.mdx@@ -0,0 +1,58 @@+import Link from 'next/link'+import { FileCode } from 'lucide-react'++# Using custom sandbox template & custom compute with Code Interpreter SDK++If you want to customize the Code Interprerter sandbox (e.g.: add a preinstalled package) you can do that by using a [custom sandbox template](https://e2b.dev/docs/sandbox/templates/overview).+++## Step-by-step guide+1. Create custom sandbox by following [this guide](https://e2b.dev/docs/guide/custom-sandbox)++2. Use prebuilt [E2B Code Interpreter image](https://hub.docker.com/r/e2bdev/code-interpreter) by replacing the `FROM` command in your `e2b.Dockerfile` with following++ ```sh+ FROM e2bdev/code-interpreter:latest+ ```++3. Run the following in the same directory where's your `e2b.toml`+ ```sh+ e2b template build -c "/root/.jupyter/start-up.sh"+ ```++4. Use your custom sandbox with Code Interpreter SDK++ **Python**+ ```python+ from e2b_code_interpreter import CodeInterpreter+ sandbox = CodeInterpreter(template="your-custom-sandbox-name")+ execution = sandbox.notebook.exec_cell("print('hello')")+ sandbox.close()++ # Or you can use `with` which handles closing the sandbox for you+ with CodeInterpreter(template="your-custom-sandbox-name") as sandbox:+ execution = sandbox.notebook.exec_cell("print('hello')")+ ```+++ **JavaScript/TypeScript**+ ```js+ import { CodeInterpreter } from '@e2b/code-interpreter'+ const sandbox = await CodeInterpreter.create({ template: 'your-custom-sandbox-name' })+ const execution = await sandbox.notebook.execCell('print("hello")')+ await sandbox.close()+ ```+++## Customize CPU & RAM of your sandbox+You can customize number of CPUs and MiB of RAM for your sandbox. To achieve that, specify the `--cpu-count` and `--memory-mb` options during the build step:+```sh+e2b template build -c "/home/user/.jupyter/start-up.sh" --cpu-count 4 --memory-mb 4096+```+The above will create a custom sandbox with 4 CPUs a 4 GiB of RAM.++## How to install another Python kernels++Jupyter has ability to work with different than Python kernel. It even supports multiple kernels in one notebook. If you want to install another kernels.++You can find list of available kernels [here](https://github.com/jupyter/jupyter/wiki/Jupyter-kernels). Each has a little bit different installation process, but in general you need to install kernel package and register it in jupyter.diff --git a/apps/web/src/app/(docs)/docs/legacy/examples/clone-repo/page.mdx b/apps/web/src/app/(docs)/docs/legacy/examples/clone-repo/page.mdxnew file mode 100644index 000000000..9ee84a924--- /dev/null+++ b/apps/web/src/app/(docs)/docs/legacy/examples/clone-repo/page.mdx@@ -0,0 +1 @@+# Clone GitHub Repository\ No newline at end of filediff --git a/apps/web/src/app/(docs)/docs/legacy/getting-help/page.mdx b/apps/web/src/app/(docs)/docs/legacy/getting-help/page.mdxnew file mode 100644index 000000000..786c2dbe1--- /dev/null+++ b/apps/web/src/app/(docs)/docs/legacy/getting-help/page.mdx@@ -0,0 +1,7 @@+# Getting help++If you have any questions, issues, or feature requests, please reach out on of the following channels: {{ className: 'lead' }}+- Send us an email at [[email protected]](mailto:[email protected])+- Talk to us on our [Discord server](https://discord.gg/U7KEcGErtQ)+- Open an issue on [our GitHub](https://github.com/e2b-dev/e2b)+- Reach out on [Twitter / X](https://twitter.com/e2b_dev)\ No newline at end of filediff --git a/apps/web/src/app/(docs)/docs/legacy/getting-started/api-key/APIKey.tsx b/apps/web/src/app/(docs)/docs/legacy/getting-started/api-key/APIKey.tsxnew file mode 100644index 000000000..68487771f--- /dev/null+++ b/apps/web/src/app/(docs)/docs/legacy/getting-started/api-key/APIKey.tsx@@ -0,0 +1,129 @@+'use client'++import Link from 'next/link'+import clsx from 'clsx'+import { usePostHog } from 'posthog-js/react'++import { useAccessToken, useApiKey, useUser } from '@/utils/useUser'+import { obfuscateSecret } from '@/utils/obfuscate'+import { Button } from '@/components/Button'+import { CopyButton } from '@/components/CopyButton'+import { Note } from '@/components/mdx'++export function CopyableSecret({+ secret,+ onAfterCopy,+ obfuscateStart,+ obfuscateEnd,+}: {+ secret: string;+ onAfterCopy: () => void;+ obfuscateStart?: number;+ obfuscateEnd?: number;+}) {+ return (+ <div className="relative flex">+ <span className="whitespace-nowrap font-mono text-yellow-400 group-hover:opacity-0">+ {obfuscateSecret(secret, obfuscateStart, obfuscateEnd)}+ </span>+ <span className="absolute inset-0">+ <CopyButton+ code={secret}+ onAfterCopy={onAfterCopy}+ customPositionClassNames={clsx(+ 'top-[-2px] bottom-[2px]' /* nudge 2px up*/,+ 'left-[-8px] right-[-8px]' /* widen a little to fit nicely */,+ 'min-h-[28px]'+ )}+ />+ </span>+ </div>+ )+}++function SecretBlock({ name, description, secret, posthog, tip }) {+ return (+ <div className="flex flex-col space-y-1">+ <h2 className="flex flex-row items-center justify-items-end align-text-bottom mt-6">+ <span>{name}</span>+ <div className="group text-sm ml-4 border-2 mt-1 outline-2 outline-offset-2 outline-zinc-700 rounded-full px-[8px]">+ <CopyableSecret+ secret={secret}+ onAfterCopy={() => posthog?.capture('copied API key')}+ obfuscateStart={12}+ obfuscateEnd={5}+ />+ </div>+ </h2>+ <span>{description}</span>+ <span>{tip}</span>+ </div>+ )+}++function APIKey() {+ const { user } = useUser()+ const apiKey = useApiKey()+ const posthog = usePostHog()+ const accessToken = useAccessToken()++ return (+ <div className="flex flex-col items-start justify-start -mb-6">+ {user ? (+ <div className="flex flex-col space-y-4">+ <SecretBlock+ name="API Key"+ description={+ <span>+ Use for <strong>running</strong> the sandboxes.+ </span>+ }+ secret={apiKey}+ posthog={posthog}+ tip={+ <span>+ Set as <code>E2B_API_KEY</code> environment variable to avoid passing it+ every time.+ </span>+ }+ />+ <SecretBlock+ name="Access Token"+ description={+ <div className="flex flex-col">+ <span>+ Used only in the CLI, <strong>not needed in the SDK</strong>.+ </span>+ <span>+ Access token is for <strong>managing</strong> sandboxes with CLI - list/kill/connect, and for building custom sandbox templates with CLI.+ </span>+ <span>+ Acess token is not needed when logging in CLI via <code>e2b auth login</code>.+ </span>+ </div>+ }+ secret={accessToken}+ posthog={posthog}+ tip={+ <Note>+ <div className="flex flex-col">+ <span>To authenticate without the browser, you can set <code>E2B_ACCESS_TOKEN</code> as an environment variable.</span>+ <span>This can be useful for CI/CD pipelines.</span>+ </div>+ </Note>+ }+ />+ </div>+ ) : (+ <div className="flex flex-col items-start justiy-start gap-4 mt-6">+ <span>You can get your API key by signing up.</span>+ <Link href="/auth/sign-up">+ <Button>Sign up to get your API key</Button>+ </Link>+ </div>+ )}+ </div>+ )+}++export default APIKeydiff --git a/apps/web/src/app/(docs)/docs/legacy/getting-started/api-key/page.mdx b/apps/web/src/app/(docs)/docs/legacy/getting-started/api-key/page.mdxnew file mode 100644index 000000000..4cb0c2f39--- /dev/null+++ b/apps/web/src/app/(docs)/docs/legacy/getting-started/api-key/page.mdx@@ -0,0 +1,33 @@+import APIKey from './APIKey'++# Your API Key++<APIKey/>+++## Use API key++To use the API key, you either:+- **Set the API key as the `E2B_API_KEY` environment variable**+- Or pass it directly to the `CodeInterpreter` constructor like this:+<CodeGroup isRunnable={false}>+```js {{ language: 'js' }}+import { CodeInterpreter } from '@e2b/code-interpreter'++const sandbox = await CodeInterpreter.create({ apiKey: 'YOUR_API_KEY' })+await sandbox.notebook.execCell('x = 1')++const execution = await sandbox.notebook.execCell('x+=1; x')+console.log(execution.text) // outputs 2++await sandbox.close()+```+```python {{ language: 'python' }}+from e2b_code_interpreter import CodeInterpreter++with CodeInterpreter(api_key="YOUR_API_KEY") as code_interpreter:+ sandbox.notebook.exec_cell("x = 1")+ execution = sandbox.notebook.exec_cell("x+=1; x")+ print(execution.text) # outputs 2+```+</CodeGroup>diff --git a/apps/web/src/app/(docs)/docs/legacy/getting-started/installation/page.mdx b/apps/web/src/app/(docs)/docs/legacy/getting-started/installation/page.mdxnew file mode 100644index 000000000..5d899c97e--- /dev/null+++ b/apps/web/src/app/(docs)/docs/legacy/getting-started/installation/page.mdx@@ -0,0 +1,28 @@+import { Libraries } from '@/components/Libraries'++# Installation++You create and control sandboxes with our SDKs.+We offer SDKs for [JavaScript / TypeScript](https://www.npmjs.com/package/e2b), and [Python](https://pypi.org/project/e2b/).++<Libraries/>++You can install them using the following commands:++<CodeGroup isRunnable={false}>+```bash {{ language: 'js' }}+npm install e2b+```+```bash {{ language: 'python' }}+pip install e2b+```+</CodeGroup>+++## Next steps++1. [Get your API key](/docs/getting-started/api-key)+1. [Explore the Sandbox API](/docs/sandbox/api/envs)+{/* 1. [Follow the "Hello World" example](/docs/guides/) */}+{/* 1. [Check out the official guides](/docs/guides/overview) */}+{/* 1. [Explore integrations with AI frameworks and LLMs](/docs/integrations/overview) */}diff --git a/apps/web/src/app/(docs)/docs/legacy/guide/beta-code-interpreter-language-runtimes/page.mdx b/apps/web/src/app/(docs)/docs/legacy/guide/beta-code-interpreter-language-runtimes/page.mdxnew file mode 100644index 000000000..e7ed2d687--- /dev/null+++ b/apps/web/src/app/(docs)/docs/legacy/guide/beta-code-interpreter-language-runtimes/page.mdx@@ -0,0 +1,54 @@+# Code Interpreter SDK Beta - Language Runtimes++This guide shows how to run AI-generated code in different language runtimes using the new Code Interpreter beta SDK.+The following language runtimes are currently supported:+- **Python**+- **JavaScript**+- **Java**+- **Bash**+- **R**++<Note>+Want more language runtimes? Reached out to us on [Discord](https://discord.gg/U7KEcGErtQ) or over [email](emailto:[email protected]).+</Note>++## 1. Install the Code Interpreter beta SDK+The latest beta versions you should install can be found in NPM/PyPi release history:+- **JavaScript & TypeScript**+ - [Latest release](https://www.npmjs.com/package/@e2b/code-interpreter?activeTab=versions) with *rc* tag for `@e2b/code-interpreter`+- **Python**+ - [Latest release](https://pypi.org/project/e2b-code-interpreter/#history) with *PRE-RELEASE* for `e2b-code-interpreter`+++## 2. Active kernel for the desired language+Each of the supported language runtimes has its own kernel.++**Python**+```python+from e2b_code_interpreter import CodeInterpreter++sandbox = CodeInterpreter()++# 1. Set JS kernel - available kernel names: 'r', 'javascript', 'java', 'bash'+js_id = sandbox.notebook.create_kernel(kernel_name="javascript")+# 2. Run JS code inside code interpreter!+execution = sandbox.notebook.exec_cell("console.log('Hello World!')", kernel_id=js_id)+print(execution)+# 3. Use Python again+sandbox.notebook.exec_cell("print('Hello World!')")+```++**JavaScript / TypeScript**+```js+import { CodeInterpreter } from '@e2b/code-interpreter'++const sandbox = await CodeInterpreter.create()++// 1. Set JS kernel - available kernel names: 'r', 'javascript', 'java', 'bash'+const jsID = await sandbox.notebook.createKernel({ kernelName: 'javascript' })+// 2. Run JS code inside code interpreter!+const execution = await sandbox.notebook.execCell("console.log('Hello World!')", { kernelID: jsID })+console.log(execution)+// 3. Use Python again+await sandbox.notebook.execCell('print("Hello World!")')+```diff --git a/apps/web/src/app/(docs)/docs/legacy/guide/beta-migration/page.mdx b/apps/web/src/app/(docs)/docs/legacy/guide/beta-migration/page.mdxnew file mode 100644index 000000000..c5f71b909--- /dev/null+++ b/apps/web/src/app/(docs)/docs/legacy/guide/beta-migration/page.mdx@@ -0,0 +1,645 @@+# SDK Beta - Migration Guide+The following guide shows how to migrate your code from the current Core SDKs (`e2b`) and Code Interpreter SDKs (`@e2b/code-interpreter`/`e2b-code-interpreter`) to the beta versions.++The latest beta versions you should install can be found in NPM/PyPi release history:+- **JavaScript & TypeScript**+ - [Latest release](https://www.npmjs.com/package/e2b?activeTab=versions) with *rc* tag for `e2b`+ - [Latest release](https://www.npmjs.com/package/@e2b/code-interpreter?activeTab=versions) with *rc* tag for `@e2b/code-interpreter`+- **Python**+ - [Latest release](https://pypi.org/project/e2b/#history) with *PRE-RELEASE* for `e2b`+ - [Latest release](https://pypi.org/project/e2b-code-interpreter/#history) with *PRE-RELEASE* for `e2b-code-interpreter`++## Table of contents+- [Core Sandbox SDK changes](#core-sandbox-sdk-changes)+ - [Creating sandbox](#creating-sandbox)+ - [Modifying sandbox timeout](#modifying-sandbox-timeout)+ - [Reconnecting](#reconnecting)+ - [Uploading data and creating files in sandbox](#uploading-data-and-creating-files-in-sandbox)+ - [Downloading files and reading files in sandbox](#downloading-files-and-reading-files-in-sandbox)+ - [Running processes](#running-processes)+ - [Watching for files' changes](#watching-for-files-changes)+ - [Accessing sandbox ID](#accessing-sandbox-id)+ - [Getting sandbox upload URL](#getting-sandbox-upload-url)+ - [Configuring sandbox `cwd`](#configuring-sandbox-cwd)+ - [Timeouts](#timeouts)+ - [Listing sandboxes](#listing-sandboxes)+ - [Getting sandbox url](#getting-sandbox-url)+- [Code Interpreter SDK changes](#code-interpreter-sdk-changes)+ - [Executing code](#executing-code)+ - [Custom template](#custom-template)+- [Python Async](#python-async)+ - [Watching for files' changes in async Python SDK](#watching-for-files-changes-in-async-python-sdk)+ - [Running background commands in async Python SDK](#running-background-commands-in-async-python-sdk)+++## <h1>Core Sandbox SDK changes</h1>+These changes affect both the `e2b` Core SDKs and Code Interpreter SDKs (`@e2b/code-interpreter`/`e2b-code-interpreter`) because the Code Interpreter uses the Core SDK.++<Note>+If you are using a custom template you need to rebuild it by calling `e2b template build` in the directory with the template.+</Note>++## Creating sandbox++When creating a sandbox you now **specify the sandbox timeout — how long the sandbox will exist**. If you don't specify the timeout the sandbox will be closed after 5 minutes.++You also no longer call the `.close()` method when you are done with the sandbox. Sandbox will be automatically closed and killed after the timeout.++You can use `.kill()` to kill the sandbox immediately if you are sure you won't need it anymore.++<CodeGroup isRunnable={false}>+```js+import Sandbox from 'e2b'++// Before+// const sandbox = await Sandbox.create()+// await sandbox.close()++// Now+const sandbox = await Sandbox.create({ timeoutMs: 300_000 })+```+```python+from e2b import Sandbox++# Before+# sandbox = Sandbox()+# sandbox.close()++# Now+sandbox = Sandbox(timeout=300)+```+</CodeGroup>++If you need to use a [custom sandbox template](/docs/guide/custom-sandbox) you pass the template as the first parameter:+<CodeGroup isRunnable={false}>+```js+import Sandbox from 'e2b'++// Before+// const sandbox = await Sandbox.create({ template: 'template-name-or-id' })+// await sandbox.close()++// Now+const sandbox = await Sandbox.create('template-name-or-id', {+ timeoutMs: 300_000,+})+```+```python+from e2b import Sandbox++# Before+# sandbox = Sandbox(template='template-name-or-id')+# sandbox.close()++# Now+sandbox = Sandbox(template='template-name-or-id', timeout=300)+```+</CodeGroup>++## Modifying sandbox timeout+If you need to change how long the sandbox should stay alive after it was created, you can use `.setTimeout()`/`.set_timeout()` method.+It will modify the timeout of the sandbox.++<CodeGroup isRunnable={false}>+```js+import Sandbox from 'e2b'++// Before+// const sandbox = await Sandbox.create()+// await sandbox.keepAlive(600_000)++// Now+const sandbox = await Sandbox.create({ timeoutMs: 300_000 })+await sandbox.setTimeout(600_000)+```+```python+from e2b import Sandbox++# Before+# sandbox = Sandbox()+# sandbox.keep_alive(600)++# Now+sandbox = Sandbox(timeout=300)+sandbox.set_timeout(600)+```+</CodeGroup>++## Reconnecting+When connection to an existing sandbox use `.connect()`/`.connect()` method instead of `.reconnect()`/`.reconnect()`.++Instead of using `.keepAlive()`/`.keep_alive()` method to prevent the sandbox from closing until you reconnect use `.setTimeout()`/`.set_timeout()` method.+Because the timeout is set when the sandbox is created, you may not need to set the timeout when reconnecting at all now.++<CodeGroup isRunnable={false}>+```js+import Sandbox from 'e2b'++// Before+// const sandbox = await Sandbox.create()+// await sandbox.keepAlive(600_000)+// await sandbox.close()++// const existingSandbox = await Sandbox.reconnect(sandbox.id)++// Now+const sandbox = await Sandbox.create({ timeoutMs: 600_000 })++const existingSandbox = await Sandbox.connect(sandbox.sandboxId)+```+```python+from e2b import Sandbox++# Before+# sandbox = Sandbox()+# sandbox.keep_alive(600)+# sandbox.close()++# existing_sandbox = Sandbox.reconnect(sandbox.id)++# Now+sandbox = Sandbox(timeout=600)++existing_sandbox = Sandbox.connect(sandbox.sandbox_id)+```+</CodeGroup>++## Uploading data and creating files in sandbox+Use `.files.write()` method to upload files to the sandbox.++The method accepts `path` in the sandbox as the first argument and the `data` as the second argument.++<CodeGroup isRunnable={false}>+```js+import Sandbox from 'e2b'++// Before+// const content = fs.readFileSync('/local/path')+// await sandbox.uploadFile(content, '/path/in/sandbox')++// Now+const content = fs.readFileSync('/local/path')+await sandbox.files.write('/path/in/sandbox', content)+```+```python+from e2b import Sandbox++# Before+# with open("path/to/local/file", "rb") as file:+# sandbox.upload_file(file)++# Now+with open("path/to/local/file", "rb") as file:+ sandbox.files.write("/path/in/sandbox", file)+```+</CodeGroup>++## Downloading files and reading files in sandbox+Use `.files.read()` method to download files from the sandbox.++The method accepts `path` in the sandbox as the first argument and optional `format` as the second argument.++<CodeGroup isRunnable={false}>+```js+import Sandbox from 'e2b'++// Before+//const content = await sandbox.downloadFile('/path/in/sandbox')++// Now+const content = await sandbox.files.read('/path/in/sandbox')+```+```python+from e2b import Sandbox++# Before+# content = sandbox.download_file('/path/in/sandbox')++# Now+content = sandbox.files.read("/path/in/sandbox")+```+</CodeGroup>+++## Running processes+You execute processes by calling `.commands.run()` method. By default, the method waits for the command to finish.++You can specify the timeout for the command execution by passing `timeoutMs`/`timeout` option. The default timeout is 60 seconds.++If the command fails with a non-zero exit it will raise `ProcessExitError` in Javascript, or `ProcessExitException` in Python, and you can catch and inspect the error for more info.++<CodeGroup isRunnable={false}>+```js+import Sandbox from 'e2b'++// Before+// const sandbox = await Sandbox.create()+// const result = await sandbox.process.startAndWait({+// cmd: 'echo "Hello, world!"',+// onStderr: (msg) => console.log(msg.line),+// onStdout: (msg) => console.log(msg.line),+// })++// Now+const result = await sandbox.commands.run('echo "Hello, World!"', {+ onStderr(output) { console.log(output) },+ onStdout(output) { console.log(output) },+ timeoutMs: 60_000,+})+```+```python+from e2b import Sandbox++# Before+# sandbox = Sandbox()+# result = sandbox.process.start_and_wait(+# cmd='echo "Hello, world!"',+# on_stderr=lambda msg: print(msg.line),+# on_stdout=lambda msg: print(msg.line),+# )++# Now+result = sandbox.commands.run(+ cmd='echo "Hello, World!"',+ timeout=60,+ on_stdout=lambda output: print(output),+ on_stderr=lambda output: print(output),+)+```+</CodeGroup>+If you want to run the command in the background use `background: true`/`background=True` option.+You can then use `.wait()` method to wait for the command to finish.++<CodeGroup isRunnable={false}>+```js+import Sandbox from 'e2b'++// Before+// const sandbox = await Sandbox.create()+// const process = await sandbox.process.start({+// cmd: 'sleep 10; echo "Hello, world!"',+// onStderr: (msg) => console.log(msg.line),+// onStdout: (msg) => console.log(msg.line),+// })++// const result = await process.wait()++// Now+const command = await sandbox.commands.run('sleep 10; echo "Hello, world!"', {+ onStderr(output) { console.log(output) },+ onStdout(output) { console.log(output) },+ background: true,+})++const result = await command.wait()+```+```python+from e2b import Sandbox++# Before+# sandbox = Sandbox()+# process = sandbox.process.start(+# cmd='echo "Hello, world!"',+# on_stderr=lambda msg: print(msg.line),+# on_stdout=lambda msg: print(msg.line),+# )++# result = process.wait()++# Now+command = sandbox.commands.run(+ cmd='echo "Hello, World!"',+ background=True,+)++result = command.wait(+ on_stderr=lambda output: print(output),+ on_stdout=lambda output: print(output),+)+```+</CodeGroup>+++## Watching for files' changes++<CodeGroup isRunnable={false}>+```js+import Sandbox from 'e2b'++// Before+// const sandbox = await Sandbox.create()+// const watcher = sandbox.filesystem.watchDir('/path/in/sandbox')+// watcher.addEventListener((event) => console.log(event))+// await watcher.start()++// Now+const sandbox = await Sandbox.create()+await sandbox.files.watch('/path/in/sandbox', (event) => console.log(event))+```+```python+from e2b import Sandbox++# Before+# sandbox = Sandbox()++# watcher = sandbox.filesystem.watch_dir("/path/in/sandbox")+# watcher.add_event_listener(lambda event: print(event))+# watcher.start()++# Now+sandbox = Sandbox()+watcher = sandbox.files.watch("/path/in/sandbox")++for event in watcher:+ print(event)+```+</CodeGroup>++## Accessing sandbox ID+The `id` property on the sandbox/code interpreter instance is now named `sandboxId`/`sandbox_id`.++<CodeGroup isRunnable={false}>+```js+import Sandbox from 'e2b'++// Before+// const sandboxId = await sandbox.id++// Now+const sandboxId = await sandbox.sandboxId+```+```python+from e2b import Sandbox++# Before+# sandbox_id = sandbox.id++# Now+sandbox_id = sandbox.sandbox_id+```+</CodeGroup>++## Getting sandbox upload URL+The `.fileURL`/`.file_url()` is now `.uploadURL`/`.upload_url()` method that takes an optional argument that specifies the path in the sandbox where the file will be uploaded.++If the path is not specified the file will be uploaded to the home dir — `/home/user`.++<CodeGroup isRunnable={false}>+```js+import Sandbox from 'e2b'++// Before+// const url = await sandbox.fileURL++// Now+const url = await sandbox.uploadUrl('/path/in/sandbox')+```+```python+from e2b import Sandbox++# Before+# url = sandbox.file_url()++# Now+url = sandbox.upload_url('/path/in/sandbox')+```+</CodeGroup>++## Configuring sandbox `cwd`+Previously you could set the sandbox working directory by passing `cwd` option when creating the sandbox.+Right now this is not supported because it leads to subtle bugs especially when reconnecting to an existing sandbox.++If you need this feature please reach out to us on [Discord](https://discord.com/invite/U7KEcGErtQ) or [GitHub](https://github.com/e2b-dev/e2b) so we can prioritize it.++## Timeouts+There are now two types of timeouts that you can pass as parameters:+1. `request_timeout`/`requestTimeoutMs` sets how long the operation should wait for connection/processing.+This is useful for ensuring that none of the sandbox operations hang indefinitely.+2. `timeout`/`timeoutMs` which is used for setting the maximum length of long-running operations like executing code, running processes, or the sandbox itself.++## Listing sandboxes+Some properties returned from the `Sandbox.list` method have been renamed.++<CodeGroup isRunnable={false}>+```js+import Sandbox from 'e2b'++// Before+// const sandboxes = await Sandbox.list()++// `sandboxes` is an array of `RunningSandbox` objects:+// {+// sandboxID: string+// templateID: string+// alias?: string+// metadata?: SandboxMetadata+// startedAt: Date+// }++// Now+const sandboxes = await Sandbox.list()++// `sandboxes` is an array of `SandboxInfo` objects:+// {+// sandboxId: string+// templateId: string+// name?: string+// metadata: Record<string, string>+// startedAt: Date+// }+```+```python+from e2b import Sandbox++# Before+# sandboxes = Sandbox.list()++# `sandboxes` is an array of `RunningSandbox` objects:+# class RunningSandbox(BaseModel):+# sandbox_id: str+# template_id: str+# alias: Optional[str]+# metadata: Optional[Dict[str, str]]+# cpu_count: int+# memory_mb: int+# started_at: datetime++# Now+sandboxes = Sandbox.list()++# `sandboxes` is an array of `SandboxInfo` objects:+# @dataclass+# class SandboxInfo:+# sandbox_id: str+# template_id: str+# name: Optional[str]+# metadata: Dict[str, str]+# started_at: datetime++```+</CodeGroup>+++## Getting sandbox url+The method for getting the sandbox host has changed from `sandbox.getHostname/sandbox.get_hostname` to `sandbox.getHost/sandbox.get_host`.+It now requires specifying the port.++<CodeGroup isRunnable={false}>+```js+import Sandbox from 'e2b'++// Before+// const host = await sandbox.getHostname(80)++// Now+const host = await sandbox.getHost(80)+```+```python+from e2b import Sandbox++# Before+# host = sandbox.get_hostname(80)++# Now+host = sandbox.get_host(80)+```+</CodeGroup>+++## <h1>Code Interpreter SDK changes</h1>+All the previously mentioned changes to the Core SDK also apply to the Code Interpreter SDK.+Apart from them, the changes to the Code Interpreter SDK are very minimal:++## Executing code+When executing code via JS/TS Code Interpreter SDK you now pass the `timeoutMs` option to the `execCell` method instead of `timeout`.++The default timeout for the code execution is now 300 seconds.++<CodeGroup isRunnable={false}>+```js+import CodeInterpreter from '@e2b/code-interpreter'++// Before+// const sandbox = await CodeInterpreter.create()+// const execution = await sandbox.notebook.execCell('print("Hello, world!")', {+// timeout: 2000,+// })+// await sandbox.close()++// Now+const sandbox = await CodeInterpreter.create({ timeoutMs: 300_000 })+const execution = await sandbox.notebook.execCell('print("Hello, world!")', {+ timeoutMs: 2000,+})+```++```python+from e2b_code_interpreter import CodeInterpreter++# Before+# sandbox = CodeInterpreter()+# execution = sandbox.notebook.exec_cell('print("Hello, world!")', timeout=2)+# sandbox.close()++# Now+sandbox = CodeInterpreter(timeout=300)+execution = sandbox.notebook.exec_cell('print("Hello, world!")', timeout=2)+```+</CodeGroup>++## Custom template+If you are using a custom template for the Code Interpreter you need to rebuild it.+++You can rebuild the template by either calling+```sh+e2b template build -c "/root/.jupyter/start-up.sh"+```+if you use the E2B Docker image as base in your `e2b.Dockerfile`+```docker+FROM e2bdev/code-interpreter:latest++# You custom Dockerfile content here+```++Or if you are using custom base you need to copy all files excluding the `e2b.toml` from [beta template](https://github.com/e2b-dev/code-interpreter/tree/beta/template)+to the directory with your template and then run `e2b template build -c "/root/.jupyter/start-up.sh"`.++<Note>+Check of the [Code Interpreter custom template](/docs/code-interpreter/template) page for more info.+</Note>++## <h1>Python Async</h1>+Python Core SDK and Code Interpter SDK now support async.++If you need to use async import `AsyncSandbox`/`AsyncCodeInterpreter` instead of `Sandbox`/`CodeInterpreter`.++<CodeGroup isRunnable={false}>+```python+# Sync+# from e2b import Sandbox+# sandbox = Sandbox()++# from e2b_code_interpreter import CodeInterpreter+# sandbox = CodeInterpreter()++# Async+from e2b import AsyncSandbox+from e2b_code_interpreter import AsyncCodeInterpreter++sandbox = await AsyncSandbox.create()+sandbox = await AsyncCodeInterpreter.create()+```+</CodeGroup>++The async versions of methods for watching for files' changes and running commands in the background are slightly different:++## Watching for files' changes in async Python SDK++<CodeGroup isRunnable={false}>+```python+from e2b import Sandbox++# Sync+# sandbox = Sandbox()+# watcher = sandbox.files.watch("/path/in/sandbox")++# for event in watcher:+# print(event)++# Async+sandbox = await AsyncSandbox.create()++await sandbox.files.watch("/path/in/sandbox", lambda event: print(event))+```+</CodeGroup>++## Running background commands in async Python SDK+<CodeGroup isRunnable={false}>+```python+from e2b import Sandbox++# Sync+# sandbox = Sandbox()+# command = sandbox.commands.run(+# cmd='echo "Hello, World!"',+# background=True,+# )++# result = command.wait(+# on_stderr=lambda output: print(output),+# on_stdout=lambda output: print(output),+# )++# Async+sandbox = await AsyncSandbox.create()+command = await sandbox.commands.run(+ cmd='echo "Hello, World!"',+ on_stderr=lambda output: print(output),+ on_stdout=lambda output: print(output),+ background=True,+)++result = await command.wait()+```+</CodeGroup>diff --git a/apps/web/src/app/(docs)/docs/legacy/guide/connect-bucket/page.mdx b/apps/web/src/app/(docs)/docs/legacy/guide/connect-bucket/page.mdxnew file mode 100644index 000000000..2261b05b1--- /dev/null+++ b/apps/web/src/app/(docs)/docs/legacy/guide/connect-bucket/page.mdx@@ -0,0 +1,185 @@+# Connecting bucket to the sandbox++To enable persistence of the data in the sandbox we can use a bucket to store the data. We are leveraging the fuse file system to mount the bucket to the sandbox.++You will need to build a custom sandbox template with the fuse file system installed. The guide how to build a custom sandbox template can be found [here](/docs/guide/custom-sandbox).++## Google Cloud Storage++### Prerequisites++To use the Google Cloud Storage we'll need to have a bucket and a service account. The service account can be created [here](https://console.cloud.google.com/iam-admin/serviceaccounts), the bucket can be created [here](https://console.cloud.google.com/storage).++If you want to write to the bucket the service account must have the `Storage Object Admin` role for this bucket.++The guide how to create a service account key can be found [here](https://cloud.google.com/iam/docs/keys-create-delete#iam-service-account-keys-create-console).++### Mounting the bucket++To use the Google Cloud Storage we need to install the `gcsfuse` package. There's simple `Dockerfile` that can be used to create a container with the `gcsfuse` installed.++```docker+FROM ubuntu:latest++RUN apt-get update && apt-get install -y gnupg lsb-release wget++RUN lsb_release -c -s > /tmp/lsb_release+RUN GCSFUSE_REPO=$(cat /tmp/lsb_release); echo "deb https://packages.cloud.google.com/apt gcsfuse-$GCSFUSE_REPO main" | tee /etc/apt/sources.list.d/gcsfuse.list+RUN wget -O - https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -++RUN apt-get update && apt-get install -y gcsfuse++```++The actual mounting of the bucket is done in runtime during the start of the sandbox. The `gcsfuse` command is used to mount the bucket to the sandbox.++<CodeGroup isRunnable={false}>+```js {{ language: 'js' }}+import { Sandbox } from 'e2b'++const sandbox = await Sandbox.create({ template: '<your template id>' })+await sandbox.filesystem.makeDir("/home/user/bucket")+await sandbox.uploadFile("key.json")++const process = await sandbox.process.start("sudo gcsfuse <flags> --key-file /home/user/key.json <bucket-name> /home/user/bucket")+const output = await process.wait()+if (output.exitCode) {+ throw Error(output.stderr)+}+```++```python {{ language: 'python' }}+from e2b import Sandbox++with Sandbox(template="<your template id>") as sandbox:+ sandbox.filesystem.make_dir("/home/user/bucket")+ sandbox.upload_file("key.json")++ process = sandbox.process.start("sudo gcsfuse <flags> --key-file /home/user/key.json <bucket-name> /home/user/bucket")+ output = process.wait()+ if output.exit_code:+ raise Exception(output.stderr)++```+</CodeGroup>++### Flags++The list of all flags can be found [here](https://cloud.google.com/storage/docs/gcsfuse-cli#options).++### Allow the default user to access the files++To allow the default user to access the files we can use the following flags:++```+-o allow_other -file-mode=777 -dir-mode=777+```++## Amazon S3++For Amazon S3 we can use the `s3fs` package. The `Dockerfile` is similar to the one for the Google Cloud Storage.++```docker+FROM ubuntu:latest++RUN apt-get update && apt-get install s3fs+```++Similarly to the Google Cloud Storage, the actual mounting of the bucket is done in runtime during the start of the sandbox. The `s3fs` command is used to mount the bucket to the sandbox.++<CodeGroup isRunnable={false}>+```js {{ language: 'js' }}+import { Sandbox } from 'e2b'++const sandbox = await Sandbox.create({ template: '<your template id>' })+await sandbox.filesystem.makeDir('/home/user/bucket')+++// Create a file with the credentials+// If you use another path for the credentials you need to add the path in the command s3fs command+await sandbox.filesystem.write('/root/.passwd-s3fs', '<AWS_ACCESS_KEY_ID>:<AWS_SECRET_ACCESS_KEY>')+await sandbox.process.startAndWait('sudo chmod 600 /root/.passwd-s3fs')++const process = await sandbox.process.start('sudo s3fs <flags> <bucket-name> /home/user/bucket')+const output = await process.wait()+if (output.exitCode) {+ throw Error(output.stderr)+}+```++```python {{ language: 'python' }}+from e2b import Sandbox++with Sandbox(template="<your template id>") as sandbox:+ sandbox.filesystem.make_dir("/home/user/bucket")++ # Create a file with the credentials+ # If you use another path for the credentials you need to add the path in the command s3fs command+ sandbox.filesystem.write("/root/.passwd-s3fs", "<AWS_ACCESS_KEY_ID>:<AWS_SECRET_ACCESS_KEY>")+ sandbox.process.start_and_wait("sudo chmod 600 /root/.passwd-s3fs")++ process = sandbox.process.start("sudo s3fs <flags> <bucket-name> /home/user/bucket")+ output = process.wait()+ if output.exit_code:+ raise Exception(output.stderr)++```+</CodeGroup>++### Flags++The list of all flags can be found [here](https://manpages.ubuntu.com/manpages/xenial/man1/s3fs.1.html).++### Allow the default user to access the files++To allow the default user to access the files add the following flag:++```+-o allow_other+```++## Cloudflare R2++For Cloudflare R2 we can use very similar setup as for S3. The `Dockerfile` is the same as for S3. The mounting is slightly different, we need to specify the endpoint for R2.++<CodeGroup isRunnable={false}>+```js {{ language: 'js' }}++import { Sandbox } from 'e2b'++const sandbox = await Sandbox.create({ template: '<your template id>' })+await sandbox.filesystem.makeDir('/home/user/bucket')++// Create a file with the R2 credentials+// If you use another path for the credentials you need to add the path in the command s3fs command+await sandbox.filesystem.write('/root/.passwd-s3fs', '<R2_ACCESS_KEY_ID>:<R2_SECRET_ACCESS_KEY>')+await sandbox.process.startAndWait('sudo chmod 600 /root/.passwd-s3fs')++const output = await sandbox.process.startAndWait('sudo s3fs -o url=https://<ACCOUNT ID>.r2.cloudflarestorage.com <flags> <bucket-name> /home/user/bucket')+if (output.exitCode) {+ throw Error(output.stderr)+}+```++```python {{ language: 'python' }}+from e2b import Sandbox++with Sandbox(template="<your template id>") as sandbox:+ sandbox.filesystem.make_dir("/home/user/bucket")++ # Create a file with the R2 credentials+ # If you use another path for the credentials you need to add the path in the command s3fs command+ sandbox.filesystem.write("/root/.passwd-s3fs", "<R2_ACCESS_KEY_ID>:<R2_SECRET_ACCESS_KEY>")+ sandbox.process.start_and_wait("sudo chmod 600 /root/.passwd-s3fs")++ process = sandbox.process.start("sudo s3fs -o url=https://<ACCOUNT ID>.r2.cloudflarestorage.com <flags> <bucket-name> /home/user/bucket")+ output = process.wait()+ if output.exit_code:+ raise Exception(output.stderr)++```+</CodeGroup>++### Flags++It's the same as for S3.\ No newline at end of filediff --git a/apps/web/src/app/(docs)/docs/legacy/guide/custom-sandbox/page.mdx b/apps/web/src/app/(docs)/docs/legacy/guide/custom-sandbox/page.mdxnew file mode 100644index 000000000..92453ed6e--- /dev/null+++ b/apps/web/src/app/(docs)/docs/legacy/guide/custom-sandbox/page.mdx@@ -0,0 +1,195 @@+import Image from 'next/image'++# Creating Custom Sandbox++In this guide, we'll create a custom E2B sandbox with preinstalled dependencies and files.+Once the sandbox is built, we'll show how to spawn and control it with our SDK.++## Prerequisites+1. [Node.js](https://nodejs.org/) 18.0.0 or later+1. [E2B CLI](/docs/cli/installation)+1. Running Docker instance++## 1. Install E2B CLI++<CodeGroup isTerminalCommand title="Install CLI" isRunnable={false}>+```bash+npm install -g @e2b/cli@latest+```+</CodeGroup>++<Note>+You need Node.js 18.0.0 or later to install the CLI.+</Note>++## 2. Login to CLI+Before you create your first custom sandbox, you will need to authenticate in the CLI with your E2B account.+Run the following command in your terminal.+<CodeGroup isTerminalCommand title="Login to CLI" isRunnable={false}>+```bash+e2b auth login+```+</CodeGroup>++<Note>+You need to have an existing E2B account to login. Sign up [here](/docs/getting-started/api-key).+</Note>++## 3. Create `e2b.Dockerfile`+To describe how your custom sandbox will look like, create a new Dockerfile and name it `e2b.Dockerfile`.+We use this Dockerfile as the [template file](/docs/sandbox/templates/template-file).++<Note>+Run `e2b template init` to create `e2b.Dockerfile` in the current directory.+</Note>++We want our custom sandbox to have the [ffmpeg](https://www.ffmpeg.org/) isntalled - ffmpeg is a tool for editing video and audio files.++<Note>+We support only Debian based images at the moment.+</Note>++<CodeGroup isFileName title="e2b.Dockerfile" isRunnable={false}>+```bash+# You can use most of the Debian based images+FROM ubuntu:22.04++# Install the ffmpeg tool/+RUN apt update \+ && apt install -y ffmpeg+```+</CodeGroup>++## 4. Build custom sandbox+Now it's time to create your custom sandbox based on the sandbox template file (the `e2b.Dockefile` file) you just created in the previous step.++Run the following command inside the template file directory in your terminal.+<Note>+[Pro users](/docs/pricing) can use the `--cpu-count=` ([docs](/docs/cli/commands#template-build)) and `--memory-mb=` ([docs](/docs/cli/commands#template-build)) flags to customize the sandbox compute.+Read more about the compute [here](/docs/sandbox/compute).+</Note>++<CodeGroup isTerminalCommand title="Build sandbox template" isRunnable={false}>+```bash+e2b template build --name "my-agent-sandbox"+```+</CodeGroup>++<Note>+Use the `.dockerignore` file to exclude files from the sandbox template.+</Note>++The final output should look similar to this.++<CodeGroup title="Build output" isRunnable={false}>+```bash+Preparing sandbox template building (1 files in Docker build context).+Found ./e2b.Dockerfile that will be used to build the sandbox template.+Started building the sandbox template my-agent-sandbox++# Truncated for visibility+# ...+# ...++Running postprocessing. It can take up to few minutes.++Postprocessing finished.++✅ Building sandbox template my-agent-sandbox finished.++┌ Usage examples ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐+│ │+│ You can use E2B Python or JS SDK to spawn sandboxes now. │+│ Find more here - https://e2b.dev/docs/guide/custom-sandbox in Spawn and control your sandbox section. │+│ │+│───────────────────────────────────────────────────────────────────── Python SDK ─────────────────────────────────────────────────────────────────────│+│ │+│ from e2b import Sandbox │+│ │+│ # Start sandbox │+│ sandbox = Sandbox("my-agent-sandbox") │+│ │+│ # Interact with sandbox. Learn more here: │+│ # https://e2b.dev/docs/sandbox/overview │+│ │+│ # Close sandbox once done │+│ sandbox.close() │+│ │+│─────────────────────────────────────────────────────────────────────── JS SDK ───────────────────────────────────────────────────────────────────────│+│ │+│ import { Sandbox } from 'e2b' │+│ │+│ // Start sandbox │+│ const sandbox = await Sandbox.create('my-agent-sandbox') │+│ │+│ // Interact with sandbox. Learn more here: │+│ // https://e2b.dev/docs/sandbox/overview │+│ │+│ // Close sandbox once done │+│ await sandbox.close() │+│ │+└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘++Execution time: 42.55s+```+</CodeGroup>+++This will create the `e2b.toml` file storing the sandbox config.+<CodeGroup isFileName title="e2b.toml" isRunnable={false}>+```toml+# This is a config for E2B sandbox template+template_id = "1wdqsf9le9gk21ztb4mo"+dockerfile = "e2b.Dockerfile"+template_name = "my-agent-sandbox"+```+</CodeGroup>++| Sandbox template name | Sandbox template ID |+---|---|+|`my-agent-sandbox`|`1wdqsf9le9gk21ztb4mo`|++### Updating your sandbox template+If you want to update your sandbox template, you run the same command you did to build it.+This will rebuild the template.++<CodeGroup isTerminalCommand title="Update sandbox template" isRunnable={false}>+```bash+e2b template build+```+</CodeGroup>++## 5. Spawn and control your sandbox++Now you can use the [E2B SDK](/docs/getting-started/installation) to spawn & control your new custom sandbox.++The sandbox template name is `my-agent-sandbox`. We'll use it as an unique identifier and pass it to the SDK as the `template` parameter.+This way, we'll be able to spawn our custom sandbox and control it with the SDK.++<CodeGroup title="Spawn & control your custom sandbox" isRunnable={true}>+```js {{ language: 'js' }}+import { Sandbox } from 'e2b'++// Spawn your custom sandbox+const sandbox = await Sandbox.create({ template: 'my-agent-sandbox' }) // $HighlightLine++// Interact with sandbox. Learn more here:+// https://e2b.dev/docs/sandbox/overview++// Close sandbox once done+await sandbox.close()+```++```python {{ language: 'python' }}+from e2b import Sandbox++# Spawn your custom sandbox+sandbox = Sandbox(template="my-agent-sandbox") # $HighlightLine++# Interact with sandbox. Learn more here:+# https://e2b.dev/docs/sandbox/overview++# Close sandbox once done+sandbox.close()+```+</CodeGroup>diff --git a/apps/web/src/app/(docs)/docs/legacy/hello-world/js/page.mdx b/apps/web/src/app/(docs)/docs/legacy/hello-world/js/page.mdxnew file mode 100644index 000000000..0e650b5ef--- /dev/null+++ b/apps/web/src/app/(docs)/docs/legacy/hello-world/js/page.mdx@@ -0,0 +1,308 @@+import Image from 'next/image'+import imgChart from '@/images/hello-world-chart.png'++# Hello World.ts+This JavaScript guide will show you the basics of E2B:+- Connect the code interpreter to an LLM+- Prompt the LLM to generate the Python code+- Execute the AI-generated Python code in a secure E2B sandbox++### Get full code+Check out the [full code in our cookbook](https://github.com/e2b-dev/e2b-cookbook/tree/main/examples/hello-world-js).++### Overview+1. [Install Code Interpreter SDK](#1-install-code-interpreter-sdk)+1. [Prepare prompt and tools for LLM](#2-prepare-prompt-and-tools-for-llm)+1. [Prepare code interpreting](#3-prepare-code-interpreting)+1. [Call LLM and parse response with tools](#4-call-llm-and-parse-response-with-tools)+1. [Create code interpreter and run everything](##5-create-code-interpreter-and-run-everything)+1. [Save generated chart](#6-save-generated-chart)+++## 1. Install Code Interpreter SDK++The Code Interpreter SDK allows you to run AI-generated code in a secure small VM - **E2B sandbox** - made for AI code execution.+Inside the sandbox is a Jupyter server running that you can control from our SDK through the `notebook.execCell()` method.++Check out the [SDK's repository on GitHub](https://github.com/e2b-dev/code-interpreter).++<CodeGroup isRunnable={false}>+```bash {{ language: 'javascript' }}+npm init -y \+&& npm i --save-dev typescript tsx @types/node \+&& npm i @e2b/code-interpreter+```+</CodeGroup>++Get your E2B API key [here](/docs/getting-started/api-key) and save it to `.env` in your root directory.+<CodeGroup isFileName title=".env" isRunnable={false}>+```bash+E2B_API_KEY="e2b-api-key"+```+</CodeGroup>++## 2. Prepare prompt and tools for LLM+We'll be using Anthropic's [Claude 3 Opus](https://www.anthropic.com/news/claude-3-family) model but E2B works with any LLM so feel free to pick any you want!++<Note>+Usually, all you need from the model is just support for tool use. 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.+</Note>++Create the `model.ts` file and paste the following code.+<CodeGroup isFileName title="model.ts" isRunnable={false}>+```ts+import { Tool } from '@anthropic-ai/sdk/src/resources/beta/tools'++export const MODEL_NAME = 'claude-3-opus-20240229'++export const SYSTEM_PROMPT = `+## your job & context+you are a python data scientist. you are given tasks to complete and you run python code to solve them.+- the python code runs in jupyter notebook.+- every time you call \`execute_python\` tool, the python code is executed in a separate cell. it's okay to multiple calls to \`execute_python\`.+- display visualizations using matplotlib or any other visualization library directly in the notebook. don't worry about saving the visualizations to a file.+- you have access to the internet and can make api requests.+- you also have access to the filesystem and can read/write files.+- you can install any pip package (if it exists) if you need to but the usual packages for data analysis are already preinstalled.+- you can run any python code you want, everything is running in a secure sandbox environment.+`++export const tools: Tool[] = [+ {+ name: 'execute_python',+ description: 'Execute python code in a Jupyter notebook cell and returns any result, stdout, stderr, display_data, and error.',+ input_schema: {+ type: 'object',+ properties: {+ code: {+ type: 'string',+ description: 'The python code to execute in a single cell.'+ }+ },+ required: ['code']+ }+ }+]++```+</CodeGroup>++This defines our system prompt and the `tools` dictionary with available tools for the LLM - namely the `"execute_python"` tool.+A little bit later, we'll connect `"execute_python"` to the E2B's code interpretrer.+++## 3. Prepare code interpreting+We'll create a new function called `codeInterpret()` in a separate file `codeInterpreter.ts`.++<CodeGroup isFileName title="codeInterpreter.ts" isRunnable={false}>+```ts {{ language: 'javascript' }}+import { CodeInterpreter } from '@e2b/code-interpreter'++export async function codeInterpret(codeInterpreter: CodeInterpreter, code: string) {+ console.log(`\n${'='.repeat(50)}\n> Running following AI-generated code:\n${code}\n${'='.repeat(50)}`);++ const exec = await codeInterpreter.notebook.execCell(+ code,+ {+ // You can stream logs from the code interpreter+ // onStderr: (stderr: string) => console.log("\n[Code Interpreter stdout]", stderr),+ // onStdout: (stdout: string) => console.log("\n[Code Interpreter stderr]", stdout),+ //+ // You can also stream additional results like charts, images, etc.+ // onResult: ...+ }+ )++ if (exec.error) {+ console.log('[Code Interpreter error]', exec.error) // Runtime error+ return undefined+ }++ return exec+}+```+</CodeGroup>++This function takes the `CodeInterpreter` object from our SDK, and `code` as paramaters.+The `code` parameter is the code generated by the LLM.++Inside the function, we call the `codeInterpreter.notebook.execCell()` method. The `execCell()` takes `code` argument, and executes this `code` inside E2B sandbox.++## 4. Call LLM and parse response with tools+We're using Claude 3 Opus. Get your [Anthropic API key](https://console.anthropic.com/), save it to `.env` file, and install the [Anthropic SDK](https://docs.anthropic.com/claude/reference/client-sdks).++<CodeGroup isFileName title=".env" isRunnable={false}>+```bash+ANTHROPIC_API_KEY="anthropic-api-key"+```+</CodeGroup>++<CodeGroup isRunnable={false}>+```bash {{ language: 'python' }}+npm i @anthropic-ai/sdk+```+</CodeGroup>++Now we'll put everything together.+Create the `index.ts` file, import dependencies, and create the `chat()` function that will do the LLM calling and tool parsing.++<CodeGroup isFileName title="index.ts" isRunnable={false}>+```ts {{ language: 'javascript' }}+import * as fs from 'fs'++import 'dotenv/config'+import { CodeInterpreter, Execution } from '@e2b/code-interpreter'+import Anthropic from '@anthropic-ai/sdk'++import {+ MODEL_NAME,+ SYSTEM_PROMPT,+ tools,+} from './model'+import { codeInterpret } from './codeInterpreter'++const anthropic = new Anthropic()++async function chat(codeInterpreter: CodeInterpreter, userMessage: string): Promise<Execution | undefined> {+ console.log('Waiting for Claude...')++ const msg = await anthropic.beta.tools.messages.create({+ model: MODEL_NAME,+ system: SYSTEM_PROMPT,+ max_tokens: 4096,+ messages: [{role: 'user', content: userMessage}],+ tools,+ })++ console.log(`\n${'='.repeat(50)}\nModel response: ${msg.content}\n${'='.repeat(50)}`)+ console.log(msg)++ if (msg.stop_reason === 'tool_use') {+ const toolBlock = msg.content.find((block) => block.type === 'tool_use');+ const toolName = toolBlock.name+ const toolInput = toolBlock.input++ console.log(`\n${'='.repeat(50)}\nUsing tool: ${toolName}\n${'='.repeat(50)}`);++ if (toolName === 'execute_python') {+ const code = toolInput.code+ return codeInterpret(codeInterpreter, code)+ }+ return undefined+ }+}+```+</CodeGroup>++## 5. Create code interpreter and run everything+Now we put all together, and run our program. In the end of `index.ts` add following code prompting the LLM to visualize a distribution of height of men and print the median.++<CodeGroup isFileName title="index.ts" isRunnable={false}>+```ts {{ language: 'javascript' }}+async function run() {+ const userMessage = 'Visualize a distribution of height of men based on the latest data you know. Also print the median value.'++ const codeInterpreter = await CodeInterpreter.create()++ const codeOutput = await chat(codeInterpreter, userMessage)+ if (!codeOutput) {+ console.log('No code output')+ return+ }++ const logs = codeOutput.logs+ console.log(logs)++ if (codeOutput.results.length == 0) {+ console.log('No results')+ return+ }++ const firstResult = codeOutput.results[0]+ // Print description of the first rich result+ console.log(firstResult.text)++ await codeInterpreter.close()+}++run()+```+</CodeGroup>++After running your code with the following command+<CodeGroup isRunnable={false}>+```bash {{ language: 'bash' }}+$ tsx index.ts+```+</CodeGroup>++you should see similar results to this:++```sh+stdout=['The median male height is 175.5 cm\n'] stderr=[]+<Figure size 800x400 with 1 Axes>+```++We got our median in the logs (`stdout`, and `stderr`) but we also something intering in `firstResult`.+```sh+<Figure size 800x400 with 1 Axes>+```++## 6. Save generated chart++This looks like a plot. Let's save it to a file. Update the `run()` function like this,+and run the code again with `tsx index.ts` in your terminal.+<CodeGroup isFileName title="index.ts" isRunnable={false}>+```ts {{ language: 'javscript' }}+async function run() {+ const userMessage = 'Visualize a distribution of height of men based on the latest data you know. Also print the median value.'++ const codeInterpreter = await CodeInterpreter.create()++ const codeOutput = await chat(codeInterpreter, userMessage)+ if (!codeOutput) {+ console.log('No code output')+ return+ }++ const logs = codeOutput.logs+ console.log(logs)++ if (codeOutput.results.length == 0) {+ console.log('No results')+ return+ }++ const firstResult = codeOutput.results[0]+ // Print description of the first rich result+ console.log(firstResult.text)++ // If we received a chart in PNG form, we can visualize it+ if (firstResult.png) {+ // Decode the base64 encoded PNG data+ const pngData = Buffer.from(firstResult.png, 'base64');++ // Generate a unique filename for the PNG+ const filename = 'chart.png';++ // Save the decoded PNG data to a file+ fs.writeFileSync(filename, pngData);++ console.log(`Saved chart to ${filename}`);+ }++ await codeInterpreter.close()+}++run()+```+</CodeGroup>++The chart got saved in the `chart.png` file and it should look similar to this:++<Image+ src={imgChart}+ className="rounded w-full"+ alt="Chart visualizing distribution height of men"+ unoptimized+/>\ No newline at end of filediff --git a/apps/web/src/app/(docs)/docs/legacy/hello-world/py/page.mdx b/apps/web/src/app/(docs)/docs/legacy/hello-world/py/page.mdxnew file mode 100644index 000000000..40bdda1f1--- /dev/null+++ b/apps/web/src/app/(docs)/docs/legacy/hello-world/py/page.mdx@@ -0,0 +1,253 @@+import Image from 'next/image'+import imgChart from '@/images/hello-world-chart.png'+++# Hello World.py+This Python guide will show you the basics of E2B:+- Connect the code interpreter to an LLM+- Prompt the LLM to generate the Python code+- Execute the AI-generated Python code in a secure E2B sandbox++### Get full code+Check out the [full code in our cookbook](https://github.com/e2b-dev/e2b-cookbook/tree/main/examples/hello-world-python).++### Overview+1. [Install Code Interpreter SDK](#1-install-code-interpreter-sdk)+1. [Prepare prompt and tools for LLM](#2-prepare-prompt-and-tools-for-llm)+1. [Prepare code interpreting](#3-prepare-code-interpreting)+1. [Call LLM and parse response with tools](#4-call-llm-and-parse-response-with-tools)+1. [Create code interpreter and run everything](##5-create-code-interpreter-and-run-everything)+1. [Save generated chart](#6-save-generated-chart)+++## 1. Install Code Interpreter SDK++The Code Interpreter SDK allows you to run AI-generated code in a secure small VM - **E2B sandbox** - made for AI code execution.+Inside the sandbox is a Jupyter server running that you can control from our SDK through the `notebook.execCell()` method.++Check out the [SDK's repository on GitHub](https://github.com/e2b-dev/code-interpreter).++<CodeGroup isRunnable={false}>+```bash {{ language: 'python' }}+pip install e2b_code_interpreter python-dotenv+```+</CodeGroup>++Get your E2B API key [here](/docs/getting-started/api-key) and save it to `.env` in your root directory.+<CodeGroup isFileName title=".env" isRunnable={false}>+```bash+E2B_API_KEY="e2b-api-key"+```+</CodeGroup>+++## 2. Prepare prompt and tools for LLM+We'll be using Anthropic's [Claude 3 Opus](https://www.anthropic.com/news/claude-3-family) model but E2B works with any LLM so feel free to pick any you want!++<Note>+Usually, all you need from the model is just support for tool use. 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.+</Note>++Create the `model.py` file and paste the following code.+<CodeGroup isFileName title="model.py" isRunnable={false}>+```python+MODEL_NAME = "claude-3-opus-20240229"++SYSTEM_PROMPT = """+## your job & context+you are a python data scientist. you are given tasks to complete and you run python code to solve them.+- the python code runs in jupyter notebook.+- every time you call `execute_python` tool, the python code is executed in a separate cell. it's okay to multiple calls to `execute_python`.+- display visualizations using matplotlib or any other visualization library directly in the notebook. don't worry about saving the visualizations to a file.+- you have access to the internet and can make api requests.+- you also have access to the filesystem and can read/write files.+- you can install any pip package (if it exists) if you need to but the usual packages for data analysis are already preinstalled.+- you can run any python code you want, everything is running in a secure sandbox environment.+"""++tools = [+ {+ "name": "execute_python",+ "description": "Execute python code in a Jupyter notebook cell and returns any result, stdout, stderr, display_data, and error.",+ "input_schema": {+ "type": "object",+ "properties": {+ "code": {+ "type": "string",+ "description": "The python code to execute in a single cell."+ }+ },+ "required": ["code"]+ }+ }+]+```+</CodeGroup>++This defines our system prompt and the `tools` dictionary with available tools for the LLM - namely the `"execute_python"` tool.+A little bit later, we'll connect `"execute_python"` to the E2B's code interpreter.+++## 3. Prepare code interpreting+We'll create a new function called `code_interpret()` in a separate file `code_interpreter.py`.++<CodeGroup isFileName title="code_interpreter.py" isRunnable={false}>+```python {{ language: 'python' }}+from e2b_code_interpreter import CodeInterpreter++def code_interpret(code_interpreter: CodeInterpreter, code: str):+ print(f"\n{'='*50}\n> Running following AI-generated code:\n{code}\n{'='*50}")+ exec = code_interpreter.notebook.exec_cell(+ code,+ # You can stream logs from the code interpreter+ # on_stderr=lambda stderr: print("\n[Code Interpreter stdout]", stderr),+ # on_stdout=lambda stdout: print("\n[Code Interpreter stderr]", stdout),+ #+ # You can also stream additional results like charts, images, etc.+ # on_result=...+ )++ if exec.error:+ print("[Code Interpreter error]", exec.error) # Runtime error+ else:+ return exec.results, exec.logs+```+</CodeGroup>++This function takes the `CodeInterpreter` object from our SDK and `code` as paramaters.+The `code` parameter is the code generated by the LLM.++Inside the function, we call the `code_interpreter.notebook.exec_cell()` method. The `exec_cell()` takes the `code` argument and executes this `code` inside E2B sandbox.++## 4. Call LLM and parse response with tools+We're using Claude 3 Opus. Get your [Anthropic API key](https://console.anthropic.com/), save it to `.env` file, and install the [Anthropic SDK](https://docs.anthropic.com/claude/reference/client-sdks).++<CodeGroup isFileName title=".env" isRunnable={false}>+```bash+ANTHROPIC_API_KEY="anthropic-api-key"+```+</CodeGroup>++<CodeGroup isRunnable={false}>+```bash {{ language: 'python' }}+pip install anthropic+```+</CodeGroup>++Now we'll put everything together.+Create the `main.py` file, import dependencies, and create the `chat()` function that will do the LLM calling and tool parsing.++<CodeGroup isFileName title="main.py" isRunnable={false}>+```python {{ language: 'python' }}+import base64+from dotenv import load_dotenv+from anthropic import Anthropic+from typing import List, Tuple+from e2b_code_interpreter import CodeInterpreter, Result+from e2b_code_interpreter.models import Logs++from e2b_hello_world.model import MODEL_NAME, SYSTEM_PROMPT, tools+from e2b_hello_world.code_interpreter import code_interpret++# Load the .env file+load_dotenv()++client = Anthropic()++def chat(code_interpreter: CodeInterpreter, user_message: str) -> Tuple[List[Result], Logs]:+ print(f"\n{'='*50}\nUser Message: {user_message}\n{'='*50}")++ message = client.beta.tools.messages.create(+ model=MODEL_NAME,+ system=SYSTEM_PROMPT,+ max_tokens=4096,+ messages=[{"role": "user", "content": user_message}],+ tools=tools,+ )++ print(f"\n{'='*50}\nModel response: {message.content}\n{'='*50}")++ if message.stop_reason == "tool_use":+ tool_use = next(block for block in message.content if block.type == "tool_use")+ tool_name = tool_use.name+ tool_input = tool_use.input++ print(f"\n{'='*50}\nUsing tool: {tool_name}\n{'='*50}")++ if tool_name == "execute_python":+ return code_interpret(code_interpreter, tool_input["code"])+ return []+```+</CodeGroup>+++## 5. Create code interpreter and run everything+Now we are ready to run our program. At the end of `main.py` add the following code prompting the LLM to visualize a distribution of the height of men and print the median.++<CodeGroup isFileName title="main.py" isRunnable={false}>+```python {{ language: 'python' }}+def main():+ user_message = "Visualize a distribution of height of men based on the latest data you know. Also, print the median value."++ # Create the CodeInterpreter object and save it as code_interpreter+ with CodeInterpreter() as code_interpreter:+ code_interpreter_results, code_interpreter_logs = chat(+ code_interpreter,+ user_message,+ )++ print(code_interpreter_logs)++ first_result= code_interpreter_results[0]+ print(first_result)+```+</CodeGroup>++After running your code with the following command+<CodeGroup isRunnable={false}>+```bash {{ language: 'bash' }}+$ python main.py+```+</CodeGroup>++you should see results similar to this:++```sh+stdout=['The median male height is 175.5 cm\n'] stderr=[]+<Figure size 800x400 with 1 Axes>+```++We got our median in the logs (`stdout`, and `stderr`) but we also something intering in `first_result`.+```sh+<Figure size 800x400 with 1 Axes>+```++## 6. Save generated chart++This looks like a plot. Let's save it to a file. Add the following to the end of `main.py` and run the code again with `python main.py` in your terminal.+<CodeGroup isFileName title="main.py" isRunnable={false}>+```python {{ language: 'python' }}+ # If we received a chart in PNG form, we can visualize it+ if first_result.png:+ # Decode the base64 encoded PNG data+ png_data = base64.b64decode(first_result.png)++ # Generate a unique filename for the PNG+ filename = f"chart.png"++ # Save the decoded PNG data to a file+ with open(filename, "wb") as f:+ f.write(png_data)++ print(f"Saved chart to {filename}")+```+</CodeGroup>++The chart was saved in the `chart.png` file and it should look similar to this:++<Image+ src={imgChart}+ className="rounded w-full"+ alt="Chart visualizing distribution height of men"+ unoptimized+/>\ No newline at end of filediff --git a/apps/web/src/app/(docs)/docs/legacy/open-source/page.mdx b/apps/web/src/app/(docs)/docs/legacy/open-source/page.mdxnew file mode 100644index 000000000..175d04fcd--- /dev/null+++ b/apps/web/src/app/(docs)/docs/legacy/open-source/page.mdx@@ -0,0 +1,10 @@+# Open source++E2B is fully open source including the infrastructure layer.++- [E2B monorepo containing the SDKs, CLI, and docs](https://github.com/e2b-dev/e2b)+- [E2B infrastructure](https://github.com/e2b-dev/infra)+- [Example code interpreter ChatGPT plugin](https://github.com/e2b-dev/llm-code-interpreter)+- [List of awesome SDKs for AI agents](https://github.com/e2b-dev/awesome-sdks-for-ai-agents)+- [List of awesome AI agents](https://github.com/e2b-dev/awesome-ai-agents)+{/* - [E2B cookbook](https://github.com/e2b-dev/e2b-cookbook) */}diff --git a/apps/web/src/app/(docs)/docs/legacy/page.mdx b/apps/web/src/app/(docs)/docs/legacy/page.mdxnew file mode 100644index 000000000..de638db03--- /dev/null+++ b/apps/web/src/app/(docs)/docs/legacy/page.mdx@@ -0,0 +1,55 @@+import { Guides } from '@/components/Guides'+import { UseCases } from '@/components/UseCases'+import { HeroPattern } from '@/components/HeroPattern'+import { Button } from '@/components/Button'++<HeroPattern />++# Code interpreting for your AI app+E2B's [Code Interpreter SDK](https://github.com/e2b-dev/code-interpreter) allows you to add code interpreting capabilities to your AI apps. {{ className: 'lead' }}++With code interpreting, you can build apps like:+- AI code execution+- Data analysis with AI+- AI tutors+- Reasoning modules for LLM++## Quickstart++### 1. Install SDK+<CodeGroup isRunnable={false}>+```bash {{ language: 'js' }}+npm i @e2b/code-interpreter+```+```bash {{ language: 'python' }}+pip install e2b_code_interpreter+```+</CodeGroup>++### 2. Execute code with code interpreter inside sandbox+<CodeGroup isRunnable={false}>+```ts {{ language: 'js' }}+import { CodeInterpreter } from '@e2b/code-interpreter'++const sandbox = await CodeInterpreter.create()+await sandbox.notebook.execCell('x = 1')++const execution = await sandbox.notebook.execCell('x+=1; x')+console.log(execution.text) // outputs 2++await sandbox.close()+```++```py {{ language: 'python' }}+from e2b_code_interpreter import CodeInterpreter++with CodeInterpreter() as sandbox:+ sandbox.notebook.exec_cell("x = 1")++ execution = sandbox.notebook.exec_cell("x+=1; x")+ print(execution.text) # outputs 2+```+</CodeGroup>++### 3. Hello World guide+Dive depeer and check out the [JavaScript](/docs/hello-world/js) and [Python](/docs/hello-world/py) Hello World guides to learn how to connect the code interpreter to LLMs.diff --git a/apps/web/src/app/(docs)/docs/legacy/pricing/SwitchToHobbyButton.tsx b/apps/web/src/app/(docs)/docs/legacy/pricing/SwitchToHobbyButton.tsxnew file mode 100644index 000000000..8d1aab5f0--- /dev/null+++ b/apps/web/src/app/(docs)/docs/legacy/pricing/SwitchToHobbyButton.tsx@@ -0,0 +1,57 @@+'use client'++import Link from 'next/link'+import { useEffect, useState } from 'react'+import { Button } from '@/components/Button'+import { Team, useUser } from '@/utils/useUser'+import { tiers } from '@/utils/consts'+import Spinner from '@/components/Spinner'++import { TierActiveTag } from './TierActiveTag'++function SwitchToHobbyButton({ team }: { team: Team }) {+ const { user, isLoading } = useUser()+ const [url, setURL] = useState('')++ useEffect(function getBillingURL() {+ if (!user) return+ const u = `${process.env.NEXT_PUBLIC_STRIPE_BILLING_URL}?prefilled_email=${user.teams[0].email}`+ setURL(u)+ }, [user])++ if (isLoading) {+ return <Spinner />+ }++ if (!user) {+ return (+ <Link href="/auth/sign-up">+ <Button>Sign Up</Button>+ </Link>+ )+ }++ // Only show the button if the user is on the base_v1 tier.+ // Teams can have custom tiers. We only want the button to users on the free tier.+ if (team.tier !== tiers.hobby.id && team.tier !== tiers.pro.id) {+ return null+ }++ return (+ <div className="flex flex-col items-start justify-start gap-1 my-4">+ <div className="flex items-center justify-start gap-2">+ {team.tier === tiers.hobby.id && (+ <TierActiveTag />+ )}++ {team.tier !== tiers.hobby.id && (+ <a href={url} target="_blank" rel="noreferrer noopener">+ <Button>Switch to {tiers.hobby.displayName}</Button>+ </a>+ )}+ </div>+ </div>+ )+}++export default SwitchToHobbyButtondiff --git a/apps/web/src/app/(docs)/docs/legacy/pricing/SwitchToProButton.tsx b/apps/web/src/app/(docs)/docs/legacy/pricing/SwitchToProButton.tsxnew file mode 100644index 000000000..34eb35201--- /dev/null+++ b/apps/web/src/app/(docs)/docs/legacy/pricing/SwitchToProButton.tsx@@ -0,0 +1,89 @@+'use client'++import Link from 'next/link'+import { Button } from '@/components/Button'+import { Team, useUser } from '@/utils/useUser'+import { useState } from 'react'+import { tiers } from '@/utils/consts'+import Spinner from '@/components/Spinner'++import { TierActiveTag } from './TierActiveTag'++const billingApiURL = process.env.NEXT_PUBLIC_BILLING_API_URL+function createCheckout(tierID: string, teamID: string) {+ return fetch(`${billingApiURL}/checkouts`, {+ method: 'POST',+ headers: {+ 'Content-Type': 'application/json',+ },+ body: JSON.stringify({+ teamID,+ tierID,+ }),+ })+}++function SwitchTierButton({ team }: { team: Team }) {+ const { user, isLoading } = useUser()+ const [error, setError] = useState('')++ async function createCheckoutSession() {+ setError('')++ if (!user) {+ return setError('You must be logged in to switch to Pro.')+ }++ const response = await createCheckout(tiers.pro.id, user.teams[0].id)+ const responseData = await response.json()++ if (responseData.error) {+ setError(responseData.error)+ } else {+ window.open(responseData.url, '_blank')+ }+ }++ if (isLoading) {+ return <Spinner />+ }+++ if (!user) {+ return (+ <Link href="/auth/sign-up">+ <Button>Sign Up</Button>+ </Link>+ )+ }+++ // Only show the button if the user is on the base_v1 tier.+ // Teams can have custom tiers. We only want the button to users on the free tier.+ if (!billingApiURL || (team.tier !== tiers.hobby.id && team.tier !== tiers.pro.id)) {+ return+ }++ return (+ <div className="flex flex-col items-start justify-start gap-1 my-4">+ <div className="flex items-center justify-start gap-2">+ {team.tier === tiers.pro.id && (+ <TierActiveTag />+ )}+ {team.tier !== tiers.pro.id && (+ <Button+ onClick={createCheckoutSession}+ >+ Switch to Pro+ </Button>+ )}+ </div>++ {error && (+ <span className="text-red-500 font-medium">{error}</span>+ )}+ </div>+ )+}++export default SwitchTierButtondiff --git a/apps/web/src/app/(docs)/docs/legacy/pricing/TierActiveTag.tsx b/apps/web/src/app/(docs)/docs/legacy/pricing/TierActiveTag.tsxnew file mode 100644index 000000000..5203ce8a7--- /dev/null+++ b/apps/web/src/app/(docs)/docs/legacy/pricing/TierActiveTag.tsx@@ -0,0 +1,9 @@++export function TierActiveTag() {+ return (+ <span className="text-sm font-bold text-green-500">+ ACTIVE+ </span>+ )+}+diff --git a/apps/web/src/app/(docs)/docs/legacy/pricing/page.mdx b/apps/web/src/app/(docs)/docs/legacy/pricing/page.mdxnew file mode 100644index 000000000..cd25c9756--- /dev/null+++ b/apps/web/src/app/(docs)/docs/legacy/pricing/page.mdx@@ -0,0 +1,66 @@+import ManageBilling from '@/components/ManageBilling'+import SandboxSpec from '@/components/SandboxSpec'++# Pricing++[Manage Billing](/dashboard?tab=billing)++We charge you based on your real sandbox usage. All new users get one-time free $100 worth of usage in credits. {{ className: 'lead' }}++---++# Plans pricing+Additionally to the usage costs, you can also select a tier that includes dedicated support, prioritized features, and higher sandbox limits.++## Hobby tier+**$0/month + usage costs**++- One-time $100 of usage in credits+- Community support+- Up to 1 hour sandbox session length+- Up to 20 concurrently running sandboxes++## Pro tier+**$150/month + usage costs**++- One-time $100 of usage in credits+- Dedicated Slack channel with live Pro support from our team+- Prioritized features+- Customize your [sandbox compute](/docs/sandbox/compute)+- Up to 24 hours sandbox session length+- Up to 100 concurrently running sandboxes+++If you need any additional features or resources, please [reach out to us](/docs/getting-help) with your use case.++---++# Compute pricing+We charge per second of a running sandbox.+- vCPU: $0.000014 per second (~$0.05 per hour)+- GiB RAM: $0.0000045 per second (~$0.018 per hour)+- GiB storage: Free++<Note>+1 GiB is equal to 1,024 MiB+</Note>++## Sandbox compute+Pro customers can customize the sandbox with **any combination** of the CPU and RAM based on the following tables.++<Note>+<b>By default your sandbox has 2 vCPU and 512 MiB RAM.</b>++To customize your sandbox compute, you need to build your custom sandbox template using the [E2B CLI](/docs/cli/installation).+Run [`e2b template build`](/docs/cli/commands#template-build) and specify the `--cpu-count` and `--memory-mb` options.++For example this custom build gives your sandbox 8 vCPU and 4GiB of RAM+```sh+e2b template build --cpu-count 8 --memory-mb 4096+```+</Note>++<SandboxSpec/>++<br/>+[Let us know](/docs/getting-help) if you need more powerful compute.diff --git a/apps/web/src/app/(docs)/docs/legacy/sandbox/api/cwd/page.mdx b/apps/web/src/app/(docs)/docs/legacy/sandbox/api/cwd/page.mdxnew file mode 100644index 000000000..2ee3543dd--- /dev/null+++ b/apps/web/src/app/(docs)/docs/legacy/sandbox/api/cwd/page.mdx@@ -0,0 +1,21 @@+# Current Working Directory++You can set a working directory either for the whole sandbox, a filesystem operation, or a new process.++## Sandbox++If the current working directory for the sandbox is not set, it will default to the home directory - `/home/user`.++<CodeGroupAutoload path="cwd/sandbox" />++## Filesystem++All filesystem operations with relative paths are relative to the current working directory.++<CodeGroupAutoload path="cwd/filesystem"/>++## Process++If you set a working directory for the sandbox, all processes will inherit it. You can override it for each process.++<CodeGroupAutoload path="cwd/process"/>diff --git a/apps/web/src/app/(docs)/docs/legacy/sandbox/api/debugging/page.mdx b/apps/web/src/app/(docs)/docs/legacy/sandbox/api/debugging/page.mdxnew file mode 100644index 000000000..f5a7daa80--- /dev/null+++ b/apps/web/src/app/(docs)/docs/legacy/sandbox/api/debugging/page.mdx@@ -0,0 +1,14 @@+export const sections = [+ { title: 'Logging', id: 'logging' },+]++# Logging++<LanguageSpecificText>+ ```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." }}+ ```+ ```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." }}+ ```+</LanguageSpecificText>++<CodeGroupAutoload path="logging/e2b_logging" isRunnable={false} />diff --git a/apps/web/src/app/(docs)/docs/legacy/sandbox/api/download/page.mdx b/apps/web/src/app/(docs)/docs/legacy/sandbox/api/download/page.mdxnew file mode 100644index 000000000..27fddc6e9--- /dev/null+++ b/apps/web/src/app/(docs)/docs/legacy/sandbox/api/download/page.mdx@@ -0,0 +1,9 @@+# Download files from the sandbox+Any file inside the sandbox can be downloaded using the `downloadFile`/`download_file` method.++## Use case for downloading files+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.+This LLM-generated code might produce some files like charts, CSV files, or PDF files that you want to download to your machine.++<CodeGroupAutoload path="basics/download_file" isRunnable={false}/>+diff --git a/apps/web/src/app/(docs)/docs/legacy/sandbox/api/envs/page.mdx b/apps/web/src/app/(docs)/docs/legacy/sandbox/api/envs/page.mdxnew file mode 100644index 000000000..5db20d3ec--- /dev/null+++ b/apps/web/src/app/(docs)/docs/legacy/sandbox/api/envs/page.mdx@@ -0,0 +1,21 @@+# Setting environment variables++## Global environment variables+You can set the sandbox's global environment variables when initializing a new sandbox.+<CodeGroupAutoload+ path="basics/set_env_vars"+ isRunnable={false}+/>+++## Environment variables per process+Alternatively, you can set environment variables when starting a new process. These environment variables are accessible only for this process.++<Note>+Environment variables set when starting a new process have precedence over the environment variables set when initializing the sandbox.+</Note>++<CodeGroupAutoload+ path="basics/process_env_vars"+ isRunnable={true}+/>\ No newline at end of filediff --git a/apps/web/src/app/(docs)/docs/legacy/sandbox/api/filesystem/page.mdx b/apps/web/src/app/(docs)/docs/legacy/sandbox/api/filesystem/page.mdxnew file mode 100644index 000000000..60babcfe6--- /dev/null+++ b/apps/web/src/app/(docs)/docs/legacy/sandbox/api/filesystem/page.mdx@@ -0,0 +1,56 @@+## List directory++<CodeGroupAutoload+ path="basics/fs_ls"+ isRunnable={true}+/>++## Create directory++Create directory and all parent directories.++<CodeGroupAutoload+ path="basics/fs_mkdir"+ isRunnable={false}+/>++## Write to file++When writing to a file that doesn't exist, the file will get created.++When writing to a file that already exists, the file will get overwritten.++When writing to a file that's in a directory that doesn't exist, you'll get an error.++<CodeGroupAutoload+ path="basics/fs_write"+ isRunnable={true}+/>++## Read from file++<CodeGroupAutoload+ path="basics/fs_read"+ isRunnable={true}+/>++## Write bytes++<CodeGroupAutoload+ path="basics/fs_write_bytes"+ isRunnable={true}+/>++## Read bytes++<CodeGroupAutoload+ path="basics/fs_read_bytes"+ isRunnable={true}+/>++## Watch directory for changes++<CodeGroupAutoload+ path="basics/fs_watch"+ isRunnable={true}+/>diff --git a/apps/web/src/app/(docs)/docs/legacy/sandbox/api/metadata/page.mdx b/apps/web/src/app/(docs)/docs/legacy/sandbox/api/metadata/page.mdxnew file mode 100644index 000000000..f23a3c2cb--- /dev/null+++ b/apps/web/src/app/(docs)/docs/legacy/sandbox/api/metadata/page.mdx@@ -0,0 +1,8 @@+## Sandbox metadata++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.++<CodeGroupAutoload+ path="basics/metadata"+ isRunnable={true}+/>diff --git a/apps/web/src/app/(docs)/docs/legacy/sandbox/api/process/page.mdx b/apps/web/src/app/(docs)/docs/legacy/sandbox/api/process/page.mdxnew file mode 100644index 000000000..0519cf5ef--- /dev/null+++ b/apps/web/src/app/(docs)/docs/legacy/sandbox/api/process/page.mdx@@ -0,0 +1,58 @@+# Starting process inside a sandbox++Here are the basic operations you can do with the process inside the sandbox:++- [Start process](/docs/sandbox/api/process#start-process)+- [Stop process](/docs/sandbox/api/process#stop-process)+- [Stdout](/docs/sandbox/api/process#stream-stdout)+- [Stdin](/docs/sandbox/api/process#send-stdin)+- [Stderr](/docs/sandbox/api/process#stream-stderr)+- [On exit](/docs/sandbox/api/process#on-process-exit)++## Start process++<CodeGroupAutoload+ path="basics/process_start"+ isRunnable={true}+/>++## Stop process++<CodeGroupAutoload+ path="basics/process_stop"+ isRunnable={false}+/>++## Stream stdout++Set either stdout handler for the whole sandbox level or per process.++<CodeGroupAutoload+ path="basics/process_stream_stdout"+ isRunnable={false}+/>++## Stream stderr++Set either stderr handler for the whole sandbox level or per process.++<CodeGroupAutoload+ path="basics/process_stream_stderr"+ isRunnable={false}+/>++## On process exit++Set either on exit handler for the whole sandbox level or per process.++<CodeGroupAutoload+ path="basics/process_exit"+ isRunnable={false}+/>++## Send stdin++<CodeGroupAutoload+ path="basics/process_write_stdin"+ isRunnable={true}+/>\ No newline at end of filediff --git a/apps/web/src/app/(docs)/docs/legacy/sandbox/api/reconnect/page.mdx b/apps/web/src/app/(docs)/docs/legacy/sandbox/api/reconnect/page.mdxnew file mode 100644index 000000000..f97f8b001--- /dev/null+++ b/apps/web/src/app/(docs)/docs/legacy/sandbox/api/reconnect/page.mdx@@ -0,0 +1,42 @@+# Connect to running sandbox++Disconnect and reconnect later to the same sandbox while keeping it alive {{ className: 'lead' }}++## Description++The sandboxes are by default kept alive only when connected to them. When you disconnect from a sandbox, it will be destroyed.++If you want to keep the sandbox alive even after disconnecting from it, you can explicitly say for how long you want to keep it alive. You can then disconnect from the sandbox and reconnect to it later. This can be useful for example in a **serverless environment** or **chatbot application**.++The duration limit to keep the sandbox alive is 1 hour. If you need more, feel free to [reach out to us](/docs/getting-help) with your use.++## Keep sandbox alive++The example below shows how to disconnect from a running sandbox and reconnect to it again while keeping the sandbox alive.++<CodeGroupAutoload+ path="reconnect/reconnect_1"+ isRunnable={false}+/>++Call the `keep_alive`/`keepAlive` method on the sandbox instance to keep it alive. You can specify the preferred duration, as a multiple of a default time unit, which is+- 1ms in JS+- 1s in Python.++You then disconnect from the sandbox.++<CodeGroupAutoload+ path="reconnect/reconnect_2"+ isRunnable={false}+/>++You can then reconnect to the sandbox from anywhere.++<CodeGroupAutoload+ path="reconnect/reconnect_3"++ isRunnable={false}+/>++## Use sandbox metadata+Sandbox metadata can be very useful to store information about the sandbox. You can use it to store the user ID or any other information you need to keep track of and then use this info for reconnecting to the sandbox. You can read more about sandbox metadata [here](/docs/sandbox/api/metadata).\ No newline at end of filediff --git a/apps/web/src/app/(docs)/docs/legacy/sandbox/api/timeouts/page.mdx b/apps/web/src/app/(docs)/docs/legacy/sandbox/api/timeouts/page.mdxnew file mode 100644index 000000000..82809fb9e--- /dev/null+++ b/apps/web/src/app/(docs)/docs/legacy/sandbox/api/timeouts/page.mdx@@ -0,0 +1,12 @@+# Timeouts++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.**++## Timeout creating sandbox+<CodeGroupAutoload path="timeout/timeout_sandbox" />++## Timeout process+<CodeGroupAutoload path="timeout/timeout_process" />++## Timeout filesystem operations+<CodeGroupAutoload path="timeout/timeout_filesystem" />\ No newline at end of filediff --git a/apps/web/src/app/(docs)/docs/legacy/sandbox/api/upload/page.mdx b/apps/web/src/app/(docs)/docs/legacy/sandbox/api/upload/page.mdxnew file mode 100644index 000000000..27362f525--- /dev/null+++ b/apps/web/src/app/(docs)/docs/legacy/sandbox/api/upload/page.mdx@@ -0,0 +1,12 @@+# Upload files to sandbox+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.++## Use case for uploading files+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.++<Note>+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).+</Note>++<CodeGroupAutoload path="basics/upload_file" isRunnable={false}/>+diff --git a/apps/web/src/app/(docs)/docs/legacy/sandbox/api/url/page.mdx b/apps/web/src/app/(docs)/docs/legacy/sandbox/api/url/page.mdxnew file mode 100644index 000000000..21e2f2f4f--- /dev/null+++ b/apps/web/src/app/(docs)/docs/legacy/sandbox/api/url/page.mdx@@ -0,0 +1,10 @@+# Sandbox URL+Each sandbox has its own URL that you can use to connect to any service running inside the sandbox.++For example, you can start a server inside the sandbox and connect to it from your browser.++<CodeGroupAutoload path="basics/get_url" isRunnable={true} />+++If you want to get an URL for a specific port inside the sandbox, pass the port number to the `getHostname()`/`get_hostname()` method.+<CodeGroupAutoload path="basics/get_url_port" isRunnable={true} />diff --git a/apps/web/src/app/(docs)/docs/legacy/sandbox/compute/page.mdx b/apps/web/src/app/(docs)/docs/legacy/sandbox/compute/page.mdxnew file mode 100644index 000000000..9c05f7315--- /dev/null+++ b/apps/web/src/app/(docs)/docs/legacy/sandbox/compute/page.mdx@@ -0,0 +1,24 @@+import SandboxSpec from '@/components/SandboxSpec'++# Sandbox compute+Pro customers can customize the sandbox with **any combination** of the CPU and RAM based on the following tables.++Read a dedicated page to [learn more about pricing](/docs/pricing).++<Note>+<b>By default your sandbox has 2 vCPU and 512 MiB RAM.</b>++To customize your sandbox compute, you need to build your custom sandbox template using the [E2B CLI](/docs/cli/installation).+Run [`e2b template build`](/docs/cli/commands#template-build) and specify the `--cpu-count` and `--memory-mb` options.++For example, this custom build command gives your sandbox 8 vCPU and 4GiB of RAM+```sh+e2b template build --cpu-count 8 --memory-mb 4096+```+</Note>++<SandboxSpec/>++<br/>++[Let us know](/docs/getting-help) if you need more powerful compute.\ No newline at end of filediff --git a/apps/web/src/app/(docs)/docs/legacy/sandbox/custom/page.mdx b/apps/web/src/app/(docs)/docs/legacy/sandbox/custom/page.mdxnew file mode 100644index 000000000..e21b47066--- /dev/null+++ b/apps/web/src/app/(docs)/docs/legacy/sandbox/custom/page.mdx@@ -0,0 +1,49 @@+# Customizing Sandbox+Custom sandboxes allows you to spawn a sandbox with a pre-defined environment by you and then control it with our SDK.++You can build a custom sandbox by creating the [Sandbox Template](/docs/sandbox/templates/overview). Sandbox template is a Dockerfile that describes the environment of your sandbox.++Once you build your custom sandbox template, you can spawn multiple isolated sandboxes from it.++## How it works+1. [Provide the sandbox template file](/docs/sandbox/templates/template-file)+1. [Build a sandbox template from it using our CLI](/docs/guide/custom-sandbox#4-build-custom-sandbox)+1. Get a template ID from the CLI:+ ```sh+ # ... truncated CLI output+ ✅ Building sandbox template 3y5bvra6kgq0kaumgztu finished.+ ```+1. Pass the template ID to our SDK like this:+ <CodeGroup title="Using custom sandbox with SDK" isRunnable={false}>+ ```js {{ language: 'js' }}+ import { Sandbox } from 'e2b'++ // Create new sandbox+ const sandbox = await Sandbox.create({+ template: '<sandbox-template-id>', // You get sandbox template ID from the CLI after you run `$ e2b build`+ })++ // Close sandbox once done+ await sandbox.close()+ ```++ ```python {{ language: 'python' }}+ from e2b import Sandbox++ # Create new sandbox+ sandbox = Sandbox(+ template="<sandbox-template>", # You get sandbox template from the CLI after you run `$ e2b build`+ )++ # Close sandbox once done+ sandbox.close()+ ```+ </CodeGroup>+1. Run the code and we spawn a sandbox based on the template you built in step 2++Now you can do step 4/5 multiple times using the same ID, always creating a separate sandbox instance.+++<Note>+Read more on [Sandbox Templates](/docs/sandbox/templates/overview) if you want to create your own custom sandbox.+</Note>\ No newline at end of filediff --git a/apps/web/src/app/(docs)/docs/legacy/sandbox/overview/features.tsx b/apps/web/src/app/(docs)/docs/legacy/sandbox/overview/features.tsxnew file mode 100644index 000000000..4daec5d8e--- /dev/null+++ b/apps/web/src/app/(docs)/docs/legacy/sandbox/overview/features.tsx@@ -0,0 +1,30 @@+/* eslint-disable react/jsx-key */+import Link from 'next/link'++export const features = [+ <span>+ <Link href="https://github.com/e2b-dev/e2b" target="_blank" rel="noreferrer noopener">Open-source</Link> sandbox for LLM+ </span>,+ 'A full VM environment',+ 'No need for orchestration or infrastructure management',+ 'Ability to give each user of your AI app their own isolated environment',+ <span>+ <Link href="/docs/getting-started/installation">+ Python & Node.js SDK+ </Link>+ {' '}for controling the sandbox's{' '}+ <Link href="/docs/sandbox/api/filesystem">+ filesystem+ </Link>+ ,{' '}+ <Link href="/docs/sandbox/api/process">+ processes+ </Link>+ , and more.+ </span>,+ 'Support for up to 24h long-running sandbox sessions',+ <span>+ Ability to <Link href="/docs/sandbox/api/upload">upload files</Link> to the sandbox and <Link href="/docs/sandbox/api/download">download files </Link>from the sandbox,+ </span>,+ // "Premade sandbox for the Code Interpreter / Advanced Data Analysis and AI-powered browsers",+]diff --git a/apps/web/src/app/(docs)/docs/legacy/sandbox/overview/page.mdx b/apps/web/src/app/(docs)/docs/legacy/sandbox/overview/page.mdxnew file mode 100644index 000000000..250facfb9--- /dev/null+++ b/apps/web/src/app/(docs)/docs/legacy/sandbox/overview/page.mdx@@ -0,0 +1,70 @@+import Image from 'next/image'+import imgModel from '@/images/ai-app-e2b-sandbox-model.png'+import { Check } from 'lucide-react'++import { features } from './features'++# Overview+**The E2B's sandboxes are isolated cloud environments made specifcially for AI code interpreting or code execution.**++The E2B sandboxes are an ideal fit as a playground for AI assistants like coding copilots, code interpreters, AI data analysts, AI browser assistants, and other AI-powered apps.++## Features+<div className="flex flex-col items-start space-y-2">+ {features.map((feature, i) => (+ <span key={i} className="flex items-center space-x-2">+ <Check+ className="w-4 h-4 text-brand-400"+ />+ <span className="text-brand-100">{feature}</span>+ </span>+ ))}+</div>++With more features coming in the future:+- Out-of-the box working monitoring of what's happening inside the sandbox+- LLM Access control to data, tools, and any internet requests+- Statefull sandboxes+- Resumable workflows (pause sandbox and load it later)+- Unlimited long-running sandboxed++## Comparison to other services+With LLMs, it's not safe to let the LLM run code and use tools in the same environment where your application is running.++You need to isolate the LLM from the rest of your app and make sure that the LLM can't access your data, tools, and the internet without you knowing about it or giving it explicit access. You need to make sure that the LLM can run untrusted code safely and install libraries on fly.+The AI apps also often need to run for a long time, and need to be resumable - for example, when waiting for user's consent to make an internet purchase, you need to be able to pause the AI app and resume it later without losing the whole state.++Additionally, the AI apps present need for a new model:+- How can every user of your AI app have the environment described above for themselves?+- How can developers easily manage and orchestrate these environments?+- How can developers easily debug these environments?+- How to let LLMs use the same tools as humans do on their computers (for example browser, code linters, autocomplete, etc)?+- How can developers easily monitor what's happening inside these environments?+- How to scale these environments to billions of instances?++<Image+ src={imgModel}+ className="rounded w-full"+ alt="Separate E2B Sandbox for each instance of your AI app"+ unoptimized+/>++E2B Sandboxes are made exactly to solve these challenges. The sandbox is like an isolated runtime or playground for the LLM. **We give you our SDK to spawn and control these sandboxes.**+++## How sandboxes work under the hood+When you create a new sandbox session, we start a small VM in our cloud. This VM is running a Ubuntu OS and it takes about 400-600ms to start it.++Inside this sandbox, your AI app can [run code and start any programs](/docs/sandbox/api/process), access the internet to download or upload data, use the [filesystem](/docs/sandbox/api/filesystem), start long running processes such as web servers, and more.+You can also [upload](/docs/sandbox/api/upload) to sandbox and [download](/docs/sandbox/api/upload) from sandbox any file you want.++To start and control the sandbox, use the [E2B SDK](/docs/getting-started/installation) for Python or JavaScript.++<CodeGroupAutoload+ title="Starting Sandbox"+ path="basics/init"+/>++<Note>+Make sure you have the `E2B_API_KEY` environment variable set with your [API key](/docs/getting-started/api-key).+</Note>diff --git a/apps/web/src/app/(docs)/docs/legacy/sandbox/templates/overview/page.mdx b/apps/web/src/app/(docs)/docs/legacy/sandbox/templates/overview/page.mdxnew file mode 100644index 000000000..2b062e002--- /dev/null+++ b/apps/web/src/app/(docs)/docs/legacy/sandbox/templates/overview/page.mdx@@ -0,0 +1,69 @@+import Image from 'next/image'+import imgCustomSandbox from '@/images/custom-sandbox.png'++# Custom Sandbox++Custom sandboxes allow you to spawn a sandbox with an environment predefined by you and then control it with our SDK.++<Note>+The E2B Sandbox is a secure way to run your AI app. It is a long-running cloud environment where you can let any LLM (GPTs, Claude, local LLMs, etc) use tools exactly like you would do locally.++Read more about E2B Sandboxes [here](/docs/sandbox/overview).+</Note>+++## How Custom Sandboxes Work++<Note>+Follow our [guide](/docs/guide/custom-sandbox) on how to create a custom sandbox.+</Note>++1. You build a custom sandbox by creating the [Sandbox Template](/docs/sandbox/templates/template-file) which is a Dockerfile describing the environment of your sandbox.+1. Build a sandbox template from it using our CLI+1. Get a template ID from the CLI:+ ```sh+ # ... truncated CLI output+ ✅ Building sandbox template 3y5bvra6kgq0kaumgztu finished.+ ```+1. Pass the template ID to our SDK like this:+ <CodeGroup title="Using custom sandbox with SDK" isRunnable={false}>+ ```js {{ language: 'js' }}+ import { Sandbox } from 'e2b'++ // Create new sandbox+ const sandbox = await Sandbox.create({+ // You get sandbox template from the CLI after you run `$ e2b build`+ template: '<sandbox-template>', // $HighlightLine+ })++ // Close sandbox once done+ await sandbox.close()+ ```++ ```python {{ language: 'python' }}+ from e2b import Sandbox++ # Create new sandbox+ sandbox = Sandbox(+ # You get sandbox template from the CLI after you run `$ e2b build`+ template="<sandbox-template>", # $HighlightLine+ )++ # Close sandbox once done+ sandbox.close()+ ```+ </CodeGroup>+1. Run the code and we spawn a sandbox based on the template you built in step 2++Once you build your custom sandbox template, you can spawn multiple isolated sandboxes from it. You can repeat the steps 4, 5 multiple times using the same ID, always creating a separate sandbox instance.++<Image+ src={imgCustomSandbox}+ className="rounded w-full"+ alt="Graphics explaining how custom sandbox works"+ unoptimized+/>++<Note>+Follow [our guide](/docs/guide/custom-sandbox) on how to create a custom sandbox.+</Note>\ No newline at end of filediff --git a/apps/web/src/app/(docs)/docs/legacy/sandbox/templates/start-cmd/page.mdx b/apps/web/src/app/(docs)/docs/legacy/sandbox/templates/start-cmd/page.mdxnew file mode 100644index 000000000..73f4b68ba--- /dev/null+++ b/apps/web/src/app/(docs)/docs/legacy/sandbox/templates/start-cmd/page.mdx@@ -0,0 +1,91 @@+# Start Command+The start command allows you to specify a command that will be **already running** when you spawn your custom sandbox.+This way, you can for example have running servers or seeded databases inside the sandbox that are already fully ready when you spawn the sandbox using the SDK and with zero waiting time for your users during the runtime.++The idea behind the start command feature is to lower the wait times for your users and have everything ready for your users when you spawn your sandbox.+++## How to add start command++When you are building a sandbox template you can specify the start command by using the [`-c`](/docs/cli/commands#build) option:++```bash+e2b build -c "<your-start-command>"+```++When you spawn the custom sandbox you built, the start command will be already running if there was no error when we tried to execute it.+++## How it works+Every time you are building a [custom sandbox](/docs/guide/custom-sandbox), we create a container based on the [`e2b.Dockerfile`](/docs/sandbox/templates/template-file) file you create in the process.+We extract the container's filesystem and start a sandbox with this extracted filesystem.+We call this sandbox a _template sandbox_.++Then, these steps happen:++ 1. We take the running template sandbox.+ 2. (Only if you specified the start command, otherwise this step is skipped) **Execute the start command and wait 15 seconds**.+ 3. Snapshot the sandbox and make it ready for you to spawn it with the SDK.+++<Note title="Sandbox Snapshot">+Snapshots are saved running sandboxes. We serialize and save the whole sandbox's filesystem together with all the running processes in a way that can be loaded later.++This allows us to load the sandbox in a few hundred milliseconds any time later with all the processes already running and the filesystem exactly as it was.+</Note>+++## Limits+- The network isn't accessible when running the start command.+- We wait 15 seconds after we execute the start command before we snapshot the sandbox.+++## Logs+You can retrieve the start command's logs using the SDK during runtime:++<CodeGroup title="Check start command logs" isRunnable={false}>+```js {{ language: 'js' }}+import { Sandbox } from 'e2b'++// Spawn your custom sandbox+const sandbox = await Sandbox.create({+ id: 'my-agent-sandbox',+ // If you specify onStderr and onStdout handlers when spawning the sandbox+ // you will see logs from the start command.+ onStderr: output => console.log("stderr", output.line), // $HighlightLine+ onStdout: output => console.log("stdout", output.line), // $HighlightLine+})++// Close sandbox once done+await sandbox.close()+```++```python {{ language: 'python' }}+from e2b import Sandbox++# Spawn your custom sandbox+sandbox = Sandbox(+ id="my-agent-sandbox",+ # If you specify on_stderr and on_stdout handlers when spawning the sandbox+ # you will see logs from the start command.+ on_stderr=lambda output: print("stderr", output.line), # $HighlightLine+ on_stdout=lambda output: print("stdout", output.line), # $HighlightLine+)++# Close sandbox once done+sandbox.close()+```+</CodeGroup>+++## Sandbox template config+The start command is specified inside the `e2b.toml` in the same directory where you ran `e2b build -c "<your-start-command>"`.+<CodeGroup isFileName title="e2b.toml" isRunnable={false}>+```toml+# This is a config for E2B sandbox template+template_id = "1wdqsf9le9gk21ztb4mo"+dockerfile = "e2b.Dockerfile"+template_name = "my-agent-sandbox"+start_cmd = "<your-start-command>" # $HighlightLine+```+</CodeGroup>diff --git a/apps/web/src/app/(docs)/docs/legacy/sandbox/templates/template-file/page.mdx b/apps/web/src/app/(docs)/docs/legacy/sandbox/templates/template-file/page.mdxnew file mode 100644index 000000000..be02d47a0--- /dev/null+++ b/apps/web/src/app/(docs)/docs/legacy/sandbox/templates/template-file/page.mdx@@ -0,0 +1,50 @@+import Image from 'next/image'+import imgCustomSandbox from '@/images/custom-sandbox.png'++# Template File++The template file is a Dockerfile named `e2b.Dockerfile`. The template file is used to define an environment for your custom sandbox. {{ className: 'lead' }}++<Note>+Follow our [guide](/docs/guide/custom-sandbox) on how to create a custom sandbox.+</Note>++<Image+ src={imgCustomSandbox}+ className="rounded w-full"+ alt="Graphics explaining how custom sandbox works"+ unoptimized+/>++## `e2b.Dockerfile`+The Dockerfile must be Debian based (e.g. Ubuntu). Only the following [Dockerfile commands](https://docs.docker.com/engine/reference/builder/) are supported:+ - `FROM`+ - `ADD`+ - `COPY`+ - `RUN`+ - `WORKDIR`+ - `ARG`++## Example++The following example template file defines a Ubuntu-based sandbox with installed GitHub CLI.+++<CodeGroup isFileName title="e2b.Dockerfile" isRunnable={false}>+```sh+# You can use most of the Debian-based base images+FROM ubuntu:22.04++# Install dependencies and customize sandbox+RUN apt update \+ && apt install sudo++# Install GitHub CLI+RUN type -p curl >/dev/null || (sudo apt update && sudo apt install curl -y)+RUN curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg \+ && sudo chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg \+ && echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null \+ && sudo apt update \+ && sudo apt install gh -y+```+</CodeGroup>diff --git a/apps/web/src/app/(docs)/docs/legacy/supported/page.mdx b/apps/web/src/app/(docs)/docs/legacy/supported/page.mdxnew file mode 100644index 000000000..b2576bde8--- /dev/null+++ b/apps/web/src/app/(docs)/docs/legacy/supported/page.mdx@@ -0,0 +1,9 @@+# Supported LLMs and AI frameworks+E2B is LLM agnostic - it supports any LLM models and any AI frameworks.++Usually, all you need from the model is just support for tool use. You then use the E2B code interpreter as a tool.+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.++<Note>+Check out our [cookbook](https://github.com/e2b-dev/e2b-cookbook) for examples.+</Note>\ No newline at end of filediff --git a/apps/web/src/components/Navigation/routes.tsx b/apps/web/src/components/Navigation/routes.tsxindex 4906b68d5..206d10138 100644--- a/apps/web/src/components/Navigation/routes.tsx+++ b/apps/web/src/components/Navigation/routes.tsx@@ -1,281 +1,376 @@-import {- BarChart,- Braces,- ChevronRightSquare,- Cog,- Cpu,- DollarSign,- File,- FileDown,- FileUp,- Folder,- FolderTree,- Hammer,- HardDrive,- KeyRound,- Link,- PencilRuler,- PlaySquare,- RefreshCw,- Settings,- ShieldQuestion,- Terminal,- TerminalSquare,- Timer,- Variable,- Wrench,- BookOpen,-} from 'lucide-react'-import Image from 'next/image'-import logoNode from '@/images/logos/node.svg'-import logoPython from '@/images/logos/python.svg'+++++// Three parts+//+// 1. Documentation+// - Concepts - "filesystem", "what is sandbox", ...+// - How to's (guides?) - simple examples of things like "how to run AI-generated code" or "how to install custom packages" or "how to add language runtime" or "how to upload files" or "how to change current working directory" or "how to add another user" or "how to set up environment variables"+// - This could be additionally split into parts like "Customization", "Running AI-generated code"+// - Integrations+// 2. Cookbook?+// 3. API Reference+// - API spec+// - Python SDK+// - JS SDK+//+//+//+//+// Note:+// - We need some kind of "first steps" that's super simple+// - Having something like+// - Maybe have following separate pages:+// - Documentation+// - Reference+// - Integrations+// - Cookbook+//export const routes = [{- title: 'Getting Started',+ title: '',links: [{- title: 'Installation',+ title: 'Home',href: '/docs',},- {- title: 'helloWorld.[ts|js]',- href: '/docs/hello-world/js',- icon: <Image src={logoNode} width={20} height={20} alt="Python logo" />,- isFontMono: true,- },- {- title: 'hello_world.py',- href: '/docs/hello-world/py',- icon: <Image src={logoPython} width={20} height={20} alt="Python logo" />,- isFontMono: true,- },- {- title: 'Supported LLMs and AI frameworks',- href: '/docs/supported',- },- // {- // title: 'What\'s Code Interpreting?',- // href: '/code-interpreting',- // },- {- icon: <KeyRound strokeWidth={1} size={20} />,- title: 'API Key',- href: '/docs/getting-started/api-key',- },- {- icon: <DollarSign strokeWidth={1} size={20} />,- title: 'Pricing',- href: '/docs/pricing',- },- {- icon: <BarChart strokeWidth={1} size={20} />,- title: 'Track usage',- href: '/dashboard?tab=usage',- },- {- icon: <ShieldQuestion strokeWidth={1} size={20} />,- title: 'Getting help',- href: '/docs/getting-help',- },],},{- title: 'Guides',+ title: 'Quickstart',links: [{- icon: <BookOpen strokeWidth={1} size={20} />,- title: 'Guides and examples in cookbook',- href: 'https://github.com/e2b-dev/e2b-cookbook',- },- {- icon: <BookOpen strokeWidth={1} size={20} />,- title: '[SDK Beta] Migration',- href: '/docs/guide/beta-migration',- },- {- icon: <BookOpen strokeWidth={1} size={20} />,- title: '[SDK Beta] Runtimes in Code Interpreter',- href: '/docs/guide/beta-code-interpreter-language-runtimes',+ title: 'Set up E2B Sandbox',+ href: '/docs/installation',},- // {- // icon: <Hammer strokeWidth={1} size={20} />,- // title: 'Guide: Code Interpreter with OpenAI models',- // href: '/guide/simple-gpt4-code-interpreter',- // },- // {- // icon: <Hammer strokeWidth={1} size={20} />,- // title: 'Guide: Secure Sandbox for Devin-like agent',- // href: '/guide/simple-gpt4-code-interpreter',- // },- // {- // icon: <Hammer strokeWidth={1} size={20} />,- // title: 'Guide: Generative UI with Next.js',- // href: '/guide/simple-gpt4-code-interpreter',- // },- // {- // icon: <Hammer strokeWidth={1} size={20} />,- // title: 'Guide: Upload and analyze CSV files with AI',- // href: '/guide/simple-gpt4-code-interpreter',- // },- // {- // icon: <Hammer strokeWidth={1} size={20} />,- // title: 'Guide: Customize sandbox compute (TODO: Move this away from guides?)',- // href: '/guide/simple-gpt4-code-interpreter',- // },- ],+ ]},{- title: 'E2B Code Interpreter',+ title: 'Guides', // How to'slinks: [{- title: 'Installation',- href: '/docs/code-interpreter/installation',+ title: 'Executed AI-generated code',+ href: '/docs/a',},{- icon: <Terminal strokeWidth={1} size={20} />,- title: 'AI Code Execution',- href: '/docs/code-interpreter/execution',+ title: 'Install custom packages',+ href: '/docs/b',},- // {- // icon: <Book strokeWidth={1} size={20} />,- // title: 'Streaming',- // href: '/code-interpreter/examples',- // },- // {- // icon: <Wrench strokeWidth={1} size={20} />,- // title: 'Supported languages',- // href: '/code-interpreter/template',- // },- // {- // icon: <Wrench strokeWidth={1} size={20} />,- // title: 'Preinstalled packages (customization)',- // href: '/code-interpreter/template',- // },{- icon: <Wrench strokeWidth={1} size={20} />,- title: 'Customization',- href: '/docs/code-interpreter/template',+ title: 'Upload & download files',+ href: '/docs/c',},{- icon: <Cog strokeWidth={1} size={20} />,- title: 'Kernels',- href: '/docs/code-interpreter/kernels',- },- ],+ title: 'Customize CPU and RAM',+ href: '/docs/d',+ }+ ]},{- title: 'E2B Sandbox',+ title: 'AI Code Execution',links: [{- title: 'Overview',- href: '/docs/sandbox/overview',- },- {- icon: <Cpu strokeWidth={1} size={20} />,- title: 'Compute',- href: '/docs/sandbox/compute',- },- {- icon: <PencilRuler strokeWidth={1} size={20} />,- title: 'Customization',- href: '/docs/sandbox/custom',+ title: 'Data analysis',+ href: '/docs/code-execution/overview',},{- icon: <Variable strokeWidth={1} size={20} />,- title: 'Environment Variables',- href: '/docs/sandbox/api/envs',+ title: 'Data visualization',+ href: '/docs/code-execution/overview',},{- icon: <FolderTree strokeWidth={1} size={20} />,- title: 'Filesystem',- href: '/docs/sandbox/api/filesystem',+ title: 'Interactive charts',+ href: '/docs/code-execution/overview',},- {- icon: <ChevronRightSquare strokeWidth={1} size={20} />,- title: 'Process',- href: '/docs/sandbox/api/process',- },- {- icon: <Folder strokeWidth={1} size={20} />,- title: 'Working Directory',- href: '/docs/sandbox/api/cwd',- },- {- icon: <Link strokeWidth={1} size={20} />,- title: 'Sandbox URL',- href: '/docs/sandbox/api/url',- },- {- icon: <FileUp strokeWidth={1} size={20} />,- title: 'Upload Files',- href: '/docs/sandbox/api/upload',- },- {- icon: <FileDown strokeWidth={1} size={20} />,- title: 'Download Files',- href: '/docs/sandbox/api/download',- },- {- icon: <Timer strokeWidth={1} size={20} />,- title: 'Timeouts',- href: '/docs/sandbox/api/timeouts',- },- {- icon: <RefreshCw strokeWidth={1} size={20} />,- title: 'Connect to running sandbox',- href: '/docs/sandbox/api/reconnect',- },- {- icon: <Braces strokeWidth={1} size={20} />,- title: 'Sandbox metadata',- href: '/docs/sandbox/api/metadata',- },- ],+ ]},{- title: 'CLI',+ title: 'Filesystem',links: [{- icon: <Settings strokeWidth={1} size={20} />,- title: 'Installation',- href: '/docs/cli/installation',- },- {- icon: <TerminalSquare strokeWidth={1} size={20} />,- title: 'Commands',- href: '/docs/cli/commands',+ title: 'Overview',+ href: '/docs/filesystem/overview',},- ],+ ]},{- title: 'Custom Sandboxes',+ title: 'Commands',links: [{title: 'Overview',- href: '/docs/sandbox/templates/overview',- },- {- icon: <File strokeWidth={1} size={20} />,- title: 'Template File',- href: '/docs/sandbox/templates/template-file',+ href: '/docs/process/overview',},+ ]+ },+ {+ // Maybe move integrations to a separate page?+ title: 'Integrations',+ links: [{- icon: <PlaySquare strokeWidth={1} size={20} />,- title: 'Start Command',- href: '/docs/sandbox/templates/start-cmd',+ title: 'OpenAI',+ href: '/docs/integrations/openai',},{- icon: <Hammer strokeWidth={1} size={20} />,- title: 'Guide: Creating Custom Sandbox',- href: '/docs/guide/custom-sandbox',+ title: 'Vercel AI SDK',+ href: '/docs/integrations/ai-sdk',},{- icon: <HardDrive strokeWidth={1} size={20} />,- title: 'Connecting buckets to persist data',- href: '/docs/guide/connect-bucket',+ title: 'Langchain',+ href: '/docs/integrations/ai-sdk',},- ],+ ]},]++++// export const routes = [+// {+// title: 'Getting Started',+// links: [+// {+// title: 'Installation',+// href: '/docs',+// },+// {+// title: 'helloWorld.[ts|js]',+// href: '/docs/hello-world/js',+// icon: <Image src={logoNode} width={20} height={20} alt="Python logo" />,+// isFontMono: true,+// },+// {+// title: 'hello_world.py',+// href: '/docs/hello-world/py',+// icon: <Image src={logoPython} width={20} height={20} alt="Python logo" />,+// isFontMono: true,+// },+// {+// title: 'Supported LLMs and AI frameworks',+// href: '/docs/supported',+// },+// // {+// // title: 'What\'s Code Interpreting?',+// // href: '/code-interpreting',+// // },+// {+// icon: <KeyRound strokeWidth={1} size={20} />,+// title: 'API Key',+// href: '/docs/getting-started/api-key',+// },+// {+// icon: <DollarSign strokeWidth={1} size={20} />,+// title: 'Pricing',+// href: '/docs/pricing',+// },+// {+// icon: <BarChart strokeWidth={1} size={20} />,+// title: 'Track usage',+// href: '/dashboard?tab=usage',+// },+// {+// icon: <ShieldQuestion strokeWidth={1} size={20} />,+// title: 'Getting help',+// href: '/docs/getting-help',+// },+// ],+// },+// {+// title: 'Guides',+// links: [+// {+// icon: <BookOpen strokeWidth={1} size={20} />,+// title: 'Guides and examples in cookbook',+// href: 'https://github.com/e2b-dev/e2b-cookbook',+// },+// {+// icon: <BookOpen strokeWidth={1} size={20} />,+// title: '[SDK Beta] Migration',+// href: '/docs/guide/beta-migration',+// },+// {+// icon: <BookOpen strokeWidth={1} size={20} />,+// title: '[SDK Beta] Runtimes in Code Interpreter',+// href: '/docs/guide/beta-code-interpreter-language-runtimes',+// },+// // {+// // icon: <Hammer strokeWidth={1} size={20} />,+// // title: 'Guide: Code Interpreter with OpenAI models',+// // href: '/guide/simple-gpt4-code-interpreter',+// // },+// // {+// // icon: <Hammer strokeWidth={1} size={20} />,+// // title: 'Guide: Secure Sandbox for Devin-like agent',+// // href: '/guide/simple-gpt4-code-interpreter',+// // },+// // {+// // icon: <Hammer strokeWidth={1} size={20} />,+// // title: 'Guide: Generative UI with Next.js',+// // href: '/guide/simple-gpt4-code-interpreter',+// // },+// // {+// // icon: <Hammer strokeWidth={1} size={20} />,+// // title: 'Guide: Upload and analyze CSV files with AI',+// // href: '/guide/simple-gpt4-code-interpreter',+// // },+// // {+// // icon: <Hammer strokeWidth={1} size={20} />,+// // title: 'Guide: Customize sandbox compute (TODO: Move this away from guides?)',+// // href: '/guide/simple-gpt4-code-interpreter',+// // },+// ],+// },+// {+// title: 'E2B Code Interpreter',+// links: [+// {+// title: 'Installation',+// href: '/docs/code-interpreter/installation',+// },+// {+// icon: <Terminal strokeWidth={1} size={20} />,+// title: 'AI Code Execution',+// href: '/docs/code-interpreter/execution',+// },+// // {+// // icon: <Book strokeWidth={1} size={20} />,+// // title: 'Streaming',+// // href: '/code-interpreter/examples',+// // },+// // {+// // icon: <Wrench strokeWidth={1} size={20} />,+// // title: 'Supported languages',+// // href: '/code-interpreter/template',+// // },+// // {+// // icon: <Wrench strokeWidth={1} size={20} />,+// // title: 'Preinstalled packages (customization)',+// // href: '/code-interpreter/template',+// // },+// {+// icon: <Wrench strokeWidth={1} size={20} />,+// title: 'Customization',+// href: '/docs/code-interpreter/template',+// },+// {+// icon: <Cog strokeWidth={1} size={20} />,+// title: 'Kernels',+// href: '/docs/code-interpreter/kernels',+// },+// ],+// },+// {+// title: 'E2B Sandbox',+// links: [+// {+// title: 'Overview',+// href: '/docs/sandbox/overview',+// },+// {+// icon: <Cpu strokeWidth={1} size={20} />,+// title: 'Compute',+// href: '/docs/sandbox/compute',+// },+// {+// icon: <PencilRuler strokeWidth={1} size={20} />,+// title: 'Customization',+// href: '/docs/sandbox/custom',+// },+// {+// icon: <Variable strokeWidth={1} size={20} />,+// title: 'Environment Variables',+// href: '/docs/sandbox/api/envs',+// },+// {+// icon: <FolderTree strokeWidth={1} size={20} />,+// title: 'Filesystem',+// href: '/docs/sandbox/api/filesystem',+// },+// {+// icon: <ChevronRightSquare strokeWidth={1} size={20} />,+// title: 'Process',+// href: '/docs/sandbox/api/process',+// },+// {+// icon: <Folder strokeWidth={1} size={20} />,+// title: 'Working Directory',+// href: '/docs/sandbox/api/cwd',+// },+// {+// icon: <Link strokeWidth={1} size={20} />,+// title: 'Sandbox URL',+// href: '/docs/sandbox/api/url',+// },+// {+// icon: <FileUp strokeWidth={1} size={20} />,+// title: 'Upload Files',+// href: '/docs/sandbox/api/upload',+// },+// {+// icon: <FileDown strokeWidth={1} size={20} />,+// title: 'Download Files',+// href: '/docs/sandbox/api/download',+// },+// {+// icon: <Timer strokeWidth={1} size={20} />,+// title: 'Timeouts',+// href: '/docs/sandbox/api/timeouts',+// },+// {+// icon: <RefreshCw strokeWidth={1} size={20} />,+// title: 'Connect to running sandbox',+// href: '/docs/sandbox/api/reconnect',+// },+// {+// icon: <Braces strokeWidth={1} size={20} />,+// title: 'Sandbox metadata',+// href: '/docs/sandbox/api/metadata',+// },+// ],+// },+// {+// title: 'CLI',+// links: [+// {+// icon: <Settings strokeWidth={1} size={20} />,+// title: 'Installation',+// href: '/docs/cli/installation',+// },+// {+// icon: <TerminalSquare strokeWidth={1} size={20} />,+// title: 'Commands',+// href: '/docs/cli/commands',+// },+// ],+// },+// {+// title: 'Custom Sandboxes',+// links: [+// {+// title: 'Overview',+// href: '/docs/sandbox/templates/overview',+// },+// {+// icon: <File strokeWidth={1} size={20} />,+// title: 'Template File',+// href: '/docs/sandbox/templates/template-file',+// },+// {+// icon: <PlaySquare strokeWidth={1} size={20} />,+// title: 'Start Command',+// href: '/docs/sandbox/templates/start-cmd',+// },+// {+// icon: <Hammer strokeWidth={1} size={20} />,+// title: 'Guide: Creating Custom Sandbox',+// href: '/docs/guide/custom-sandbox',+// },+// {+// icon: <HardDrive strokeWidth={1} size={20} />,+// title: 'Connecting buckets to persist data',+// href: '/docs/guide/connect-bucket',+// },+// ],+// },+// ]