docs/guides/example-projects/human-in-the-loop-workflow.mdx
This demo is a full stack example that uses the following:
<Card title="View the human-in-the-loop workflow repo" icon="GitHub" href="https://github.com/triggerdotdev/examples/tree/main/article-summary-workflow"
Click here to view the full code for this project in our examples repository on GitHub. You can fork it and use it as a starting point for your own project. </Card>
<video controls className="w-full aspect-video" src="https://content.trigger.dev/reactflow-waitpoints-example.mov"
</video>
Each node in the workflow corresponds to a Trigger.dev task. The idea is to enable building flows by composition of different tasks. The output of one task serves as input for another.
useRealtimeRunsWithTag hook to subscribe to task runs associated with the workflow and passes down the run details to the nodes.The waitpoint token is created in a Next.js server action:
const reviewWaitpointToken = await wait.createToken({
tags: [workflowTag],
timeout: "1h",
idempotencyKey: `review-summary-${workflowTag}`,
});
and later completed in another server action in the same file:
await wait.completeToken<ReviewPayload>(
{ id: tokenId },
{
approved: true,
approvedAt: new Date(),
approvedBy: user,
}
);
While the workflow in this example is static and does not allow changing the connections between nodes in the UI, it serves as a good baseline for understanding how to build completely custom workflow builders using Trigger.dev and ReactFlow.
To learn more, take a look at the following resources: