api.workflows

getRun()

api.workflows.getRun(runId) → Promise<WorkflowRun>

Une course à partir de son identifiant seul — sans savoir à quel flux il appartient.

GET /api/workflows/runs/:idfreeno workflow needed
Using Python?

Switch any code block to Python: the choice applies to every page. Python SDK guide and resource reference.

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"]])

Raison d’être

Un identifiant de course est souvent tout ce que vous avez

Quelque chose a commencé une course — un agent, un webhook, un déclencheur programmé — et a remis un id. Sans cela, vous devriez connaître le flux de travail d'abord et trouver la course dans sa liste, qui est un détour pour une chose que vous avez déjà identifiée.

Après une série de processus

// 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"])

Le lancement ne dépend pas de l'un ou l'autre processus : il est sur la plate-forme dès le début.

C'est un WorkflowRun complet

refresh(), wait(), resume(), retry() et cancel() Tout travail — de sorte qu'une approbation humaine peut être donnée d'un endroit complètement différent de l'endroit où la course a commencé.