| Call | Does |
|---|---|
| refresh() | Re-reads its state. |
| wait(options) | Polls until it reaches a status you named. |
| resume(stepId, data) | Approves a waiting human step. |
| retry(stepId) | Runs it again from a step, keeping what came before. |
| cancel() | Stops it. |
What data holds
run.data;
// {
// id, workflowId, status: "running" | "waiting" | "succeeded" | "failed" | "cancelled",
// input: { … },
// steps: [{ id, type, status, output, credits, error, warnings, attempts, startedAt, endedAt }],
// credits, startedAt, endedAt
// }run.data
# {
# "id", "workflowId", "status": "running" | "waiting" | "succeeded" | "failed" | "cancelled",
# "input": {…},
# "steps": [{"id", "type", "status", "output", "credits", "error", "warnings", "attempts", "startedAt", "endedAt"}],
# "credits", "startedAt", "endedAt"
# }The five statuses
| status | Means | What you can do |
|---|---|---|
running | In progress. | cancel() |
waiting | Stopped at a human step. | resume() · cancel() |
succeeded | Finished. | — |
failed | A step failed. | retry() |
cancelled | Stopped. | — |
Every method updates the object
refresh(), resume(), retry() and cancel() all replace data with what came back and return the same instance — so a reference you hold stays current.
It is a snapshot until you refresh it
data is whatever the last call returned. A run moves on the platform without telling you — reading data twice without a refresh gives the same answer.