1st run: check and sanitize
2nd run: give to agent with privileges to do stuff
Your best case scenario is reducing risk by some % but you could also make it less reliable or even open up new attack vectors.
Security issues like these need deterministic solutions, and that's exceedingly difficult (if not impossible) with LLMs.
1st run: check and sanitize
2nd run: give to agent with privileges to do stuff