---
title: "Run AI agent scheduled tasks in a Cohub Space on a clock"
description: "Set up AI agent scheduled tasks in a Cohub Space with --delay-ms, --at, or timezone-aware --cron so unattended runs write files and leave a Chat record."
lang: "en"
canonical: "https://cohub.live/use-cases/schedule-ai-agent-tasks"
image: "https://cohub.live/_seo/og/use-cases/schedule-ai-agent-tasks.png"
updated: "2026-12-02"
---

# Set up AI agent scheduled tasks that run inside your Cohub Space while you are away

You schedule AI agent tasks in Cohub with a scheduled prompt: a message the Space sends to its agent once at a set time or on a cron schedule, with every run kept as a Chat.

- **Who:** Someone with a recurring chore a capable assistant could do: a morning summary, a weekly check, a report that needs regenerating.
- **When:** You notice you have typed the same request to an AI three Mondays in a row.
- **Why:** A scheduled prompt in Cohub runs the agent inside the Space that already holds the files, skills and sandbox, so the work happens where its results belong.

![Terminal: cohub spaces prompt --help lists --reply, which sends the final reply back to the calling Chat and runs its Agent, next to --harness, --approval-mode, --cron and the other prompt options](https://cohub.live/_seo/img/cli/cli-prompt-schedule-dark.webp)

![Terminal output of cohub cron-jobs --help: list, get, update, delete, toggle and runs](https://cohub.live/_seo/img/cli/cli-cron-jobs-dark.webp)

Source: <https://www.npmjs.com/package/@neta-art/cohub-cli>

![A Chat in a Cohub Space, dark theme: tool cards for running a script in the sandbox and writing notes/october-summary.md, then the answer with the script as a code block](https://cohub.live/_seo/img/ui/ui-chat-desktop-dark.webp)

When a routine task should run on a clock without anyone at the keyboard—a weekday morning brief, a weekly audit, or a monthly site rebuild—attach a scheduled prompt to the Space that already holds the files, skills, and sandbox. Cohub fires the prompt at the time you choose, and the same agent you normally chat with finishes the work inside that Space.

## Pick the time shape first
Before writing the command, decide which kind of clock fits the job:

| Time shape | Flag | Use it when |
|---|---|---|
| Relative delay | `--delay-ms <ms>` | A one-off follow-up should run after a fixed wait from now |
| Fixed timestamp | `--at "<ISO-8601>"` | A single run belongs at a specific date and clock time |
| Recurring cadence | `--cron "<5-field>" --timezone <IANA>` | The same check or summary repeats on a calendar schedule |

Recurring jobs run the same agent with the same Space tools, so routine work collapses into a single prompt: summarizing new entries from `notes/inbox.md` into `notes/today.md` at 08:30 on weekdays, running a test suite and dependency audit every Monday into `reports/weekly.md`, or rebuilding `site/` from `data/` on the 1st of each month and publishing a new version of the `report` App. For a complete walkthrough from prompt to real output, see [a daily GitHub issues digest](https://cohub.live/guides/github-issues-digest).

## One prompt, three time shapes
All three schedules go through `cohub spaces prompt` against your target Space:

```bash
# recurring: 5-field cron with an IANA time zone
cohub -s <space> spaces prompt --cron "30 8 * * 1-5" --timezone Asia/Shanghai \
  --title "Morning inbox" "Read notes/inbox.md and write today's summary to notes/today.md"

# once, at a set time
cohub -s <space> spaces prompt --at "2026-12-01T09:00:00+08:00" "Draft the December changelog"

# once, after a relative delay
cohub -s <space> spaces prompt --delay-ms <ms> "Check whether the export finished"
```

Add `--session <id>` if every run should append to one ongoing Chat instead of opening a fresh thread each time, and pass `--env KEY=value` for per-run environment variables. Because `cohub` is also available inside the Space's sandbox, you can ask the agent in a regular Chat to register the schedule for you.

## What a run leaves in the Space
Each scheduled firing executes in the Space's sandbox with access to `/workspace` files, Space skills, media generation, and App publishing. Rather than vanishing into a silent background log, every run leaves behind concrete artifacts:

- **A Chat transcript.** Each run lands as a Chat (or a new turn in `--session <id>`) filed under a scheduled-task source label so automated runs stay separate from manual conversations.
- **Updated workspace files or Apps.** Files written under `/workspace` persist across sandbox idle stops, and any published App version stays live at its URL.

## When a schedule is the wrong tool
A scheduled prompt watches the clock only—it does not listen for workspace events. If work should start right after something happens (a file changes, a turn finishes, a Save is created, an App is published, or a webhook arrives), use a [Space hook](https://cohub.live/features/space-hooks) instead of polling on a tight cron. Full option details for clock-driven schedules live in [Scheduled prompts](https://cohub.live/features/scheduled-prompts).

## Checking that a run happened
Verify schedules and inspect recent executions either from the terminal or in the web app:

```bash
cohub cron-jobs ls --filter attention   # schedules that need a look
cohub cron-jobs runs <id>               # run history
cohub cron-jobs toggle <id> off         # pause
cohub cron-jobs update <id> --cron "0 9 * * 1"
```

In the browser, open **Library** to see scheduled prompts across all of your Spaces together with their last and next run timestamps, then open the scheduled-task Chat to review the exact tool calls and output.

## Reference in the docs

**This page:** Which routine jobs to hand to a scheduled agent run, and when an event hook fits better.

- [Core concepts](https://cohub.live/docs/learn/core-concepts): what a scheduled prompt is
- [CLI](https://cohub.live/docs/developers/cli): the spaces prompt command and its options

## FAQ

### How often can a schedule run?

A schedule takes a standard 5-field cron expression with a time zone. Each run is metered like any other agent turn, so frequent runs cost more.

### Do I need to keep my computer on?

Not for a Space on a cloud sandbox. Cohub sends the prompt on schedule and the agent works in that sandbox.

## Related

- [Build a daily GitHub issues digest with a scheduled prompt and a Space hook](https://cohub.live/guides/github-issues-digest): To get a GitHub issues digest every morning in Cohub, schedule a prompt that runs a digest skill in a fixed Chat, and add a Space hook that posts each new digest file to a webhook as soon as it is written.
- [Scheduled prompts: cron for AI agents](https://cohub.live/features/scheduled-prompts): Scheduled prompts are cron for AI agents: a Cohub prompt sent to a Space after a delay, at an ISO time, or on a cron expression with a time zone, with each run recorded in a Chat.
- [Space hooks: run scripts on AI agent events](https://cohub.live/features/space-hooks): Space hooks let you run scripts on AI agent events in Cohub: a YAML file in .cohub/hooks/ runs a command, sends a prompt or calls an App Action when a turn finishes, files change, a Save is created or a webhook arrives.
- [Run an AI agent in Discord or WeChat, backed by a Space](https://cohub.live/use-cases/agent-in-discord-wechat): To run an AI agent in Discord, WeChat, Feishu or QQ, add the messenger as a Channel in Cohub's settings and bind it to a Space; messages go to the Space's agent and replies come back in the same chat.

## Sources

- [Cohub docs: Core concepts (Scheduled prompt)](https://cohub.live/docs/learn/core-concepts)
- [Cohub docs: CLI (prompt a Chat, schedule)](https://cohub.live/docs/developers/cli)
- [Cohub home page](https://cohub.live/)
- [Cohub changelog (Library with scheduled prompts, v2.98)](https://cohub.live/changelog)
- [Cohub pricing (usage-metered balance)](https://cohub.live/pricing)

Updated Dec 2, 2026
