Gondolin[1] is what you are describing. It's made by the same person who made the Pi coding agent and sends all of the agent's bash into a small QEMU vm.
This is slightly insane
I suppose it will be slow too if the agent needs to grep over megabytes of data