You can start a tmux session and tell your agent about it and it will happily send commands and get the output from it.
I saw this post a while ago that turned me on to the idea: https://news.ycombinator.com/item?id=46570397