The macro with-work-buffer is much more efficient than with-temp-buffer as it reuses buffers from a shared pool and eliminates gc pressure.
Despite work buffers being new to Emacs 31, the Emacs compat library supports with-work-buffer so perhaps backward compatibility is solved and no agent-shell wrapper is needed to switch to work buffers. See https://github.com/emacs-compat/compat/blob/a0d646554730471579de8b33b0194077fd05abe1/compat-31.el#L387
The macro
with-work-bufferis much more efficient thanwith-temp-bufferas it reuses buffers from a shared pool and eliminates gc pressure.Despite work buffers being new to Emacs 31, the Emacs
compatlibrary supportswith-work-bufferso perhaps backward compatibility is solved and noagent-shellwrapper is needed to switch to work buffers. See https://github.com/emacs-compat/compat/blob/a0d646554730471579de8b33b0194077fd05abe1/compat-31.el#L387