Files
OpenHands/opendevin/sandbox/sandbox.py
Vasek Mlejnsky 76b81ca0ed Integrate E2B sandbox as an alternative to a Docker container (#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 <accounts@rbren.io>
2024-04-19 14:21:58 -04:00

30 lines
596 B
Python

from abc import ABC, abstractmethod
from typing import Dict
from typing import Tuple
from opendevin.sandbox.process import Process
class Sandbox(ABC):
background_commands: Dict[int, Process] = {}
@abstractmethod
def execute(self, cmd: str) -> Tuple[int, str]:
pass
@abstractmethod
def execute_in_background(self, cmd: str) -> Process:
pass
@abstractmethod
def kill_background(self, id: int) -> Process:
pass
@abstractmethod
def read_logs(self, id: int) -> str:
pass
@abstractmethod
def close(self):
pass