Watching what an agent's sandbox is doing: CPU, memory, disk and run history
Short answer: four CLI commands answer most "what is my agent doing in there?" questions. sandscale sandbox list shows which sandboxes exist, sandscale sandbox metrics ID --follow shows CPU, memory and disk use as it happens, sandscale sandbox logs ID lists the commands that ran, and --run RUN_ID prints one command's output. For code, GET /api/v1/sandbox/runs/{id} returns a run's details and…
To investigate an agent's activity in a sandbox, four CLI commands are sufficient. The command "sandscale sandbox list" displays all existing sandboxes, while "sandscale sandbox metrics ID --follow" provides real-time monitoring of CPU, memory, and disk usage. Another command, "sandscale sandbox logs ID," lists the commands executed within the sandbox, and "--run RUN_ID" displays the output of a specific command.
Detailed run information, including cost, can be retrieved via the API with the GET /api/v1/sandbox/runs/{id} endpoint. Sandboxes can be organized using labels assigned during creation or via the SDK, enabling traceability to specific tasks or pull requests. Unattended sandboxes automatically terminate upon reaching their time limit but remain counted towards the plan's vCPU-hours until then.
The CLI's metrics command shows resource utilization, with "--follow" for continuous updates and "--interval" for custom sampling periods. Streaming live output from commands within a sandbox is possible through the TypeScript SDK, which provides callbacks for stdout and stderr output. The organization's audit log records who started, stopped, and executed commands within a sandbox, ensuring accountability.
Rewritten by urgent.news; may contain errors — check the original.
Source: dev.to