Metrics
Read live resource usage for a sandbox — CPU, memory, process count, network, and uptime.
python
m = sbx.get_metrics()
print(m["cpu_pct"], m["mem_used_mb"], m["uptime_s"])javascript
const m = await sbx.getMetrics();
console.log(m.cpu_pct, m.mem_used_mb, m.uptime_s);Fields
| Field | Meaning |
|---|---|
status | running or paused |
cpu_pct | CPU usage percent (point-in-time) |
cpu_cores | cores visible to the sandbox |
mem_used_mb | memory in use (page cache excluded) |
mem_limit_mb | memory limit |
mem_pct | memory used as a percent of the limit |
pids | running process count |
net_rx_mb / net_tx_mb | network received / transmitted |
uptime_s | seconds since the sandbox was created |
A paused sandbox reports zero compute (its container is stopped).
Poll get_metrics on a timer to drive a live usage view — the AI2IN dashboard does exactly this in the sandbox workspace.