{ id: "approve", type: "human", config: { title: "Send this digest?" } }{"id": "approve", "type": "human", "config": {"title": "Send this digest?"}}What happens
- The run's status becomes
waiting, and the step's too. - Nothing downstream runs.
- resume(stepId, data) approves it.
- What you pass becomes the step's output, readable by the rest of the chain.
await run.resume("approve", { approved: true, recipient: "team@example.com" });
// Downstream
{ id: "send", type: "mail.send", config: {
box: "ops@example.com",
to: "{{steps.approve.output.recipient}}",
subject: "Digest", text: "{{steps.write.output.text}}" } }run.resume("approve", {"approved": True, "recipient": "team@example.com"})
# Downstream
{"id": "send", "type": "mail.send", "config": {
"box": "ops@example.com",
"to": "{{steps.approve.output.recipient}}",
"subject": "Digest", "text": "{{steps.write.output.text}}"}}Three types require one upstream
In a conversation those are asked every time and no mode opens them. A run has nobody to ask, so the approval is required in the graph — and a definition without it is refused when you save it.
« Upstream » means on the path that reaches it. A human step on another branch does not cover a step the run can arrive at without passing through it.
It waits indefinitely
There is no expiry. An approval that lapsed on its own would let a chain stall with nobody told — so a run that nobody will approve is closed with cancel(), and the record says it was cancelled.
Building an approval inbox
const waiting = (await workflow.runs()).filter((r) => r.data.status === "waiting");waiting = [r for r in workflow.runs() if r.data["status"] == "waiting"]It cannot be tested
runStep() answers step_not_executable: there is nothing to execute, only something to approve.