Skip to content

Run a command on a schedule

POST
/sandboxes/{id}/schedules
curl --request POST \
--url https://api.global.stillbox.example/v1/sandboxes/ws-7k2m9q4x8w3z5r6t/schedules \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "cron": "example", "command": [ "example" ], "prompt": "example", "reply_to": { "connection_id": "example", "chat": "example" }, "timeout_seconds": 600 }'

Runs command in the sandbox at each time cron matches (standard 5-field cron, in UTC). An asleep sandbox is woken for the run and put back to sleep afterwards. If a run is still going at the next time, that time is skipped.

id
required
string
Media typeapplication/json

Give either a command to run, or a prompt for the sandbox’s agent.

object
cron
required

Standard 5-field cron (minute hour day-of-month month day-of-week), in UTC.

string
command
Array<string>
>= 1 items
prompt

A message for the sandbox’s agent, such as “Summarise this morning’s news”. Each run starts a new conversation, seen in the sandbox’s chat; the run’s output is the agent’s reply. Only for sandboxes with an agent.

string
<= 8000 characters
reply_to

Where a prompt task’s reply is also sent: one of the chats of one of the sandbox’s connections (Telegram, Slack, Discord, Microsoft Teams or WhatsApp), as listed under the connection’s chats.

object
connection_id
required
string
chat
required
string
timeout_seconds
integer
default: 600 >= 1 <= 86400

The schedule

Media typeapplication/json
object
id
required
string
sandbox_id
required
string
cron
required
string
command
required

Empty for a task that gives the agent a prompt.

Array<string>
prompt

The message the task gives the sandbox’s agent, if it isn’t a command.

string
reply_to

Where a prompt task’s reply is also sent: one of the chats of one of the sandbox’s connections (Telegram, Slack, Discord, Microsoft Teams or WhatsApp), as listed under the connection’s chats.

object
connection_id
required
string
chat
required
string
timeout_seconds
required
integer
enabled
required
boolean
next_run_at
required
string format: date-time
last_run_at

When the latest run started (in the organization-wide list).

string format: date-time
last_run_status

How the latest run went (in the organization-wide list).

string
Allowed values: running succeeded failed
created_at
required
string format: date-time

Example

{
"cron": "0 3 * * *",
"last_run_status": "running"
}

The request is invalid

Media typeapplication/json
object
code
required
string
message
required
string

Example

{
"code": "not_found"
}

The API key is missing or invalid

Media typeapplication/json
object
code
required
string
message
required
string

Example

{
"code": "not_found"
}

No such sandbox in your organization (or no such file)

Media typeapplication/json
object
code
required
string
message
required
string

Example

{
"code": "not_found"
}