Run a command on a schedule
const url = 'https://api.global.stillbox.example/v1/sandboxes/ws-7k2m9q4x8w3z5r6t/schedules';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"cron":"example","command":["example"],"prompt":"example","reply_to":{"connection_id":"example","chat":"example"},"timeout_seconds":600}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}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.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Request Bodyrequired
Section titled “Request Bodyrequired”Give either a command to run, or a prompt for the sandbox’s agent.
object
Standard 5-field cron (minute hour day-of-month month day-of-week), in UTC.
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.
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
Responses
Section titled “Responses”The schedule
object
Empty for a task that gives the agent a prompt.
The message the task gives the sandbox’s agent, if it isn’t a command.
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
When the latest run started (in the organization-wide list).
How the latest run went (in the organization-wide list).
Example
{ "cron": "0 3 * * *", "last_run_status": "running"}The request is invalid
object
Example
{ "code": "not_found"}The API key is missing or invalid
object
Example
{ "code": "not_found"}No such sandbox in your organization (or no such file)
object
Example
{ "code": "not_found"}