AI Automation

Cloud scheduled tasks: run Claude Code on a schedule, API call or GitHub event

TL;DR

Cloud scheduled tasks (formerly routines) run Claude Code on Anthropic's cloud on a schedule, an HTTP POST or a GitHub event, even with your laptop closed. Write clear success criteria, remove unneeded connectors, remember cron is UTC.

Review open PRs every morning, clean up the backlog every evening, check outdated dependencies every week: Claude Code can do all of this, but running it on a laptop means keeping the machine open and remembering to start it. Cloud scheduled tasks (formerly routines) package a prompt, one or more repos and connectors into a configuration that runs automatically on Anthropic's cloud infrastructure, so it keeps running when you close your laptop. The feature is in research preview.

Three trigger types

TriggerRuns whenExample
ScheduleHourly/daily/weekly, a custom cron, or once at a set future timeClean up the backlog every weeknight
APIAn HTTP POST hits the task's own endpoint with a bearer tokenYour alerting system calls it to investigate an incident
GitHubRepository events such as pull requests or releasesReview every new PR

One task can combine triggers, for example a PR review task that runs nightly, is called by a deploy script, and reacts to each new PR.

Creating a task

On the web at claude.ai/code/routines, or right in the CLI:

/schedule daily PR review at 9am
/schedule tomorrow at 9am, summarize yesterday's merged PRs
/schedule in 2 weeks, open a cleanup PR that removes the feature flag

Custom cron (e.g. 0 */2 * * * for every 2 hours) is set in the task's edit dialog. Note: a 5-field cron is written in UTC, so 9am in Vietnam (UTC+7) is 0 2 * * *.

What environment does a task run in?

  • Each run is a full Claude Code cloud session: it runs shell commands, uses skills and calls connectors.
  • Repos are cloned fresh each run; changes are pushed to branches prefixed claude/.
  • The default environment has "Trusted" network access: only a default allowlist of domains (package registries, cloud APIs…).
  • All your connected MCP connectors are included by default. Remove the ones the task doesn't need.
  • Tasks belong to your individual account, aren't shared with teammates, and count against your usage.

API trigger: wiring up alerting

curl -X POST "$FIRE_URL" \
  -H "Authorization: Bearer $ROUTINE_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"text": "Alert: 5xx error rate tripled on the payments service"}'

The token is shown only once at creation, so store it securely. The text field is only acted on if the task's prompt explicitly refers to the payload; otherwise the task treats it as data, not instructions.

Which to use when?

ToolRuns whereGood for
Cloud scheduled taskAnthropic's cloudWork that must run with your machine off; reacting to GitHub/API events
Desktop scheduled taskYour machineNeeds local files or uncommitted changes
/loopAn open CLI sessionQuick polling while you work
GitHub ActionsYour CITied to the repo's workflow config

Risks and caveats

  • Runs autonomously, nobody to ask: the prompt must state what success looks like and what to do with results (comment on the PR, post to Slack…).
  • Connector permissions are yours: everything the task does through GitHub or Slack is done as your account.
  • Hourly run limits apply, including one-off runs; GitHub events beyond the cap are dropped.
  • It's a research preview: behaviour, limits and the API may change.

How to apply it

  • Dev: Start with a small task: "at 9am summarise yesterday's merged PRs", keeping only the GitHub connector.
  • Tech Lead: Connect the API trigger to your alerting so Claude does a first investigation and has a report ready when on-call opens their laptop.
  • PM: Schedule a weekly progress digest from the issue tracker instead of compiling it by hand.

Sources & references

  1. Automate work with scheduled tasks — Claude Code Docs