const run = await api.workflows.getRun(runId);
await run.wait();
console.log(run.data.status, run.data.steps.map((s) => `${s.id}: ${s.status}`));run = api.workflows.get_run(run_id)
run.wait()
print(run.data["status"], [f"{s['id']}: {s['status']}" for s in run.data["steps"]])Why it exists
A run identifier is often all you have
Something started a run — an agent, a webhook, a scheduled trigger — and handed back an id. Without this you would have to know the workflow first and find the run in its list, which is a detour for a thing you already identified.
Following a run across processes
// One process starts it
const { id } = (await workflow.run({ input })).data;
await queue.push(id);
// Another, later, follows it
const run = await api.workflows.getRun(id);
await run.wait({ until: ["succeeded", "failed", "waiting"] });# One process starts it
run_id = workflow.run(input=payload).id
queue.push(run_id)
# Another, later, follows it
run = api.workflows.get_run(run_id)
run.wait(until=["succeeded", "failed", "waiting"])The run does not depend on either process: it is on the platform from the moment it starts.
It is a full WorkflowRun
refresh(), wait(), resume(), retry() and cancel() all work — so a human approval can be given from somewhere entirely different from where the run began.