Feature

Process Management

Monitor, manage, and terminate running processes. Full visibility into what's running in your sandbox.

processes.py
1from hopx_ai import Sandbox
2
3sandbox = Sandbox.create(template="code-interpreter")
4
5# Start multiple background processes
6proc1 = sandbox.commands.run_background("python worker1.py")
7proc2 = sandbox.commands.run_background("python worker2.py")
8proc3 = sandbox.commands.run_background("python worker3.py")
9
10# List all running processes
11processes = sandbox.list_processes()
12for p in processes:
13    print(f"PID {p.pid}: {p.command} ({p.status})")
14
15# Check specific process status
16status = sandbox.get_process_status(proc1.id)
17print(f"Worker 1: {status.status}")
18print(f"Stdout: {status.stdout}")
19
20# Kill a specific process
21sandbox.kill_process(proc2.id)
22print("Worker 2 terminated")
23
24# Kill all processes
25for p in processes:
26    sandbox.kill_process(p.id)

List Processes

View all running processes with status and metadata

Monitor Status

Check process status, output, and resource usage

Kill Processes

Terminate any process cleanly on demand

Resource Usage

Monitor CPU, memory, and I/O per process

Full Process Control

List, monitor, and manage all processes running in your sandbox.