E2BInterpreter

class E2BInterpreter(BaseInterpreter):

E2B Code Interpreter implementation.

Parameters:

  • require_confirm (bool, optional): If True, prompt user before running code strings for security. (default: :obj:True)

init

def __init__(self, require_confirm: bool = True):

del

def __del__(self):

Destructor for the E2BInterpreter class.

This method ensures that the e2b sandbox is killed when the interpreter is deleted.

run

def run(self, code: str, code_type: str):

Executes the given code in the e2b sandbox.

Parameters:

  • code (str): The code string to execute.
  • code_type (str): The type of code to execute (e.g., ‘python’, ‘bash’).

Returns:

str: The string representation of the output of the executed code.

supported_code_types

def supported_code_types(self):

Provides supported code types by the interpreter.

update_action_space

def update_action_space(self, action_space: Dict[str, Any]):

Updates action space for python interpreter