Extend

Tasks & Scheduled prompts

Inspect background task runs across a Space or your account, schedule one-off delayed prompts, and create, pause, or edit recurring cron prompts in the web app or CLI.

This page explains how to run and audit asynchronous work in Cohub without keeping a Chat open: inspect background Task runs, schedule one-off delayed or timed prompts, and manage recurring Scheduled prompts (cron jobs) from the web app or CLI.

Background task runs

Asynchronous operations in Cohub—scheduled prompts, Sandbox commands, App Actions, Save checkpoints, media generation, and Space Hooks—execute on the worker queue and record a durable Task run. Each run tracks its status (pending, running, completed, or failed), attempt count, timestamps, output or error message, and links to related resources (such as a Checkpoint, Scheduled prompt, or Board).

Common task types

taskType Web UI label Triggered by
send_message Send Message Delayed, timed (--at), or recurring scheduled prompts
run_command Run Command / App Action Command executions and App Action runs
space_hook — Matched Space Hooks and inbound webhooks
save_checkpoint Save Checkpoint Creating a Space Save
generation Generation Multimodal image, video, speech, or music generation
turn_speech Read aloud Text-to-speech playback on a Chat turn
create_space — Space initialization

Inspecting task runs

  • Web UI: Open Tasks in the Space sidebar to browse runs in the current Space. Selecting a run opens its detail view (/spaces/<spaceId>/tasks/<taskId>) with status, duration, attempt count, command or generation output, raw result JSON, error details, and links back to any originating Scheduled prompt or Checkpoint.
  • CLI: Use cohub tasks to filter runs across a Space, Chat session, cron job, task type, or status (active, pending, running, completed, failed):
# List active (pending or running) tasks in a Space
cohub tasks ls --space <space> --status active

# Filter by task type or cron job, or inspect one run as JSON
cohub tasks ls --space <space> --type space_hook --limit 20
cohub tasks ls --cron-job <cronJobId>
cohub tasks get <taskRunId> --json

When more rows exist, cohub tasks ls prints a pagination cursor you can pass back with --cursor <cursor>.

One-off delayed and timed prompts

To send a prompt once in the future without creating a recurring schedule, pass either --delay-ms or --at to cohub prompt:

  • --delay-ms <ms>: wait a positive integer number of milliseconds before dispatching.
  • --at <iso>: dispatch once at a future ISO 8601 timestamp that includes an explicit timezone offset or Z (for example 2026-12-10T09:00:00+08:00 or 2026-12-10T01:00:00Z).

Both flags enqueue a send_message Task run and return its taskRunId and scheduledAt timestamp. Omit --session to start a new Chat when the prompt fires, or pass --session <id> to post into an existing Chat.

# Send a follow-up into an existing Chat after 10 minutes
cohub -s <space> prompt --session <sessionId> --delay-ms 600000 "Check if the deploy finished."

# Start a new Chat at a specific future time
cohub -s <space> prompt --at 2026-12-10T09:00:00+08:00 --title "Release check" "Review open release tasks."

You can also pass prompt options such as -m/--model, -p/--provider, --thinking-level, --read-only, --label, and --env alongside --delay-ms or --at.

Recurring scheduled prompts (cron jobs)

A Scheduled prompt runs on a standard 5-field cron expression (minute hour day-of-month month day-of-week, such as 0 9 * * 1-5) evaluated in an IANA timezone (such as Asia/Shanghai or UTC). Every trigger creates a send_message Task run linked to that cron job.

