Run a script
Changed onRuns JavaScript on the account's computer with bun, with no agent turn, as the key's owner (account admins only; team keys cannot). tools.<namespace>.<function>(args) calls the Crevio API and connected integrations, and the script's last expression is its result. args reach the script as the global args (and process.argv). Files written into the directory named by the global outputDir (20 at most, 50 MB each) come back as artifacts. A call that needs approval does not run: it resolves to {pending: true, draft_id, approval}, the script carries on, and the run lists it in approvals and pending_approval_ids. Approving it (POST /approvals/{id}/approve) runs that one frozen call, never the script again. 200 when it finished within wait_seconds, 202 otherwise: poll GET /script_runs/{id}. At most 4 runs in flight per user and 8 per account (429). Needs the scripts scope.
Request
- Base URLhttps://api.crevio.co/v1
- AuthAPI key in header Authorization
Headers
Makes this write safe to retry: a repeat with the same key replays the first response instead of creating a second resource. Scoped to the account, remembered for 24 hours; reusing a key with a different payload is an error.
Request body
The JavaScript to run.
Values the script reads from the global args.
How long the script may run.
Hold the response until the script finishes, up to this many seconds.
Response
The script finished within wait_seconds
The value was too large to return, so result holds the start of its JSON text instead.
What the script printed: its start and end when long, with the cut marked.
Every tool call the script made, in order: {role, status, read_only, error_code, approval_id}. A 202 call did not run and names its approval.
What the script's gated calls froze, as each stands now. Approving one runs that call, never the script again.
Approvals still waiting for a decision: POST /approvals/{id}/approve or /deny.
Files the script wrote to outputDir.
Changes
- info
added the required property
approvals/items/detailsto the response with the status - info
added the required property
approvals/items/detailsto the response with the status - info
added the required property
approvals/items/requestto the response with the status
1 more change in this revision
- info