WBX Sandbox
Jobs and batches

Schedules & webhooks

Save a job once and let it run by itself – on a schedule (“every weekday at 7:00 Prague time”), when a webhook URL is called (a push to GitHub, a form, another service), or both. Each run is a normal background job with its log, result files, receipt and price limit. Or run the command in a named sandbox that wakes up with its files and memory, so an agent keeps its state between runs.

How it works

  • A trigger stores what to run – a job (the same fields as POST /v1/jobs) or a command in a named sandbox – and when: a schedule, a webhook, or both. Run now works at any time.
  • Every run of a job is a new job in a fresh sandbox. It appears under Jobs with the metadata trigger_id, trigger_event and trigger_run, so you can filter and audit it.
  • There is no extra fee – only the runs are billed, like any other job or sandbox.
  • Available on paid plans and to accounts that have topped up at least US$15 in total (feature triggers). Without it, creating a trigger returns 403 feature_disabled.

Create a schedule

Weekdays at 7:00 in Prague, a job with a price limit of one run, and a webhook as a second way to start it:

from wbxsandbox import Trigger

t = Trigger.create("Morning sales report", "python report.py", template="base", timeout_seconds=600,
                   schedule="0 7 * * 1-5", timezone="Europe/Prague",
                   webhook=True, max_cost="0.10", save_artifacts=True)   # for CZK use "2.50"
print(t.next_runs[:3])
print(t.webhook_url)          # shown only now – store it like a password
import { WBX } from "wbxsandbox";

const wbx = new WBX();
const t = await wbx.triggers.create({
  name: "Morning sales report", schedule: "0 7 * * 1-5", timezone: "Europe/Prague", webhook: true,
  maxCost: "0.10",   // for CZK use "2.50"
  job: { command: "python report.py", template: "base", timeoutSeconds: 600, saveArtifacts: true },
});
console.log(t.nextRuns.slice(0, 3), t.webhookUrl);   // the URL is shown only now
curl -s -X POST https://sandbox.wbx.cz/v1/triggers -H "Authorization: Bearer $WBXSANDBOX_API_KEY" -H "Content-Type: application/json" -d '{
  "name": "Morning sales report",
  "job": {"command": "python report.py", "template": "base", "timeout_s": 600, "save_artifacts": true},
  "schedule": {"cron": "0 7 * * 1-5", "timezone": "Europe/Prague"},
  "webhook": {"enabled": true},
  "max_cost": "0.10"
}'   # for CZK use "2.50"

In the portal: Schedules in the menu, or open a finished job and choose Run on a schedule – the form is filled in from the job. From an AI assistant: ask, for example, “every weekday at 7:00 download the sales report and summarise it” – the MCP tool creates the trigger.

Fields – POST /v1/triggers

FieldDescription
nameRequired. Up to 80 characters.
jobWhat to run: the fields of POST /v1/jobs – without max_cost (set it on the trigger) and without idempotency_key (every run is a new job). env values are stored encrypted and never returned; a later change of job without env keeps them, "env": {} removes them.
sandboxOr: {"name": "my-agent", "command": "…", "cwd": "…", "template": "…", "timeout_s": 300} – the command in that named sandbox (see below).
schedule{"cron": "0 7 * * 1-5", "timezone": "Europe/Prague"} – see Schedule. Omit it for a webhook-only trigger; null in a change removes it.
webhook{"enabled": true, "signature": "none"} or "hmac-sha256" – see Webhook.
max_costRequired for jobs. Price limit of one run in your billing currency – a run whose worst case could cost more is refused.
max_cost_per_dayOptional limit of all runs of one day (UTC): a run that could exceed it is skipped.
concurrencyskip (default): no new run while the previous one still runs; allow: runs may overlap.
enabledfalse saves it paused; a change to true resumes it and resets the failure counter.

Schedule

Standard cron with five fields – minute hour day-of-month month day-of-week – in the IANA time zone you give (default UTC). Daylight saving time is handled: 0 7 * * * in Europe/Prague runs at 7:00 local time all year.

CronRuns
0 7 * * 1-5weekdays at 7:00
30 6 1 * *06:30 on the 1st of every month
0 */4 * * *every 4 hours
*/15 * * * *every 15 minutes (paid plans)
@hourly, @daily, @weekly, @monthlyshortcuts
  • Names work too (mon-fri, jan,jul); both 0 and 7 mean Sunday. When both day fields are set, either one matches (as in classic cron).
  • A local time that does not exist (the spring clock change) is skipped that day; a time that happens twice (autumn) runs once.
  • Runs start up to 30 seconds after the exact time, so that thousands of schedules at :00 do not start at the same moment.
  • Missed times – for example during maintenance – are not caught up: one run starts and records how many times were missed (missed).
  • The answer contains the next five run times (next_runs, UTC).

Webhook

With "webhook": {"enabled": true} the answer contains webhook_url – https://sandbox.wbx.cz/v1/hooks/trg_…/<secret>. It is shown only once; we keep only a hash of the secret part. Anyone who has the URL can start a run, so treat it like a password. POST …/rotate-secret creates a new URL and the old one stops working immediately.

