Add API + tests for Swarm

Yes, I had the standard error redirected to the same handle as stdout (PIPE), but it makes more sense to separate them and exit if stderr is not empty.