Why does it have to have a little http API? Why not just spawn the python tool?
If you’re suggesting spawning things over shell/cmd line I’m of the opinion that this a generally bad idea.
Really, where does this fear of spawning things come from?
So the spawning of a short-lived subprocess approach has massive overhead, only suitable for multi-second workloads.
The simplest approach is via a pipe to the process' stdin/stdout I guess. Of course you have to (de)serialize your data, but you would have to to the same if you go the HTTP route, which seems far more complex. Furthermore the suggested solution probably has a nice wrapper in the language's stdlib (e.g. `check_output()` in Python land).