Api runin

Similar to my initial PR. Please comment. I know outstanding issues are around who reaps this command and who is the parent.