curl -s -X POST "$WEBHOOK_URL" -H "Content-Type: application/json" -d '{"event": "push", "ref": "main"}'
# 202 {"run_id": "run_…", "job_id": "job_…", "status": "running"}
  • Only POST; the body may have up to 1 MB. Answers: 202 started, 401 missing or wrong signature, 404 unknown URL, 409 paused or the previous run still runs (run_skipped), 413 body too large, 429 more than 60 calls a minute or 1000 a day (with Retry-After).
  • The body is never put into the command. The job gets it as files in input/: input/webhook.body (the raw body) and input/webhook.json (time, content type, size, query parameters and the headers Content-Type, User-Agent and X-… – never Authorization, cookies or proxy headers). The paths are also in $WBX_WEBHOOK_BODY and $WBX_WEBHOOK_FILE.
import json, os
meta = json.load(open(os.environ["WBX_WEBHOOK_FILE"]))
event = meta["headers"].get("x-github-event")
payload = json.load(open(os.environ["WBX_WEBHOOK_BODY"]))

Signed webhooks

With "signature": "hmac-sha256" the answer also contains signing_secret (shown once). Every call must then carry X-WBX-Signature: sha256=<hex HMAC-SHA256 of the raw body> – or GitHub's X-Hub-Signature-256, so a GitHub webhook works when you paste the secret into its Secret field. Calls without a valid signature get 401 and start nothing.

import hashlib, hmac, urllib.request
body = b'{"event": "push"}'
sig = "sha256=" + hmac.new(SIGNING_SECRET.encode(), body, hashlib.sha256).hexdigest()   # or Trigger.sign(SIGNING_SECRET, body)
urllib.request.urlopen(urllib.request.Request(WEBHOOK_URL, data=body, method="POST", headers={"X-WBX-Signature": sig}))

The TypeScript SDK has signWebhook(secret, body). These are incoming webhooks that start runs; the signed notification we send when a job finishes is described in Webhooks.

A command in a named sandbox

With sandbox instead of job, each run wakes the named sandbox – with its files and, when it can be restored, its memory and running programs – and runs the command there. The sandbox is created on the first run (from template). An agent can keep notes, a database or a browser profile between runs.

Trigger.create("Agent check-in", "python agent.py --check-inbox", sandbox="my-agent", schedule="0 * * * *")
  • The time limit of one command is timeout_s (default 300, at most 3600). The sandbox then sleeps again as usual.
  • The run records the exit code and the last 4 KB of the output (GET …/runs); billing is the sandbox's running time.
  • A webhook's files are in /tmp/wbx-trigger/<run>/ (paths in $WBX_WEBHOOK_BODY and $WBX_WEBHOOK_FILE).

What a run gets

VariableValue
WBX_TRIGGER_IDthe trigger (trg_…)
WBX_TRIGGER_EVENTschedule, webhook or manual
WBX_TRIGGER_RUNthe run (run_…)
WBX_SCHEDULED_ATthe scheduled time (RFC 3339, UTC) – only for schedule
WBX_WEBHOOK_FILE, WBX_WEBHOOK_BODYthe webhook files – only for webhook

Limits and safety

PlanTriggersShortest schedule
Free2once an hour
Solo10every 5 minutes
Pro50every 5 minutes
Team and higher200every 5 minutes
  • Price limits. max_cost is checked for every run before it starts; max_cost_per_day counts the real cost of finished runs and the worst case of running ones. Your account's budget applies as well.
  • Automatic pause. After 5 failed runs in a row the trigger pauses and the account owner gets an e-mail with the last error. It also pauses when the account is suspended (for example, the credit has run out). Resume it in the portal or with "enabled": true after fixing the cause.
  • Plan changes. When a schedule runs more often than the current plan allows, it pauses with that reason.
  • All rules of jobs stay: network policy, no outgoing e-mail (SMTP), no mining.

Webhook data is untrusted

Anyone who knows the URL can send any body. Use a signature for services that support it, check the event inside your code, and do not let an AI agent follow instructions it finds in webhook data – treat it as input to analyse, not as commands (prompt injection). Keep secrets in env, not in the URL or the body.

REST API

CallDoes
POST /v1/triggerscreate (answer with webhook_url / signing_secret once)
GET /v1/triggerslist, with limits of your plan
GET /v1/triggers/{id}detail with next_runs
PATCH /v1/triggers/{id}change fields; {"enabled": false} pauses
DELETE /v1/triggers/{id}delete (jobs of earlier runs stay)
POST /v1/triggers/{id}/runone run now – also for a trigger paused by you or after failures
POST /v1/triggers/{id}/rotate-secretnew webhook URL (and signing secret)
GET /v1/triggers/{id}/runsthe last 50 runs: event, status, job, exit code, cost, error
POST /v1/hooks/{id}/{secret}the webhook URL – no API key

Errors: feature_disabled, trigger_limit, schedule_too_frequent, invalid_schedule, invalid_max_cost, trigger_paused, run_skipped, invalid_signature – see Errors.

Next steps