Skip to main content

E2BInterpreter

E2B Code Interpreter implementation. Parameters:
  • require_confirm (bool, optional): If True, prompt user before running code strings for security. (default: :obj:True) Environment Variables:
  • E2B_API_KEY: The API key for authenticating with the E2B service.
  • E2B_DOMAIN: The base URL for the E2B API. If not provided, will use the default E2B endpoint.

init

del

Destructor for the E2BInterpreter class. This method ensures that the e2b sandbox is killed when the interpreter is deleted.

run

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’). (default: obj:python)
Returns: str: The string representation of the output of the executed code.

supported_code_types

Provides supported code types by the interpreter.

update_action_space

Updates action space for python interpreter

execute_command

Execute a command can be used to resolve the dependency of the code. Parameters:
  • command (str): The command to execute.
Returns: str: The output of the command.