The simplest thing to do would be allowing arbitrary docker containers as test environments and just kill them after timeouts. That should be easily adaptable with how I understand your current architecture works.
A more advanced thing would be the user being able to specify dependencies in the json file or via a requirements.txt for python. However this possibility is less flexible and more work for you which is why usually the first approach is taken at least for a start.
The simplest thing to do would be allowing arbitrary docker containers as test environments and just kill them after timeouts. That should be easily adaptable with how I understand your current architecture works.
A more advanced thing would be the user being able to specify dependencies in the json file or via a requirements.txt for python. However this possibility is less flexible and more work for you which is why usually the first approach is taken at least for a start.