Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support remote code execution and code sandbox #103

Merged
merged 1 commit into from
May 31, 2024
Merged

Conversation

humpydonkey
Copy link
Collaborator

@humpydonkey humpydonkey commented May 30, 2024

Motivation

Running the generated code in a local environment exposes security risk. It's not ideal for certain use cases.
This PR support remote code execution in a sandbox environment for python code.

Changes

  1. Introduce new data models modeling the code execution result (for both local and remote code execution): Execution, Result, Error, Logs .
  2. Introduce a base class for the CodeInterpreter abstraction
  3. Refactor the current Execute class to conform the CodeInterpreter interface, and renamed it to LocalCodeInterpreter.
  4. Update all the existing client code (i.e. agent) that uses LocalCodeInterpreter to use a factory class instead.
  5. Add a new RemoteCodeInterpreter that leverage e2b code sand box.

@humpydonkey humpydonkey changed the title Support local and remote code execution and code sandbox Support remote code execution and code sandbox May 30, 2024
…the code execution result of local and remote code execution.

2. Introduce a baseclass for CodeInterpreter abstraction
3. Refactor the current Execute class to conform the CodeInterpreter interface, and renamed it to LocalCodeInterpreter
4. Update all the existing client code (i.e. agent) that uses LocalCodeInterpreter

Finish E2BCodeInterpreter

Make local file available to remote sandbox

Print sys version in remote code interpreter

Implement __str__ for the Logs class

Close E2BCodeInterpreter when exiting the program
Copy link
Member

@dillonalaird dillonalaird left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@humpydonkey humpydonkey merged commit db3dc68 into main May 31, 2024
7 checks passed
@humpydonkey humpydonkey deleted the code-sandbox branch May 31, 2024 00:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants