Runs and recovery

Understand asynchronous run states and resume work without double execution.

View Markdown

Some tools take time to finish. Your agent can check an existing run without starting it again or paying twice. If you call MCP directly, use the resume example below.

The run states

  • Queued: accepted and waiting to start.
  • Running: the tool is working.
  • Succeeded: the result and final cost are ready.
  • Failed: the run is not charged and its reserved funds are released.
  • Awaiting approval: a run exceeds your approval threshold and needs your permission.

Resume, do not duplicate

A new run_tool call requires tool_id, input and one UUID idempotency_key. Keep that UUID with the paid intent; if the start response is lost, retry the exact tool, input and UUID. A fresh UUID with new-run fields starts another paid run.

Once you have run_id, read it with the free get_run tool:

code
{
  "name": "get_run",
  "arguments": {
    "run_id": "<existing run id>"
  }
}

No idempotency key is required or accepted for retrieval. Optional wait_seconds accepts integers from 0 through 120, defaults to 50, and returns the current state immediately at 0. Reading starts nothing and costs nothing. All states retain the same run_id, including success and failure.

Use scrollport get_run <run-id> [--wait-seconds 0..120] in the CLI, or GET /v1/runs/:id for one immediate HTTP read.

When a run finishes or needs help

  • succeeded: read result, artifacts and cost_final, then reconcile with get_wallet.
  • failed: read error, message and hint; inspect the provider state before deciding whether a new paid intent is appropriate.
  • awaiting_approval: show the human the estimate and approval URL.
  • connection_required: send the human to connect_url, then inspect the same tool again.

Check the run's reported final cost to confirm the charge. A timeout alone does not tell you whether the run finished.

Preview output in the website

Click a run activity row to preview its saved output in a modal, then close it to return to your history. Uploaded references and generated files are also available in the workspace Files library. See Files and run output for supported previews, uploads and retention.

Runs and recovery — Scrollport