runAgent), input and screenshot methods below require a GUI sandbox.
npm install https://api.offstage.cloud/sdk/offstage-cloud-0.3.4.tgz. npm currently serves the older SDK 0.2.3, which lacks newer methods documented here, including runAgent; use the hosted tarball for this API reference. Each version’s tarball URL is permanent and its bytes never change, so a lockfile’s integrity hash stays valid; https://api.offstage.cloud/sdk/offstage-cloud.tgz always serves the newest version, but don’t put it in a lockfile. It is ESM, has no dependencies, uses only fetch, and runs on Node 18+, Bun and Deno. It reads OFFSTAGE_API_KEY and OFFSTAGE_API_URL (set the latter to https://api.offstage.cloud).
- Sandboxes.
Sandbox.create,Sandbox.connect(id),Sandbox.list({ state }),Sandbox.getInfo(id)andSandbox.kill(id). - A sandbox’s calls.
sandbox.commands.run(cmd, { cwd, envs, timeoutMs }),sandbox.files.write(path, data),sandbox.files.read(path, { format: "text" | "bytes" }),sandbox.screenshot({ maxDimension }),sandbox.input(actions, { screen })(withscreenSize(png)for a screenshot’s size),sandbox.runAgent({ goal, maxSteps, maxDurationMs, model, anthropicApiKey, onProgress })(follows the run to its end; the key defaults toANTHROPIC_API_KEY, and afailedorincompleteverdict does not throw),sandbox.runFrame(runId, frame),sandbox.setTimeout(ms)(from now, like E2B),sandbox.getInfo()andsandbox.kill(). - Tasks.
Task.create({ repo, kind, command, agent, artifacts, session, timeoutMs, queueTimeoutMs }),Task.get(id),Task.list({ state })(summaries, without events),task.wait({ pollMs, timeoutMs })(held on the plane with?wait=),task.cancel()/Task.cancel(id),task.artifact(name),task.logs()andtask.refresh().task.info.exitCodeis the command’s exit status, andtask.info.failureReasonsays why it failed. - Errors. Errors are
OffstageErrorwithstatus,code,message,fixandrequestId.isOffstageError(e)tests for one. The SDK’s own codes, raised with status 0, aremissing-api-key,bad-api-key,missing-model-key,network-errorandwait-timeout. - Retries. Creates send an
Idempotency-Keyand retry network errors, 502, 503 and 504, and 409idempotency-key-in-use.commands.runfollows a202until the command ends, retrying network errors, 502, 503 and 504 on those follows. Sandbox ops retry 409sandbox-not-readyfor 30 s. Nothing else is retried, and a command is never started twice.