List running processes

for process in machine.commands.list():
    state = "running" if process.running else "exited"
    print(process.pid, state, process.command)
ProcessInfo includes pid, command, and running. The list endpoint is useful for reconnecting to background work after a client restart.

Send stdin

process = machine.commands.run("python3 -i", shell=True, background=True)
machine.commands.send_stdin(process.pid, "print('hello')\n")
machine.commands.send_stdin(process.pid, "exit()\n")
send_stdin writes text to the process stdin stream. Use it for interactive programs that are not full terminal sessions; use PTY sessions when terminal behavior, resize, or shell line editing matters.

Logs

logs = machine.commands.get_logs(process.pid)
print(logs.stdout)
print(logs.stderr)
print(logs.output)
print(logs.exit_code)
stdout and stderr are split streams. output is the interleaved stream when the backend has it. exit_code is None while the process is still running and an integer after it exits.

Kill

machine.commands.kill(process.pid)
Killing a process does not destroy the machine. It only stops the selected PID.

REST and CLI map

TaskPython SDKCLIAPI
List processesmachine.commands.list()nullspace machine process list mch_123GET /v1/machines/{id}/processes
Fetch logsmachine.commands.get_logs(pid)nullspace machine process logs mch_123 1234GET /v1/machines/{id}/processes/{pid}/logs
Send stdinmachine.commands.send_stdin(pid, data)printf ... | nullspace machine process stdin mch_123 1234POST /v1/machines/{id}/processes/{pid}/stdin
Killmachine.commands.kill(pid)nullspace machine process kill mch_123 1234POST /v1/machines/{id}/processes/{pid}/kill
Attach streammachine.commands.connect(pid)nullspace machine process attach mch_123 1234exec WebSocket
Most CLI process commands accept --json for automation. stdin --json returns the PID and bytes_sent; attach --json returns a CommandResult.