run_script
Run JavaScript on the account's computer with bun — no agent turn — and wait for its result. tools.<namespace>.<function>(args) calls anything list_integration_tools shows (every call returns its result and throws on failure; top-level await works), and the script's last expression is its result. Chain calls and transform data in one run, e.g. const { data } = await tools.crevioApi.listOrders({ status: "succeeded" }); data.length. Runs as you, and only for account admins. If the wait ends first the reply has wait_timed_out: true and the run id: continue with wait_for_script_run — calling run_script again runs it twice unless you reuse the idempotency_key. Run ids do not expire, and only the user who started a run can read it. At most 4 runs in flight per user.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | The JavaScript to run. | |
| wait_seconds | No | How long to wait for the script to finish before returning. Defaults to, and is capped at, 300 s when your client accepts a streamed reply (text/event-stream), 90 s otherwise. The script keeps going when the wait ends first. | |
| idempotency_key | No | Always pass one, unique to this request. Retrying with the same key within an hour returns the run the first call started instead of doing the job twice. | |
| timeout_seconds | No | How long the script may run (default 300). |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | ||
| calls | Yes | Every tool call the script made, in order. | |
| error | No | ||
| object | Yes | ||
| output | No | What the script printed (the last 64,000 characters). | |
| result | No | The script's last expression, as JSON. | |
| reused | No | ||
| status | Yes | ||
| next_step | No | ||
| created_at | Yes | ||
| started_at | No | ||
| completed_at | No | ||
| wait_timed_out | No | The wait ended first. The work is still running: follow it with the tool next_step names. | |
| timeout_seconds | Yes |