landing-ai / vision-agent

Vision agent
Apache License 2.0
930 stars 94 forks source link

Support remote code execution and code sandbox #103

Closed humpydonkey closed 1 month ago

humpydonkey commented 1 month ago

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.