Durable Workflows
Multi-step jobs that survive failure
Build long-running, multi-step processes that survive failures. Each step is persisted as it completes; if a step throws, only that step is retried, three times with exponential backoff by default, and every run is inspectable step by step in the dashboard.
Workflow Executions
Recent Executions
Workflow executions (auto-refreshes every 5 seconds)
| ID | Status | Steps | Duration | Started | |
|---|---|---|---|---|---|
| exec_a1b2c3... | Completed | 4/4 | 2.3s | UTC ISO 2024-01-15T10:30:00.000Z Local Time Jan 15, 2024, 10:30 AM UTC | View |
| exec_d4e5f6... | Running | 2/4 | - | UTC ISO 2024-01-15T10:29:45.000Z Local Time Jan 15, 2024, 10:29 AM UTC | View |
| exec_g7h8i9... | Completed | 4/4 | 1.9s | UTC ISO 2024-01-15T10:25:00.000Z Local Time Jan 15, 2024, 10:25 AM UTC | View |
| exec_j0k1l2... | Failed | 3/4 | 5.4s | UTC ISO 2024-01-15T10:20:00.000Z Local Time Jan 15, 2024, 10:20 AM UTC | View |
| exec_m3n4o5... | Cancelled | 1/4 | 450ms | UTC ISO 2024-01-15T10:15:00.000Z Local Time Jan 15, 2024, 10:15 AM UTC | View |
Key Features
Durable Execution
Completed steps are never repeated, even if the worker is restarted mid-run.
Per-Step Retries
Three retries with exponential backoff by default, configurable per workflow or per step.
Step Tracking
Follow every execution step by step, with inputs, outputs, and timings.
Trigger From Anywhere
Start a workflow from a request, a queue message, a cron run, or another workflow.
Workflow Definition
Define steps with step.run(). Each one is persisted when it finishes.
src/index.ts
export default {
async fetch(request, env) {
const { executionId } = await env.ONBOARDING
.trigger({ userId: "123" });
return Response.json({ executionId });
},
workflows: {
onboarding: {
handler: async ({ input, step }) => {
const user = await step.run("load-user", () =>
loadUser(input.userId),
);
await step.run("send-welcome", () => sendEmail(user));
},
},
},
} satisfies Ploy;