Long-running tasks
Keep builds, servers and agents running for hours, independent of the command or connection that started them.
A sandbox runs until you stop it. Nothing stops it for being idle; only reaching your org’s monthly sandbox-hours does. That makes it a good place for work that takes longer than a terminal session: test suites, builds, data processing, servers and AI agents.
Within one command
pols exec runs a command for up to 600 seconds by default. Raise the limit with --timeout, up to 86,400 seconds (24 hours):
pols exec web --timeout 7200 -- bash -lc 'cd app && make release'
The command’s output streams to your terminal while it runs. Over the API, ask for streaming with Accept: application/x-ndjson so you see progress and are not limited to the 4 MiB of collected output.
Detached from your connection
For anything that should outlive the call that started it, start it in the background inside the sandbox and check on it later. tmux is installed in every sandbox:
pols exec web -- tmux new-session -d -s build 'cd ~/app && make release > ~/build.log 2>&1'
pols exec web -- tail -n 20 /home/user/build.log
pols exec web -- tmux has-session -t build # exit code 0 while it runs
To watch it interactively, open a shell over SSH with pols ssh web and run tmux attach -t build; detach again with Ctrl-b d.
For services that should come back after a stop and resume, make them start at boot, like on any server: a systemd unit (sudo systemctl enable --now my-service) or a Docker container with a restart policy (docker run -d --restart unless-stopped ...).
Agents that work for hours
Claude Code and Codex are preinstalled. Start an agent in a tmux session the same way, and give it the keys it needs through the vault:
pols new --name agent --secret ANTHROPIC_API_KEY
pols exec agent -- tmux new-session -d -s claude 'cd ~/repo && claude -p "Fix the failing tests" > ~/claude.log 2>&1'
You can watch an agent that uses the browser on the desktop, and record the desktop with pols-record start inside the sandbox.
Things to keep in mind
- Stopping ends processes.
pols stopshuts the VM down; work in progress is lost unless it is on disk. Reaching the monthly hours stops sandboxes the same way. - Running time is billed. A sandbox that waits for something costs the same as one that computes. Stop it when the work is done.
- Keep results outside the sandbox. Disks are not backed up yet; push results to git or copy them out with
pols cp.