See https://codereview.qt-project.org/#/c/251668/ - run an agent with a build instruction, e.g. sleep 100000. Then call exit on it. Nothing happens.
This looks as if the rpc handling should be in a goroutine, so that we can actually stop the agent cleanly in case it gets cancelled. In that case we would then be able to cleanly exit.