Upstash Documentation

Schedules

3 min read

Create recurring tasks that run on a cron schedule inside a box. You can schedule shell commands or agent prompts. Available on both box.schedule and ephemeralBox.schedule.


API#

Schedule a shell command#

Run a shell command on a cron schedule.

ParameterRequiredDescription
cronYes5-field cron expression (UTC)
commandYesstring[] — the command to run
webhookUrlNoURL to notify when the scheduled run completes
webhookHeadersNoHeaders to include in the webhook request
folderNoWorking directory. Defaults to box.cwd; relative paths resolved against it

Schedule an agent prompt#

Run an agent prompt on a cron schedule. Requires an agent to be configured on the box.

ParameterRequiredDescription
cronYes5-field cron expression (UTC)
promptYesThe prompt to send to the agent
folderNoWorking directory. Defaults to box.cwd; relative paths resolved against it
modelNoOverride the box's default model for this schedule
optionsNoProvider-specific agent options (e.g. maxBudgetUsd, effort, systemPrompt, maxTurns)
timeoutNoTimeout in milliseconds — kills the run if exceeded
webhookUrlNoURL to notify when the scheduled run completes
webhookHeadersNoHeaders to include in the webhook request

List schedules#

Retrieve all non-deleted schedules for the current box.


Get a schedule#

Retrieve a single schedule by ID.


Pause a schedule#

Pause an active schedule so it stops running.


Resume a schedule#

Resume a paused schedule.


Delete a schedule#

Remove a schedule so it no longer runs.


Schedule response#

Most schedule methods return a Schedule object:


Cron syntax#

Schedules use standard 5-field cron expressions (UTC):

ExpressionDescription
* * * * *Every minute
0 * * * *Every hour
0 9 * * *Daily at 9:00 AM
0 9 * * 1-5Weekdays at 9:00 AM
*/5 * * * *Every 5 minutes

Examples#

Periodic health check#

Schedule a command that checks whether your service is healthy.

Daily code review agent#

Schedule an agent to review recent changes every morning.

Manage schedules#

List active schedules, pause, resume, and clean up ones you no longer need.