This is the wrong approach. Sandbox them enough that you are comfortable with letting them run with full permissions.
My sandbox runs rootless and doesn't have `sudo` either. In addition to bash, the agent is free to install anything it needs via npm or pip, or to write its own scripts.
It doesn't have my signing keys so detecting unauthorized commits is trivial.