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
Introduce new data models modeling the code execution result (for both local and remote code execution): Execution, Result, Error, Logs .
Introduce a base class for the CodeInterpreter abstraction
Refactor the current Execute class to conform the CodeInterpreter interface, and renamed it to LocalCodeInterpreter.
Update all the existing client code (i.e. agent) that uses LocalCodeInterpreter to use a factory class instead.
Add a new RemoteCodeInterpreter that leverage e2b code sand box.
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
Execution
,Result
,Error
,Logs
.CodeInterpreter
abstractionExecute
class to conform theCodeInterpreter
interface, and renamed it toLocalCodeInterpreter
.LocalCodeInterpreter
to use a factory class instead.