What we need is a capabilities based security system. It could write all the python, asm, whatever it wants and it wouldn't matter at all if it was never given a reference to use something it shouldn't.
Isn't this already possible? Give it its own user account with write access to the project directory and either read access or no access outside it.
Docker is enough in practice no?
[dead]
There exist restricted Shells. But honestly, I don't feel capable of assessing all attack vectors and security measures in sufficient detail. For example, do the rbash restrictions also apply when Python is called with it? Or can the agent somehow bypass rbash to call Python?
https://en.wikipedia.org/wiki/Restricted_shell