Sandboxer
How do you run an AI agent for days in a sandbox?
Start the agent as a detached command in a Sandboxer sandbox, set a deadline that fits the job, up to 30 days, and let idle pause stop the meter when nothing is happening. The sandbox keeps its memory when it pauses and wakes on the next request, so the agent picks up where it left off instead of restarting.
Updated November 16, 2026
How do you start work that outlives your terminal?
Run it detached. The command returns a process id at once; you can check its status, follow its live output from any offset, and reattach later. A detached command survives a stop and resume. From Sandboxer's long-running agents page:
id=$(sbx new --ttl 86400 --idle 60 --json | jq -r 'select(.event=="ready") | .id')
pid=$(sbx exec "$id" --detach "./crawl.sh" | jq -r .processId)
sbx exec "$id" --status "$pid"
sbx exec "$id" --attach "$pid"How long can a sandbox run?
As long as you set. Auto-stop defaults to one hour after a sandbox starts; you can set any deadline up to 30 days, extend it while it runs, or turn it off. When the deadline passes, the sandbox stops with its memory and disk kept, and a stopped sandbox costs nothing for compute. Its data is kept for 14 days after it last stopped. See pause and resume.
What happens when the agent goes quiet?
An idle sandbox pauses itself with its memory after a plan-dependent number of minutes, so compute isn't billed, and the next API call or request to one of its hosted URLs wakes it with its processes still running. A detached command that is still running counts as activity. For a process whose work the API can't see, such as a server waiting on a queue, creating the file ~/.sandboxer/keep-awake keeps the sandbox awake until you remove it.
How do you see what it did while you were away?
Commands run through the API are kept with their output for 90 days, readable even while the sandbox is stopped. Have the agent commit after every passing step and keep a progress log, and the morning review is the commit history, the log and the test results. Sandboxer's guide on running a coding agent overnight shows such a run, where some tasks finished, one was blocked on a missing key and one was skipped as too vague. See also monitoring agent sandboxes.
What makes an unattended run succeed?
- One well-specified task per sandbox, with passing tests as the finish line.
- A commit after each passing step, so a crash loses one step, not the night.
- Every key the task needs, set before you leave. Nobody is there to paste one in.
- Caps on attempts and total time, so a loop can't retry the same failure for hours.
- Permission to run commands in a throwaway VM, because a prompt at midnight waits until morning.
To limit what a long run can cost, see how to stop an AI agent from overspending.
Frequently asked questions
Can a Sandboxer sandbox run for a week?
Yes. Set a deadline up to 30 days, extend it while it runs, or turn auto-stop off.
Does an idle sandbox keep costing money?
No compute while it's paused. An idle sandbox pauses itself with its memory and wakes on the next request.
How do I keep a sandbox awake for background work?
A running detached command counts as activity. For work the API can't see, create ~/.sandboxer/keep-awake inside the sandbox and remove it when done.
How long is command history kept?
90 days, and it can be read even while the sandbox is stopped.