forked from All-Hands-AI/OpenHands
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Integrate E2B sandbox as an alternative to a Docker container (All-Ha…
…nds-AI#727) * add e2b sandbox [wip] * Install e2b package * Add basic E2B sandbox integration * Update dependencies and fix command execution in E2BSandbox * Udpate e2b * Add comment * Lint * Remove unnecessary type conversion * Lint * Fix linting * Resolve comments * Update opendevin/action/fileop.py * Update opendevin/action/fileop.py * Fix log * Update E2B readme * poetry lock --------- Co-authored-by: Robert Brennan <[email protected]>
- Loading branch information
Showing
21 changed files
with
513 additions
and
203 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
FROM ubuntu:22.04 | ||
|
||
# install basic packages | ||
RUN apt-get update && apt-get install -y \ | ||
curl \ | ||
wget \ | ||
git \ | ||
vim \ | ||
nano \ | ||
unzip \ | ||
zip \ | ||
python3 \ | ||
python3-pip \ | ||
python3-venv \ | ||
python3-dev \ | ||
build-essential \ | ||
openssh-server \ | ||
sudo \ | ||
&& rm -rf /var/lib/apt/lists/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# How to build custom E2B sandbox for OpenDevin | ||
|
||
[E2B](https://e2b.dev) is an [open-source](https://github.com/e2b-dev/e2b) secure cloud environment (sandbox) made for running AI-generated code and agents. E2B offers [Python](https://pypi.org/project/e2b/) and [JS/TS](https://www.npmjs.com/package/e2b) SDK to spawn and control these sandboxes. | ||
|
||
|
||
1. Install the CLI with NPM. | ||
```sh | ||
npm install -g @e2b/cli@latest | ||
``` | ||
Full CLI API is [here](https://e2b.dev/docs/cli/installation). | ||
|
||
1. Build the sandbox | ||
```sh | ||
e2b template build --dockerfile ./Dockerfile --name "open-devin" | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# This is a config for E2B sandbox template. | ||
# You can use 'template_id' (785n69crgahmz0lkdw9h) or 'template_name (open-devin) from this config to spawn a sandbox: | ||
|
||
# Python SDK | ||
# from e2b import Sandbox | ||
# sandbox = Sandbox(template='open-devin') | ||
|
||
# JS SDK | ||
# import { Sandbox } from 'e2b' | ||
# const sandbox = await Sandbox.create({ template: 'open-devin' }) | ||
|
||
dockerfile = "Dockerfile" | ||
template_name = "open-devin" | ||
template_id = "785n69crgahmz0lkdw9h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,13 @@ | ||
from .sandbox import Sandbox | ||
from .ssh_box import DockerSSHBox | ||
from .exec_box import DockerExecBox | ||
from .local_box import LocalBox | ||
from .docker.ssh_box import DockerSSHBox | ||
from .docker.exec_box import DockerExecBox | ||
from .docker.local_box import LocalBox | ||
from .e2b.sandbox import E2BBox | ||
|
||
__all__ = [ | ||
'Sandbox', | ||
'DockerSSHBox', | ||
'DockerExecBox', | ||
'E2BBox', | ||
'LocalBox' | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.