Skip to content

armgit / E2B

Public Imported from GitHub
0

Open-source, secure environment with real-world tools for enterprise-grade agents.

Update docs

Vasek Mlejnsky79b1915f33a5
diff --git a/apps/docs/src/app/guide/custom-sandbox/page.mdx b/apps/docs/src/app/guide/custom-sandbox/page.mdx
index 3d09c8b07..9c5d29c70 100644
--- a/apps/docs/src/app/guide/custom-sandbox/page.mdx
+++ b/apps/docs/src/app/guide/custom-sandbox/page.mdx
@@ -2,7 +2,11 @@ import Image from 'next/image'
# Creating Custom Sandbox
-In this guide, we'll build a custom E2B sandbox with preinstalled dependencies and files.
+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
diff --git a/apps/docs/src/app/sandbox/templates/overview/page.mdx b/apps/docs/src/app/sandbox/templates/overview/page.mdx
index 1105bcc0c..cd07960fd 100644
--- a/apps/docs/src/app/sandbox/templates/overview/page.mdx
+++ b/apps/docs/src/app/sandbox/templates/overview/page.mdx
@@ -1,8 +1,11 @@
+import Image from 'next/image'
+import imgCustomSandbox from '@/images/custom-sandbox.png'
+
# Custom Sandbox
<Note>
E2B Sandbox is a secure sandboxed cloud environment made for AI agents and AI apps. Sandboxes allow AI agents and apps to have long running cloud secure environments. In these environments, large language models can use the same tools as humans do.
-Read more [here](/sandbox/overview) about E2B Sandboxes
+Read more about E2B Sandboxes [here](/sandbox/overview).
</Note>
Custom sandboxes allows you to spawn a sandbox with a pre-defined environment by you and then control it with our SDK.
@@ -11,6 +14,14 @@ You can build a custom sandbox by creating the [Sandbox Template](/sandbox/templ
Once you build your custom sandbox template, you can spawn multiple isolated sandboxes from it.
+<Image
+ src={imgCustomSandbox}
+ className="rounded max-w-full"
+ alt="Graphics explaining how custom sandbox works"
+ unoptimized
+/>
+
+
## How it works
1. [Provide the sandbox template file](/sandbox/templates/template-file)
1. [Build a sandbox template from it using our CLI](/guide/custom-sandbox#4-build-custom-sandbox)
@@ -26,7 +37,8 @@ Once you build your custom sandbox template, you can spawn multiple isolated san
// Create new sandbox
const sandbox = await Sandbox.create({
- id: '<sandbox-template-id>', // You get sandbox ID from the CLI after you run `$ e2b build`
+ // You get sandbox ID from the CLI after you run `$ e2b build`
+ id: '<sandbox-template-id>', // $HighlightLine
})
// Close sandbox once done
@@ -38,7 +50,8 @@ Once you build your custom sandbox template, you can spawn multiple isolated san
# Create new sandbox
sandbox = Sandbox(
- id="<sandbox-template-id>", # You get sandbox ID from the CLI after you run `$ e2b build`
+ # You get sandbox ID from the CLI after you run `$ e2b build`
+ id="<sandbox-template-id>", # $HighlightLine
)
# Close sandbox once done
diff --git a/apps/docs/src/app/sandbox/templates/template-file/page.mdx b/apps/docs/src/app/sandbox/templates/template-file/page.mdx
index 44f7c0825..5fc175052 100644
--- a/apps/docs/src/app/sandbox/templates/template-file/page.mdx
+++ b/apps/docs/src/app/sandbox/templates/template-file/page.mdx
@@ -1,17 +1,28 @@
-# Template File
+import Image from 'next/image'
+import imgCustomSandbox from '@/images/custom-sandbox.png'
-The sandbox template file is a simple Dockerfile named `e2b.Dockerfile` that's used to build a custom sandbox. {{ className: 'lead' }}
+# Template File
-Follow [our guide](/guide/custom-sandbox) on how to create a template file to build your own custom sandbox.
+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](/guide/custom-sandbox) on how to create a cusom sandbox.
+</Note>
+
+<Image
+ src={imgCustomSandbox}
+ className="rounded max-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`
-</Note>
## Example
@@ -19,7 +30,7 @@ The Dockerfile must be Debian based (e.g. Ubuntu). Only the following [Dockerfil
The following example template file defines a Ubuntu-based sandbox with installed GitHub CLI.
-<CodeGroup isRunnable={false}>
+<CodeGroup isFileName title="e2b.Dockerfile" isRunnable={false}>
```sh
# You can use most of the Debian-based base images
FROM ubuntu:22.04
diff --git a/apps/docs/src/components/Code.tsx b/apps/docs/src/components/Code.tsx
index a217b8558..4931ee09c 100644
--- a/apps/docs/src/components/Code.tsx
+++ b/apps/docs/src/components/Code.tsx
@@ -4,7 +4,7 @@ import { Children, createContext, isValidElement, useContext, useEffect, useRedu
import { Tab } from '@headlessui/react'
import clsx from 'clsx'
import { create } from 'zustand'
-import { LoaderIcon, PlayIcon } from 'lucide-react'
+import { LoaderIcon, PlayIcon, File } from 'lucide-react'
import { CopyButton } from '@/components/CopyButton'
import { useApiKey } from '@/utils/useUser'
@@ -17,9 +17,9 @@ import logoNode from '@/images/logos/node.svg'
import logoPython from '@/images/logos/python.svg'
export function getPanelTitle({
- title,
- language,
- }: {
+ title,
+ language,
+}: {
title?: string;
language?: string;
}) {
@@ -33,11 +33,11 @@ export function getPanelTitle({
}
function CodePanel({
- children,
- code,
- lang,
- isRunnable = true,
- }: {
+ children,
+ code,
+ lang,
+ isRunnable = true,
+}: {
children: React.ReactNode;
code?: string;
lang?: LangShort;
@@ -207,13 +207,15 @@ function CodePanel({
}
export function CodeGroupHeader({
- title,
- children,
- selectedIndex,
- }: {
+ title,
+ children,
+ selectedIndex,
+ isFileName = false,
+}: {
title: string;
children: React.ReactNode;
selectedIndex: number;
+ isFileName: boolean;
}) {
const hasTabs = Children.count(children) > 1
if (!title && !hasTabs) return null
@@ -224,7 +226,17 @@ export function CodeGroupHeader({
<div className="flex flex-col items-start">
{title && (
<div className="pl-2 mt-3">
- <h3 className="font-xs font-medium text-brand-50">{title}</h3>
+ {isFileName ? (
+ <div className="flex items-center justify-start space-x-2">
+ <File
+ size={18}
+ strokeWidth={1}
+ />
+ <h3 className="text-sm text-brand-400 font-mono">{title}</h3>
+ </div>
+ ) : (
+ <h3 className="text-sm text-gray-500 text-brand-400">{title}</h3>
+ )}
</div>
)}
{hasTabs && (
@@ -413,12 +425,14 @@ function useOutputReducer() {
}
export function CodeGroup({
- children,
- title,
- path,
- ...props
- }: React.ComponentPropsWithoutRef<typeof CodeGroupPanels> & {
+ children,
+ title,
+ isFileName,
+ path,
+ ...props
+}: React.ComponentPropsWithoutRef<typeof CodeGroupPanels> & {
title?: string;
+ isFileName?: boolean;
path?: string; // For analytics
}) {
const hasTabs = Children.count(children) > 1
@@ -431,7 +445,11 @@ export function CodeGroup({
const tabGroupProps = useTabGroupProps(languages)
const header = (
- <CodeGroupHeader title={title} selectedIndex={tabGroupProps.selectedIndex}>
+ <CodeGroupHeader
+ title={title}
+ selectedIndex={tabGroupProps.selectedIndex}
+ isFileName={isFileName}
+ >
{children}
</CodeGroupHeader>
)
diff --git a/apps/docs/src/images/custom-sandbox.png b/apps/docs/src/images/custom-sandbox.png
new file mode 100644
index 000000000..20f4f331a
Binary files /dev/null and b/apps/docs/src/images/custom-sandbox.png differ