Available on request
Run an AI agent on a schedule
Sanbox starts your agent on a schedule: every morning, every hour or once a week, with the task you set. Scheduled runs are enabled per organisation on request. Until they're on for you, any scheduler you already use can call the Sanbox CLI, or a loop can run inside an always-on Computer.
What you get
- Runs that start on time without your laptop, a CI runner or a server of your own staying awake.
- Ordinary Sanbox runs. Each scheduled run gets the template's isolation, network policy and Secret Proxies, like any run you start by hand.
- Results you can find later. Outputs and run history are kept with each run, in the console and through
sanbox runs list.
Enable it for your organisation
Write to sales@sanlabs.ai with the subject "Enable: Scheduled runs". Tell us what should run, and how often.
What works today
Your scheduler calls sanbox run
Any scheduler that runs a command can start a task run: cron on a server, a CI schedule, or a job runner you already have. Give each run a dated --external-run-id, so a trigger that fires twice returns the same run instead of starting a second one.
This GitHub Actions workflow runs a task every day at 05:17 UTC on an OpenCode task template:
name: nightly-agent
on:
schedule:
- cron: "17 5 * * *"
jobs:
run:
runs-on: ubuntu-latest
env:
SANBOX_API_KEY: ${{ secrets.SANBOX_API_KEY }}
steps:
- run: npm install -g @sanlabs/sanbox-cli@latest
- run: |
sanbox run "Summarise yesterday's failed checks and write output/report.md" \
--template <template-id> \
--external-run-id "nightly-$(date -u +%F)" \
--wait --json
Fetch the report later with sanbox runs download <run-id> --output ./report --json. GitHub's own documentation notes that scheduled workflows run in UTC by default, can be delayed when Actions is under heavy load, and are switched off in public repositories after 60 days without activity.
Run a script in an always-on Computer
OpenCode Computers stay on until you stop them. To run a job in the same Computer each time, with its files and installed tools, have your scheduler call sanbox exec with a request key per occurrence:
sanbox exec <run-id> --cwd /workspace/app --detach \
--request-key "nightly-2026-11-06" --json -- ./nightly.sh
Or keep the schedule inside the Computer. Open a terminal in the console and start a loop. The terminal session keeps running after you close the tab:
while true; do ./nightly.sh >> /workspace/output/nightly.log 2>&1; sleep 86400; done
The loop ends when the Computer stops, because processes don't survive a stop, so start it again after a resume. cron isn't preinstalled in OpenCode or Docker Computers.
nightly.sh can call any agent CLI you installed in the Computer. Claude Code, for example, runs non-interactively with claude -p "<prompt>".
If the job is a Claude Code task
Anthropic offers cloud scheduled tasks for Claude Code that keep running when your computer is off. If your job needs nothing from your own Computer, such as its files, installed tools or network rules, that may be all you need.
Related
- How do I run 10 coding-agent tasks in parallel without them clashing?
- How do I keep Claude Code running 24/7 and control it from my phone?
- How do I run Hermes Agent in the cloud with memory, skills, an inbox and Telegram?
- Call an agent computer from n8n, Make or Zapier
Sources
- GitHub, Events that trigger workflows: schedule, checked 2026-11-06
- Claude Code, Common workflows: run Claude on a schedule and pipe Claude into scripts, checked 2026-11-06