Managing schedules in the Web UI

  1. In a Space's right side panel, open the Scheduled tab.
  2. Select New scheduled prompt to configure Title, Prompt, Schedule (5-field cron expression), Timezone, and Model (optional; defaults to the Space's default model).
  3. Select any existing schedule to view its prompt text, model/provider, cron expression, timezone, and target session (either a fixed Chat ID or New session on run).
  4. From the schedule header you can Edit (send_message schedules), Pause / Resume, Delete, or copy the schedule ID.
  5. In the Runs section at the bottom, select Load runs to inspect historical Task runs and jump to each run's detail page.

Managing schedules in the CLI

Create a recurring schedule with cohub prompt --cron and --timezone, then inspect or modify it with cohub cron-jobs:

# Create a weekday morning scheduled prompt (creates a new Chat on each run)
cohub -s <space> prompt \
  --cron "0 9 * * 1-5" \
  --timezone Asia/Shanghai \
  --title "Daily triage" \
  "Summarize new issues and list blockers."

# List schedules in one Space, or across your account (--filter mine|all|paused|attention)
cohub cron-jobs ls <space>
cohub cron-jobs ls --filter attention

# Inspect, update, pause/resume, or delete a schedule
cohub cron-jobs get <cronJobId>
cohub cron-jobs update <cronJobId> --cron "30 9 * * 1-5" --timezone UTC --title "Weekday triage"
cohub cron-jobs toggle <cronJobId> off
cohub cron-jobs toggle <cronJobId> on
cohub cron-jobs delete <cronJobId>

# List recent Task runs for a schedule
cohub cron-jobs runs <cronJobId> --limit 20

cohub cron-jobs update <id> --payload <jsonOrPath> accepts either an inline JSON object or a path to a JSON file. Server-managed routing fields in the stored payload are preserved automatically when updating.

Permissions and visibility

Role / scope Permissions What you can do
Space Host & Builder cronjob.view, cronjob.manage, taskrun.view View Task runs in the Space; create, edit, pause/resume, and delete Scheduled prompts
Space Guest None for tasks/cron jobs Cannot view Task runs or manage Scheduled prompts
Account-wide lists user.taskrun.list, user.cronjob.list Required for cohub tasks ls without --space and cohub cron-jobs ls without <spaceId>

Viewing a cron job's run history (cohub cron-jobs runs <id>) also checks taskrun.view on the schedule's Space and Session.

Boundaries and common errors

Hard limits and behavior

  • Mutually exclusive schedule modes: You can pass at most one of --delay-ms, --at, or --cron per cohub prompt call.
  • Incompatible prompt flags: Scheduled prompts cannot be combined with --wait, --stream, --note, --reply, or --compact-first.
  • Harness at send time: A scheduled prompt to an existing Chat without --harness continues the Chat's Harness and model as of when it runs. A Local Harness run needs Cohub Local online at that moment; otherwise the run fails with the reason.
  • Cron format and timezone: Expressions must have 5 fields (seconds are not supported). Timezones must be valid IANA names; --cron always requires --timezone in the CLI (API records default to Asia/Shanghai when omitted).
  • Web UI editing: Inline editing in the schedule view applies to send_message schedules; other task types render their payload as read-only JSON.
  • Pagination defaults: cohub tasks ls defaults to --limit 50 and cohub cron-jobs runs defaults to --limit 20, using opaque <createdAtISO>|<id> cursors.

Common errors

Error / symptom Cause Fix
Use only one of --delay-ms, --at, or --cron More than one scheduling flag was passed to cohub prompt. Keep only one scheduling flag per command.
--timezone is required with --cron --cron was supplied without an IANA timezone. Add --timezone <IANA>, e.g. --timezone UTC or --timezone Asia/Shanghai.
sendAt must include timezone, e.g. 2026-05-09T10:00:00+08:00 --at timestamp omitted an offset or Z. Include an explicit offset (+08:00) or Z in the ISO 8601 timestamp.
sendAt must be in the future The --at timestamp is in the past or equal to now. Provide a future timestamp.
delayMs must be a positive integer, e.g. 600000 --delay-ms was 0, negative, or non-integer. Pass a positive integer in milliseconds.
cronExpression must have 5 fields, e.g. 0 9 * * * Cron string had 6 fields (with seconds) or invalid syntax. Use a standard 5-field cron expression.
--wait and --stream cannot be combined with --note, --reply, or scheduling / notes cannot be scheduled Tried to wait/stream a scheduled prompt or schedule a --note. Remove --wait/--stream/--note when scheduling, and inspect the resulting taskRunId with cohub tasks get.
403 when listing tasks or editing schedules Your role in the Space is Guest or lacks taskrun.view / cronjob.manage. Ask a Space Host to grant Builder or Host access.

Next steps