workflow 5.5.0 → 5.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. package/dist/api-workflow.js +1 -1
  2. package/dist/api.js +1 -1
  3. package/dist/astro.js +1 -1
  4. package/dist/index.js +1 -1
  5. package/dist/internal/builtins.js +1 -1
  6. package/dist/internal/class-serialization.js +1 -1
  7. package/dist/internal/errors.js +1 -1
  8. package/dist/nest-builder.js +1 -1
  9. package/dist/nest-vercel-builder.js +1 -1
  10. package/dist/nest.js +1 -1
  11. package/dist/next.cjs +1 -1
  12. package/dist/nitro.js +1 -1
  13. package/dist/nuxt.js +1 -1
  14. package/dist/observability.js +1 -1
  15. package/dist/runtime.js +1 -1
  16. package/dist/stdlib.js +1 -1
  17. package/dist/sveltekit.js +1 -1
  18. package/dist/typescript-plugin.cjs +1 -1
  19. package/dist/vite.js +1 -1
  20. package/dist/workflow.js +1 -1
  21. package/docs/api-reference/workflow-api/get-run.mdx +0 -4
  22. package/docs/api-reference/workflow-api/resume-hook.mdx +1 -1
  23. package/docs/api-reference/workflow-api/start.mdx +1 -1
  24. package/docs/api-reference/workflow-errors/in-band-superseded-error.mdx +0 -3
  25. package/docs/api-reference/workflow-errors/index.mdx +1 -1
  26. package/docs/api-reference/workflow-errors/precondition-failed-error.mdx +0 -2
  27. package/docs/api-reference/workflow-errors/workflow-not-registered-error.mdx +1 -1
  28. package/docs/api-reference/workflow-runtime/world/queue.mdx +70 -3
  29. package/docs/comparisons/index.mdx +4 -1
  30. package/docs/comparisons/workflow-sdk-vs-aws-step-functions.mdx +3 -1
  31. package/docs/comparisons/workflow-sdk-vs-cloudflare-workflows.mdx +4 -1
  32. package/docs/comparisons/workflow-sdk-vs-inngest.mdx +271 -28
  33. package/docs/comparisons/workflow-sdk-vs-temporal.mdx +6 -2
  34. package/docs/comparisons/workflow-sdk-vs-trigger-dev.mdx +2 -0
  35. package/docs/configuration/cli-and-web-ui.mdx +31 -1
  36. package/docs/configuration/runtime-tuning.mdx +9 -8
  37. package/docs/configuration/worlds.mdx +18 -21
  38. package/docs/cookbook/advanced/child-workflows.mdx +1 -1
  39. package/docs/cookbook/common-patterns/batching.mdx +1 -1
  40. package/docs/errors/index.mdx +1 -0
  41. package/docs/errors/max-events-exceeded.mdx +2 -2
  42. package/docs/errors/replay-timeout.mdx +2 -2
  43. package/docs/errors/workflow-not-registered.mdx +1 -1
  44. package/docs/foundations/errors-and-retries.mdx +1 -4
  45. package/docs/how-it-works/event-sourcing.mdx +2 -5
  46. package/docs/how-it-works/framework-integrations.mdx +2 -2
  47. package/docs/internal/index.mdx +1 -0
  48. package/docs/internal/nitro-native-build.mdx +1 -0
  49. package/docs/internal/nitro-web-ui.mdx +1 -0
  50. package/docs/internal/serializable-abort-controller.mdx +1 -0
  51. package/docs/observability/index.mdx +2 -0
  52. package/docs/whats-new.mdx +3 -3
  53. package/docs/worlds/building-a-world.mdx +46 -4
  54. package/docs/worlds/local.mdx +110 -25
  55. package/docs/worlds/postgres.mdx +107 -27
  56. package/docs/worlds/upgrading-to-v5.mdx +4 -4
  57. package/docs/worlds/vercel.mdx +190 -82
  58. package/package.json +14 -12
  59. package/dist/api-workflow.d.ts.map +0 -1
  60. package/dist/api.d.ts.map +0 -1
  61. package/dist/astro.d.ts.map +0 -1
  62. package/dist/index.d.ts.map +0 -1
  63. package/dist/internal/builtins.d.ts.map +0 -1
  64. package/dist/internal/class-serialization.d.ts.map +0 -1
  65. package/dist/internal/errors.d.ts.map +0 -1
  66. package/dist/nest-builder.d.ts.map +0 -1
  67. package/dist/nest-vercel-builder.d.ts.map +0 -1
  68. package/dist/nest.d.ts.map +0 -1
  69. package/dist/nitro.d.ts.map +0 -1
  70. package/dist/nuxt.d.ts.map +0 -1
  71. package/dist/observability.d.ts.map +0 -1
  72. package/dist/runtime.d.ts.map +0 -1
  73. package/dist/stdlib.d.ts.map +0 -1
  74. package/dist/sveltekit.d.ts.map +0 -1
  75. package/dist/vite.d.ts.map +0 -1
  76. package/dist/workflow.d.ts.map +0 -1
  77. package/docs/changelog/attributes-mvp.mdx +0 -380
  78. package/docs/changelog/batched-event-writes.mdx +0 -77
  79. package/docs/changelog/eager-processing.mdx +0 -273
  80. package/docs/changelog/index.mdx +0 -19
  81. package/docs/changelog/lazy-event-creation.md +0 -127
  82. package/docs/changelog/lazy-hook-resume.mdx +0 -78
  83. package/docs/changelog/meta.json +0 -16
  84. package/docs/changelog/resilient-resume.mdx +0 -32
  85. package/docs/changelog/resilient-start.mdx +0 -77
  86. package/docs/changelog/spec-9.mdx +0 -4167
  87. package/docs/changelog/step-message-ownership.mdx +0 -355
  88. package/docs/changelog/turbo-mode.md +0 -91
@@ -7,6 +7,7 @@ prerequisites:
7
7
  - /docs/foundations/workflows-and-steps
8
8
  related:
9
9
  - /docs/foundations/hooks
10
+ - /docs/foundations/idempotency
10
11
  - /docs/foundations/streaming
11
12
  - /docs/ai
12
13
  ---
@@ -27,6 +28,8 @@ related:
27
28
  | **Where execution runs** | Orchestration + execution co-located on your platform | **Your code runs on your infrastructure**; Inngest invokes it per step over HTTP (Serve) or a persistent worker connection (Connect, in public beta) |
28
29
  | **Languages** | TypeScript / JavaScript (Python beta) | TypeScript; Python and Go (production, pre-1.0) |
29
30
  | **Versioning** | Runs pinned to immutable deployment | Tracked by step-ID hashes: hot-edit functions, but editing a step's logic under the **same ID** reuses the old memoized result for in-flight runs; rename the ID or route a new function by timestamp for rewrites |
31
+ | **Duplicate starts** | `start(workflow, args, { experimental_hook: { token } })` admits one run per token, with an optional retention after the run ends | `idempotency` key (24-hour window) or `singleton` |
32
+ | **Searching runs** | String [attributes](/docs/observability/attributes) set with `setAttributes()` or at `start()`, filterable by `key=value` | Search by event payload in the Inngest dashboard |
30
33
  | **AI & streaming** | `WorkflowAgent` in the AI SDK; native resumable streaming | Native AI SDK via `step.ai.wrap`; **AgentKit** multi-agent framework and durable **Realtime** (`step.realtime.publish`) + `useAgent` hook, both Developer Preview |
31
34
  | **Security** | Zero-config per-run end-to-end (E2E) encryption by default; platform security is per World (the Vercel World inherits Vercel's security posture) | Runs on your infrastructure; signed requests; first-party E2E encryption middleware (TypeScript and Python); SOC 2 Type II, HIPAA add-on |
32
35
  | **Portability** | Apache-2.0; World abstraction; **self-host supported** | Engine open source (Server Side Public License); self-host via single Go binary + Postgres, but **self-hosting is community/best-effort**: no support service-level agreement, and the `inngest start` binary is Beta (the hosted service is the default) |
@@ -39,7 +42,9 @@ related:
39
42
 
40
43
  Inngest's engine lives outside your code and calls your functions step-by-step over HTTP (or a Connect worker). That keeps your code on your own infrastructure for portability and data locality, but adds a network round trip per step. This overhead matters for workflows with many small sequential steps. The Workflow SDK co-locates orchestration and execution on one platform, so steps don't require a per-step HTTP request.
41
44
 
42
- Triggering also differs. Inngest is event-driven (publishers `send` events; functions subscribe), which supports loosely coupled fan-out. The Workflow SDK's `start()` imports the workflow function directly, providing tighter coupling and stronger type safety. For event-bus-style fan-out, wrap `start()` in a shared publisher.
45
+ Since v5, one invocation also runs as many steps as it can in a single pass, several of them in parallel, and only hands back to the queue for a wait, a hook, or when the function nears its time limit. A chain of small steps therefore costs a few invocations rather than one per step. See [Performance](/docs/performance) for the benchmarks.
46
+
47
+ Triggering also differs. Inngest is event-driven (publishers `send` events; functions subscribe), which supports loosely coupled fan-out. The Workflow SDK's `start()` imports the workflow function directly, providing tighter coupling and stronger type safety. For event-bus-style fan-out, wrap `start()` in a shared publisher. A run can also call `start()` itself to spawn a child run, without wrapping it in a step.
43
48
 
44
49
  ## Versioning
45
50
 
@@ -53,50 +58,288 @@ Inngest offers `step.ai.wrap()` (wrap Vercel AI SDK calls as durable steps), **A
53
58
 
54
59
  ## Migrating from Inngest
55
60
 
56
- | Inngest | Workflow SDK | Note |
57
- | --- | --- | --- |
58
- | `inngest.createFunction()` | `"use workflow"` function started with `start()` | No factory or event binding. |
59
- | `step.run()` | `"use step"` function | Named async function with Node.js access. |
60
- | `step.sleep()` / `step.sleepUntil()` | `sleep('5m')` / `sleep(date)` | Import from `workflow`. |
61
- | `step.waitForEvent()` | `createHook()` / `createWebhook()` | Token encodes the routing; no event schema. |
62
- | `step.invoke()` | [`start()`](/docs/foundations/starting-workflows) called directly from the workflow | Spawn a child run. |
63
- | `inngest.send()` / event triggers | `start()` from your app boundary | Start workflows directly. |
64
- | Retry config (`retries`) / `RetryAfterError` | `maxRetries`, `RetryableError`, `FatalError` | Retries live at the step boundary. For custom backoff via `retryAfter`, see [Errors & Retrying](/docs/foundations/errors-and-retries#customize-retry-behavior). |
65
- | `step.realtime.publish()` / Realtime | `getWritable()` / named streams | Clients read from the stream. |
61
+ ### Run the codemod
62
+
63
+ The `workflow` CLI includes a codemod that does the mechanical part of a migration. Run it from your project root, on a clean working tree so its changes are easy to review:
64
+
65
+ ```bash
66
+ npx workflow migrate inngest
67
+ ```
68
+
69
+ It reads the project's `tsconfig.json` to find the files to migrate, and uses the project's own TypeScript. Pass paths to limit it (`npx workflow migrate inngest src/inngest`), `--dry-run` to see what would change without writing anything, and `--report <file>` to write a Markdown report. See [`workflow migrate`](/docs/configuration/cli-and-web-ui#migrate-from-inngest) for every flag.
70
+
71
+ The main job is lifting each `step.run()` closure into a named `"use step"` function. A closure can read anything in scope, but a step function only gets its arguments, because they are recorded in the event log. So the codemod finds every variable the closure reads from the handler (the event, earlier step results, loop variables), makes each one a parameter of the new step function, and passes it at the call site. It lists the captured variables of every step it lifts, so you can check that each one is [serializable](/docs/foundations/serialization). Variables declared at module scope, such as imports and constants, stay visible to a module-level step and are not passed.
72
+
73
+ {/* @skip-typecheck: Inngest code, the input of the codemod */}
74
+ ```typescript title="inngest/functions.ts (before)"
75
+ import { inngest } from './client';
76
+ import { userActive, userSignup } from './events';
77
+ import { db, email } from './services';
78
+
79
+ export const onboardUser = inngest.createFunction(
80
+ { id: 'onboard-user', retries: 5, triggers: [userSignup] },
81
+ async ({ event, step }) => {
82
+ const user = await step.run('create-user', () =>
83
+ db.users.create({ id: event.data.userId, email: event.data.email })
84
+ );
85
+
86
+ await step.sleep('wait-a-day', '1d');
87
+
88
+ const activity = await step.waitForEvent('wait-for-activity', {
89
+ event: userActive,
90
+ timeout: '7d',
91
+ match: 'data.userId',
92
+ });
93
+
94
+ await step.run('send-follow-up', () =>
95
+ email.send(user.email, activity ? 'tips' : 'nudge')
96
+ );
97
+ }
98
+ );
99
+ ```
100
+
101
+ ```typescript title="inngest/functions.ts (after, formatted)"
102
+ import { createHook, type Hook, sleep } from 'workflow';
103
+ declare const db: { users: { create(user: { id: string; email: string }): Promise<{ id: string; email: string }> } }; // @setup
104
+ declare const email: { send(to: string, template: string): Promise<void> }; // @setup
66
105
 
67
- The `createFunction` factory collapses into a plain exported function:
106
+ export async function onboardUser(event: {
107
+ data: { userId: string; email: string };
108
+ }) {
109
+ 'use workflow';
110
+ const user = await createUser(event); // [!code highlight]
68
111
 
69
- ```typescript title="workflows/order.ts"
70
- export async function processOrder(orderId: string) {
71
- 'use workflow'; // [!code highlight]
72
- const order = await loadOrder(orderId);
73
- return { orderId: order.id, status: 'completed' };
112
+ await sleep('1d');
113
+
114
+ // TODO(workflow-migrate): Only one run at a time can own this hook token. Inngest resumed every run waiting for a matching "app/user.active"; if two onboardUser runs can wait for the same key at once, add something unique to the token (for example the run ID) and resume each run where the event is sent. Otherwise, delete this comment.
115
+ const activity = await waitForHook(
116
+ createHook({ token: `app/user.active:onboardUser:${event.data.userId}` }), // [!code highlight]
117
+ sleep('7d')
118
+ );
119
+
120
+ await sendFollowUp(user, activity); // [!code highlight]
121
+ }
122
+
123
+ async function createUser(event: { data: { userId: string; email: string } }) {
124
+ 'use step';
125
+ return db.users.create({ id: event.data.userId, email: event.data.email });
126
+ }
127
+ createUser.maxRetries = 5;
128
+
129
+ async function sendFollowUp(
130
+ user: { id: string; email: string },
131
+ activity: any
132
+ ) {
133
+ 'use step';
134
+ return email.send(user.email, activity ? 'tips' : 'nudge');
74
135
  }
136
+ sendFollowUp.maxRetries = 5;
75
137
 
76
- async function loadOrder(orderId: string) {
77
- 'use step'; // [!code highlight]
78
- const res = await fetch(`https://example.com/api/orders/${orderId}`);
79
- return res.json() as Promise<{ id: string }>;
138
+ /** Resolves with the hook's payload, or with null once `timeout` resolves. */
139
+ async function waitForHook<T>(
140
+ hook: Hook<T>,
141
+ timeout?: Promise<void>
142
+ ): Promise<T | null> {
143
+ try {
144
+ return await (timeout
145
+ ? Promise.race([hook, timeout.then(() => null)])
146
+ : hook);
147
+ } finally {
148
+ hook.dispose();
149
+ }
80
150
  }
81
151
  ```
82
152
 
153
+ The run above prints each step it lifted with the variables it captured:
154
+
155
+ ```bash
156
+ inngest/functions.ts
157
+ onboardUser (was onboard-user)
158
+ step create-user -> createUser() captures event
159
+ step send-follow-up -> sendFollowUp() captures user, activity
160
+ hook app/user.active -> token `app/user.active:onboardUser:${event.data.userId}`
161
+ ```
162
+
163
+ Beyond `step.run()`, the codemod:
164
+
165
+ - Turns each `createFunction()` into an exported `"use workflow"` function that takes the triggering event as its argument, so `event.data` keeps working. With typed events, it types the parameter, and it types each captured parameter from its call site.
166
+ - Rewrites `step.sleep()`, `step.sleepUntil()`, `step.fetch()`, `step.invoke()` and `step.ai.wrap()`. A `step.ai.wrap()` step evaluates its inputs itself, so the model object is never passed as an argument, and returns only the fields you destructure from the result.
167
+ - Turns `step.waitForEvent()` and `step.waitForSignal()` into a hook raced against `sleep()`, through a small `waitForHook()` helper it adds to the file. The helper disposes the hook when the wait ends, so a later wait in the same run can use the same token, as Inngest allowed. A `waitForEvent()` token is built from the event name, the workflow name, and the value `match` compared (or an `if` expression that compares one field), so the code that sent the event can build the same token for `resumeHook()`.
168
+ - Turns `retries` into `maxRetries` on every step, `NonRetriableError` into `FatalError`, `RetryAfterError` into `RetryableError`, `runId` into `getWorkflowMetadata().workflowRunId`, `attempt` into `getStepMetadata().attempt - 1`, and `logger` into `console`. It follows `const` references, so `retries: MAX_RETRIES` and a config object declared elsewhere in the file are read too.
169
+ - Imports the Workflow APIs it uses under an alias when the file already has a binding with that name, and removes imports that nothing uses any more, such as the Inngest client and the error classes.
170
+
171
+ It never guesses. Code it cannot migrate without changing behavior is left in place under a `// TODO(workflow-migrate): ...` comment that says what to do. That covers a closure that assigns to a variable outside it (the write would be lost once the value is passed by value), a closure that calls a function declared in the handler, `step.sendEvent()`, flow-control options, cron triggers, function options it cannot read, and global `fetch()` calls outside a step. Every migrated `waitForEvent()` also gets one, because of [one owner per token](#one-owner-per-token).
172
+
173
+ The report lists every `inngest.send()` and `serve()` call in the project with its replacement, and has an **Event routing** table: for each event name, the workflows it starts and the hook tokens it resumes. That table is what you need to rewrite an app that forwards events generically, such as `inngest.send({ name: req.body.name, data: req.body.data })`.
174
+
175
+ ### What the codemod converts
176
+
177
+ | Inngest | Converted automatically | Left as a TODO |
178
+ | --- | --- | --- |
179
+ | `createFunction()` | Module-level function, assigned to a `const` or `export default` | Created inside another function, or not assigned |
180
+ | Function options | `id`, `triggers`, `retries`, also through `const` references | `concurrency`, `throttle`, `rateLimit`, `debounce`, `batchEvents`, `priority`, `timeouts`, `cancelOn`, `idempotency`, `singleton`, `middleware`, cron triggers; options it cannot read; `onFailure` (kept as a named function) |
181
+ | `step.run()` | Closures and function references, with captured variables, inputs, and parameter defaults or computed keys | Closures that assign to a captured variable, call a function declared in the handler, use `this`, or call another step |
182
+ | `step.sleep()` / `step.sleepUntil()` / `step.fetch()` / `step.invoke()` | Yes | `step.invoke()` given a function by reference |
183
+ | `step.waitForEvent()` | `match`, or an `if` that compares one field | Any other `if`, a wait with neither, and the [one owner per token](#one-owner-per-token) check |
184
+ | `step.waitForSignal()` | Yes, keeping the `{ signal, data }` result, and a replaced wait timing out with `null` | None |
185
+ | `step.ai.wrap()` | Yes | Inputs that `await` |
186
+ | `step.sendEvent()`, `step.sendSignal()`, `step.ai.infer()`, `step.realtime.publish()` | None | All |
187
+ | Handler context | `event`, `runId`, `attempt`, `logger` | `events` (batches), middleware context |
188
+
83
189
  <Callout type="info">
84
- Install the migration skill to translate an Inngest app automatically:
190
+ For what the codemod leaves to you, install the migration skill and ask your agent to finish the migration:
85
191
 
86
192
  ```bash
87
193
  npx skills add https://github.com/vercel/workflow --skill migrating-to-workflow-sdk
88
194
  ```
89
195
  </Callout>
90
196
 
91
- ### Inngest features without a direct Workflow SDK equivalent
197
+ ### Concept mapping
198
+
199
+ | Inngest | Workflow SDK | Note |
200
+ | --- | --- | --- |
201
+ | `inngest.createFunction()` | `"use workflow"` function started with `start()` | No factory or event binding. |
202
+ | `step.run()` | `"use step"` function | Named async function with Node.js access. Variables the closure captured become arguments. |
203
+ | `step.sleep()` / `step.sleepUntil()` | `sleep('5m')` / `sleep(date)` | Import from `workflow`. |
204
+ | `step.waitForEvent()` | `createHook()` raced against `sleep()`, disposed when the wait ends | The token encodes what `match` compared; `resumeHook(token, event)` replaces sending the event, once for each workflow waiting for it. One run owns a token at a time: see [One owner per token](#one-owner-per-token). Use [`createWebhook()`](/docs/api-reference/workflow/create-webhook) when the sender needs a URL to call. |
205
+ | `step.waitForSignal()` / `inngest.sendSignal()` | `createHook({ token: signal })` / `resumeHook(signal, { signal, data })` | Resume with the `{ signal, data }` envelope, so code that reads `result.data` keeps working. `onConflict: 'replace'` maps to [`experimental_force: true`](/docs/api-reference/workflow/create-hook#take-over-a-token-another-run-holds). The replaced run's `await hook` rejects with `HookForceClaimedError`; where Inngest left that wait pending until its timeout and then returned `null`, the codemod's helper catches the error and does the same. |
206
+ | `step.invoke()` | [`start()`](/docs/foundations/starting-workflows) called in the workflow, then `await run.returnValue` | Spawns a child run; the parent waits without polling. |
207
+ | `inngest.send()` / event triggers | `start()` from your app boundary | Start workflows directly. |
208
+ | `idempotency` | [`start(workflow, args, { experimental_hook: { token, experimental_minRetention: '24h' } })`](/docs/foundations/idempotency#start-a-run-once-per-key) | A duplicate start throws `HookConflictError` naming the run that owns the token, for 24 hours from the first start, as Inngest's idempotency window does. |
209
+ | `singleton: { mode: 'skip' }` | `start(workflow, args, { experimental_hook: { token } })` without a retention | Only overlapping runs are refused: the token is released when the run ends, so the next start is admitted. Catch `HookConflictError` to skip. |
210
+ | `singleton: { mode: 'cancel' }` | On `HookConflictError`, `await getRun(error.conflictingRunId).cancel()`, then start again | The newest run replaces the running one. Don't set a retention: a retained token stays refused after the cancel. |
211
+ | `cancelOn` / cancel from the dashboard | [`run.cancel()`](/docs/foundations/cancellation), or an `AbortController` whose signal is passed into steps | `run.cancel({ cancelReason })` records why. `workflow cancel --status running --workflowName <id>` cancels in bulk. |
212
+ | `retries` / `RetryAfterError` / `NonRetriableError` | `stepFn.maxRetries`, `RetryableError`, `FatalError` | Retries live at the step boundary. For custom backoff via `retryAfter`, see [Errors & Retrying](/docs/foundations/errors-and-retries#customize-retry-behavior). |
213
+ | `step.fetch()` | [`fetch`](/docs/api-reference/workflow/fetch) from `workflow` | A step that makes the request. |
214
+ | `step.ai.wrap()` | A `"use step"` function that calls the model | Or [`WorkflowAgent`](/docs/ai) for an agent loop. |
215
+ | `runId` / `attempt` | `getWorkflowMetadata().workflowRunId` / `getStepMetadata().attempt - 1` | `getStepMetadata().attempt` counts from 1, where Inngest counted from 0, and it is only available inside a step. |
216
+ | `step.realtime.publish()` / Realtime | `getWritable()` / named streams | Clients read from the stream. |
217
+ | Event payload search | [`setAttributes()`](/docs/api-reference/workflow/set-attributes) or `start({ attributes })` | Filter runs by `key=value` in the CLI, the web UI, and Vercel Observability. |
218
+
219
+ ### What behaves differently
220
+
221
+ - **Step results keep their types.** Inngest serializes step results as JSON, so a `Date` came back as a string and a step that returned nothing came back as `null`. The Workflow SDK keeps `Date`, `Map`, `Set`, `URL`, typed arrays and the other [serializable types](/docs/foundations/serialization), and a step that returns nothing returns `undefined`. Code that parsed a string back into a `Date` keeps working; code that used the string directly needs a change.
222
+ - **Code outside steps runs in a sandbox.** An Inngest handler could call `fetch()` or a database outside `step.run()`, and the call ran again on every request. A workflow function runs deterministically, without Node.js APIs or I/O, so move that code into a step.
223
+ - **Step arguments are copies.** A step that changed a captured object in Inngest only changed it in the invocation that ran the step, and a memoized step does not run again. The same change is invisible to the workflow here, so return the new value instead.
224
+ - **The event shape is yours.** The workflow receives what you pass to `start()`. Fields Inngest filled in, such as `event.id` and `event.ts`, are only there if you pass them; use `getWorkflowMetadata()` for the run ID and start time.
225
+
226
+ ### One owner per token
227
+
228
+ Inngest delivers an event to every run waiting for it. A hook token has one owner at a time: while a run holds it, another `createHook()` with the same token rejects with [`HookConflictError`](/docs/api-reference/workflow-errors/hook-conflict-error). Three cases follow:
229
+
230
+ - **Two workflows waiting for the same event.** The codemod puts the workflow name in the token (`app/user.active:onboardUser:${userId}`), so each has its own. Where the event is sent, resume each of them; the report's Event routing table lists the tokens.
231
+ - **The same run waiting again.** The generated `waitForHook()` helper disposes the hook when the wait ends, so the next wait can create it again.
232
+ - **Two runs of the same workflow waiting for the same key at once.** This one needs a decision. Add something unique to the token, such as the run ID or the ID of the record the run handles, and resume each run from the sender. If only one run can wait per key, delete the TODO.
233
+
234
+ ### Verify the migration
92
235
 
93
- Each row is an Inngest capability the Workflow SDK does not replicate one-to-one, paired with how to cover it on the Workflow SDK side:
236
+ Before you switch traffic, run the same inputs through both versions and compare what each run returns:
94
237
 
95
- | Inngest feature | How to cover it with the Workflow SDK |
238
+ 1. Keep a copy of the Inngest app and run it against the Inngest dev server (`npx inngest-cli dev`).
239
+ 2. Build the migrated app and run it locally against the [Local World](/worlds/local).
240
+ 3. Give both apps the same entry points: one that sends an event, one that sends a signal, and one that reads a run's result. On the Inngest side, these call `inngest.send()`, `inngest.sendSignal()` and the dev server's API. On the Workflow side, they call `start()` and `resumeHook()` as the Event routing table says, and `getRun()`.
241
+ 4. For every function, send the events that drive each path (success, the fatal error, retries, a wait that is resumed, a wait that times out) and compare the outputs and final statuses.
242
+
243
+ Also typecheck and build the migrated app: the codemod's annotations are checked against your project, but your own types only meet the new code once you build.
244
+
245
+ ### Cut over
246
+
247
+ Runs started on Inngest keep running on Inngest. Move new work to the Workflow SDK, and keep the Inngest app deployed until its in-flight runs, sleeps and waits have drained:
248
+
249
+ 1. Deploy the migrated app next to the Inngest one, with the Inngest `serve()` route still in place.
250
+ 2. Point new events at `start()`. Senders that resume waits need both paths for a while: send the Inngest event for runs that started there, and call `resumeHook()` for runs that started on the Workflow SDK.
251
+ 3. Keep business-level idempotency across both: a duplicate request should not start a Workflow run for work an Inngest run already does. `start({ experimental_hook: { token } })` with the same business key you used for Inngest `idempotency` covers the Workflow side.
252
+ 4. Once no Inngest runs are left, delete the `serve()` route, the client and the `inngest` dependency. Keep protecting the endpoints that start or resume runs the way you protected the ones that sent events, and point dashboards and alerts at the Workflow SDK's [observability](/docs/observability).
253
+
254
+ ### Flow control, schedules and failure handling
255
+
256
+ Inngest configures these on the function, and its event bus applies them before a run starts. The Workflow SDK has no event bus between the sender and the run, so you build each one where it belongs. A [start token](/docs/foundations/idempotency#run-idempotency) on `start()` keeps duplicate or excess work from ever becoming a run. A hook, a `sleep()` or a step inside the run handles the rest:
257
+
258
+ | Inngest | With the Workflow SDK |
96
259
  | --- | --- |
97
- | Flow control (concurrency, throttling, debounce, rate limiting, batching, priority) | No direct function-level analog; enforce limits inside steps or debounce at the publisher before `start()` |
98
- | Cron / scheduled functions | Trigger from Vercel Cron or a system cron calling `start()` |
99
- | Event-bus fan-out by name match | Replace with explicit `start()` calls per target workflow |
260
+ | `rateLimit: { key, limit: 1, period }` | A start token per key, retained for the period. A second start before the period has passed throws `HookConflictError`; skip it. See [Rate limit](#rate-limit). |
261
+ | `debounce: { key, period }` | One run per key and window that waits out the window, then reads the current state in a step. See [Debounce](#debounce). |
262
+ | `batchEvents: { maxSize, timeout, key }` | The same shape as debounce: store each event where a step can read it, such as a table keyed by the batch key, start one run per window, and read the whole batch in a step once the window ends. |
263
+ | `concurrency: { key, limit: 1 }` where overlapping runs can be dropped | The `singleton: { mode: 'skip' }` row in [Concept mapping](#concept-mapping): a start token with no retention. |
264
+ | `concurrency` where runs wait their turn | Native per-key locks are in development (see the [concurrency controls discussion](https://github.com/vercel/workflow/discussions/301)). Until they ship, keep the lock you use today inside the steps that need it, and make those steps safe to repeat. |
265
+ | `throttle` | For a downstream API's limit, throw `RetryableError` with the provider's `retryAfter` from the step. See [Rate Limiting & Retries](/cookbook/common-patterns/rate-limiting). Native rate limiting inside runs is in development alongside locks. |
266
+ | `priority` | No equivalent. Runs start in the order `start()` is called. |
267
+ | Cron triggers | [Vercel Schedules](https://vercel.com/docs/schedules/workflows). A schedule publishes to a queue topic, and its consumer calls `start()` with the occurrence's `executionId` in the start token, retained for longer than redeliveries can arrive (for example `experimental_minRetention: '7 days'`), so a redelivered occurrence never starts a second run, even after the first has finished. Schedules take an IANA `timezone` and also run in Preview branches and custom environments. |
268
+ | Several functions triggered by one event | One `start()` per target workflow where the event is sent, each with its own start token, such as `` `${targetName}:${event.id}` ``, retained with `experimental_minRetention: '24h'`. A retried send within 24 hours then never starts a target twice, even one that has already finished, as with Inngest's 24-hour deduplication of events by `id`. Without the retention, the token is released when the target's run ends. |
269
+ | `onFailure` | [`registerLifecycleHooks({ onRunFailed })`](/docs/api-reference/workflow-api/register-lifecycle-hooks) reports failed runs from one place, for example to Slack or Sentry. It is best-effort. Where a workflow must compensate, also wrap its body in `try`/`catch`, call a cleanup step in `catch`, then rethrow. |
270
+
271
+ #### Rate limit
272
+
273
+ Inngest's `rateLimit` drops events once the limit for a key is reached in the period. A start token retained for the period does the same for `limit: 1`. The token stays taken until the period has passed since the accepted start, and for as long as that run is still running:
274
+
275
+ ```typescript lineNumbers
276
+ import { start } from "workflow/api";
277
+ import { HookConflictError } from "workflow/errors";
278
+ declare function syncAccount(accountId: string): Promise<void>; // @setup
279
+
280
+ // Inngest: rateLimit: { key: "event.data.accountId", limit: 1, period: "1m" }
281
+ export async function requestSync(accountId: string) {
282
+ try {
283
+ await start(syncAccount, [accountId], {
284
+ experimental_hook: {
285
+ token: `sync-account:${accountId}`,
286
+ experimental_minRetention: "1m", // [!code highlight]
287
+ },
288
+ });
289
+ return { started: true };
290
+ } catch (error) {
291
+ if (HookConflictError.is(error)) return { started: false }; // rate-limited
292
+ throw error;
293
+ }
294
+ }
295
+ ```
296
+
297
+ To limit by fixed windows instead, put the window number in the token, as in `` `sync-account:${accountId}:${Math.floor(Date.now() / 60_000)}` ``. For `limit: n`, try `n` tokens per window (`:0` to `:n-1`) and skip when all of them are taken.
298
+
299
+ #### Debounce
300
+
301
+ Inngest's `debounce` runs once, with the last event, after events for a key stop arriving for the period. When the run can read the current state itself, one run per key and window gives the same result with the fewest runs and events. The first event in a window starts the run, and every later event in that window is refused at `start()`, so it never becomes a run:
302
+
303
+ ```typescript title="lib/pack-changed.ts" lineNumbers
304
+ import { start } from "workflow/api";
305
+ import { HookConflictError } from "workflow/errors";
306
+ import { refreshPack } from "@/workflows/refresh-pack";
307
+
308
+ const WINDOW_MS = 3 * 60_000; // Inngest: debounce: { key: "event.data.packId", period: "3m" }
309
+
310
+ // Call after writing the change to the database.
311
+ export async function packChanged(packId: string) {
312
+ const windowEnd = (Math.floor(Date.now() / WINDOW_MS) + 1) * WINDOW_MS;
313
+ try {
314
+ await start(refreshPack, [packId, windowEnd], {
315
+ experimental_hook: { token: `refresh-pack:${packId}:${windowEnd}` }, // [!code highlight]
316
+ });
317
+ } catch (error) {
318
+ if (!HookConflictError.is(error)) throw error; // this window already has a run
319
+ }
320
+ }
321
+ ```
322
+
323
+ ```typescript title="workflows/refresh-pack.ts" lineNumbers
324
+ import { sleep } from "workflow";
325
+ declare function loadAndPublishPack(packId: string): Promise<void>; // @setup
326
+
327
+ export async function refreshPack(packId: string, windowEnd: number) {
328
+ "use workflow";
329
+
330
+ await sleep(new Date(windowEnd + 10_000)); // the window, plus a margin for late starts
331
+ await refreshFromDatabase(packId);
332
+ }
333
+
334
+ async function refreshFromDatabase(packId: string) {
335
+ "use step";
336
+ await loadAndPublishPack(packId); // reads the pack's current state
337
+ }
338
+ ```
339
+
340
+ An event that is refused wrote its change before it picked its window, so before that window ended. The run reads the database only after the window and the margin, so it sees every change in its window. If the run has already finished, the token is free again and the late event starts a new run, which reads the change too. The difference from Inngest is the timing: a key that keeps receiving events runs once per window instead of waiting for a quiet period, so set the window to the longest delay you can accept.
341
+
342
+ When the run needs the events themselves rather than the current state, store each event before calling `start()`, as for `batchEvents`, and read the window's events in the step.
100
343
 
101
344
  ---
102
345
  *Compiled from public documentation. Inngest tier names and pricing vary across sources; verify against [inngest.com/pricing](https://www.inngest.com/pricing). Not based on head-to-head benchmarks.*
@@ -29,7 +29,7 @@ related:
29
29
  | **Versioning** | Runs pinned to their immutable deployment, safe by default; opt-in `deploymentId: 'latest'` to upgrade | Editing workflow code can break in-flight runs (non-determinism errors); evolve safely via patch APIs or Worker Versioning (keep old worker fleets draining) |
30
30
  | **AI SDK & agents** | `WorkflowAgent` ships in the AI SDK; durable agent loop; **native resumable streaming** (`getWritable`/`getReadable`, `WorkflowChatTransport`) | First-party `@temporalio/ai-sdk` and "Workflow Streams", both **Public Preview**; streaming rides on Signals/Updates (batched, history-bound) |
31
31
  | **Security** | Zero-config per-run AES-256-GCM E2E encryption by default; platform security is per World (the Vercel World inherits Vercel's security posture) | Workers run your code on your infrastructure (never enters Temporal's plane); client-side E2E via a Codec Server you operate. Cloud: SOC 2 II, HIPAA, GDPR |
32
- | **Performance** | No-penalty resume; serverless scale-to-zero (true suspension); up to 100,000 concurrency on Vercel | Self-managed workers are long-running; Cloud namespace default 500 actions/sec (auto-scales) |
32
+ | **Performance** | No-penalty resume; several steps execute inline per invocation, and the queue is used only for waits, hooks, or a function nearing its timeout; serverless scale-to-zero (true suspension); up to 100,000 concurrency on Vercel | Self-managed workers are long-running; Cloud namespace default 500 actions/sec (auto-scales) |
33
33
  | **Portability** | Apache-2.0 SDK; World abstraction swaps storage/queue/streams independently | MIT server; pluggable persistence (Cassandra/Postgres/MySQL), but an opinionated monolithic backend you run or pay for |
34
34
  | **Pricing** | SDK free; pay your platform (Vercel: events + data) or only your infrastructure if self-hosted | Self-host = free software; Temporal Cloud bills per Action (from $50 per million) + storage |
35
35
  | **Limits** | No run/sleep cap; 10,000 steps, 50 MB payload, 2 GB/run ([Vercel World limits](https://vercel.com/docs/workflows/pricing)) | No run cap (Continue-As-New for long histories); event history capped at 51,200 events / 50 MB; 2 MB payloads |
@@ -66,9 +66,13 @@ The model maps closely. Keep your orchestration logic; drop the workers, task qu
66
66
  | Worker + Task Queue | Managed execution | No worker fleet or polling loop to operate. |
67
67
  | Signal | `createHook()` / `createWebhook()` | Hooks for typed resume signals; webhooks for HTTP callbacks. |
68
68
  | Query | `getWritable({ namespace: 'status' })` stream | Stream status durably; clients read the stream instead of polling. |
69
- | Child Workflow | Call [`start()`](/docs/foundations/starting-workflows) directly from the workflow | Child runs are tagged with `$parentRunId` / `$rootRunId` automatically. |
69
+ | Child Workflow | Call [`start()`](/docs/foundations/starting-workflows) directly from the workflow | `await run.returnValue` suspends without polling. Child runs are tagged with `$parentRunId` / `$rootRunId` automatically. |
70
+ | `continueAsNew()` | `start()` the same workflow from inside the workflow, then return | Pass `deploymentId: 'latest'` to move onto new code. See [Self upgrading workflows](/docs/foundations/versioning#self-upgrading-workflows). |
71
+ | Workflow ID + reuse / conflict policy | `start(workflow, args, { experimental_hook: { token } })` | A duplicate start throws `HookConflictError` naming the owner. `experimental_minRetention` keeps refusing after the run ends. See [Run idempotency](/docs/foundations/idempotency#run-idempotency). |
72
+ | Cancellation scopes / `handle.cancel()` | `AbortController` passed into steps; `run.cancel({ cancelReason })` | An abort reaches a step that is already running. See [Cancellation](/docs/foundations/cancellation). |
70
73
  | Activity retry policy | `maxRetries`, `RetryableError`, `FatalError` | Retries live at the step boundary. See [Errors & Retrying](/docs/foundations/errors-and-retries). |
71
74
  | Search attributes / visibility queries | [`setAttributes()`](/docs/api-reference/workflow/set-attributes) / `attributes` option on `start()` | Filter runs by `key=value`. See [Attributes](/docs/observability/attributes). |
75
+ | Memo | Workflow arguments, the return value, or a [stream](/docs/foundations/streaming) | Attributes are searchable plaintext strings (up to 256 bytes each, 64 per run), not a place for arbitrary data. Promote only the small labels you filter by. |
72
76
  | Event History | Workflow event log / run timeline | Same durable replay; built-in observability UI. |
73
77
 
74
78
  A minimal translation, where the orchestrator loses `proxyActivities` and becomes plain TypeScript:
@@ -58,6 +58,8 @@ trigger.dev offers AI SDK tool wrapping, a native `useChat` transport over its R
58
58
  | `wait.forToken({ timeout })` | `createHook()` + `Promise.race` with `sleep()` | Hooks carry a typed token. |
59
59
  | `triggerAndWait()` | [`start()`](/docs/foundations/starting-workflows) called directly from the workflow, then await the returned `Run` | Spawn + collect. |
60
60
  | `batch.triggerAndWait()` | `Promise.all` over collected `Run` handles | Standard concurrency. |
61
+ | `idempotencyKey` / `idempotencyKeyTTL` | `start(workflow, args, { experimental_hook: { token, experimental_minRetention } })` | A duplicate start throws `HookConflictError` naming the owner. See [Run idempotency](/docs/foundations/idempotency#run-idempotency). |
62
+ | `runs.cancel()` / task `signal` | `run.cancel({ cancelReason })`; `AbortController` passed into steps | An abort reaches a step that is already running. See [Cancellation](/docs/foundations/cancellation). |
61
63
  | `metadata.stream()` / Realtime | `getWritable()` / named streams | Clients read from the stream. |
62
64
  | Run tags / `metadata.set()` | [`setAttributes()`](/docs/api-reference/workflow/set-attributes) / `attributes` option on `start()` | Filter runs by `key=value`. See [Attributes](/docs/observability/attributes). |
63
65
  | `AbortTaskRunError` | `FatalError` | Stops retries immediately. |
@@ -2,7 +2,7 @@
2
2
  title: CLI and Web UI
3
3
  description: CLI flags and environment variables for inspecting local, Postgres, and Vercel Workflow runs.
4
4
  type: reference
5
- summary: Configure workflow inspect, workflow cancel, workflow web, workflow health, and observability tooling.
5
+ summary: Configure workflow inspect, workflow cancel, workflow web, workflow health, workflow migrate, and observability tooling.
6
6
  related:
7
7
  - /docs/observability
8
8
  - /docs/configuration/worlds
@@ -214,6 +214,36 @@ per flag.
214
214
  - Default: disabled
215
215
  - Skips the interactive confirmation prompt.
216
216
 
217
+ ## Migrate from Inngest
218
+
219
+ `workflow migrate inngest [paths...]` rewrites Inngest functions as Workflow SDK code in place: each `createFunction()` becomes a `"use workflow"` function, and each `step.run()` closure becomes a `"use step"` function whose parameters are the variables the closure captured. It prints every step it lifted with its captured variables, and marks what needs a decision with `TODO(workflow-migrate)` comments. See [Migrating from Inngest](/docs/comparisons/workflow-sdk-vs-inngest#run-the-codemod) for what it changes.
220
+
221
+ Without paths, it migrates the files of the project's `tsconfig.json` (its `include` and `exclude`), plus JavaScript files outside `node_modules` and the build output directories. It parses them with the project's own `typescript` package, so install it as a dev dependency first, or run `npx -p typescript -p workflow workflow migrate inngest`. It refuses to overwrite files with uncommitted changes, and leaves a file unchanged if its migrated code does not parse.
222
+
223
+ ### `--dry-run`
224
+
225
+ - Command: `workflow migrate`
226
+ - Default: disabled
227
+ - Prints what would change without writing any files.
228
+
229
+ ### `--report`
230
+
231
+ - Command: `workflow migrate`
232
+ - Default: unset
233
+ - Writes a Markdown report to this file: each lifted step with its captured variables, each TODO, and every `inngest.send()` and `serve()` call in the project with the `start()` or `resumeHook()` call that replaces it.
234
+
235
+ ### `--tsconfig`
236
+
237
+ - Command: `workflow migrate`
238
+ - Default: the nearest `tsconfig.json`
239
+ - The tsconfig to read the files and compiler options from.
240
+
241
+ ### `--force`
242
+
243
+ - Command: `workflow migrate`
244
+ - Default: disabled
245
+ - Writes files even if they have uncommitted changes.
246
+
217
247
  ## Health checks
218
248
 
219
249
  ### `--port` / `-p`
@@ -190,9 +190,10 @@ For example, a workflow can run a 10-minute inline step even with `WORKFLOW_REPL
190
190
  - Default: `node`
191
191
  - Values: `node` or `quickjs`
192
192
  - Selects the sandboxed VM engine that executes workflow functions (`"use workflow"`). Step functions are unaffected and always run with full Node.js access.
193
- - `node` (default) runs workflow code in a [`node:vm`](https://nodejs.org/api/vm.html) context.
194
- - `quickjs` (experimental) runs workflow code in a [QuickJS](https://github.com/quickjs-ng/quickjs) VM compiled to WebAssembly (via [`quickjs-wasi`](https://github.com/vercel-labs/quickjs-wasi)). Both engines implement the same event-replay execution model (seeded PRNG, deterministic clock, and correlation-ID sequences are identical), but the **global surface is not identical**. Review the differences below before switching an existing deployment. The QuickJS engine is intended for platforms that do not implement `node:vm`, and supports VM-memory snapshotting (see [`WORKFLOW_SNAPSHOT_THRESHOLD`](#workflow_snapshot_threshold)).
195
- - Global-surface differences under `quickjs` apply to workflow functions only. Step functions always have full Node.js:
193
+ - `node` (default) runs workflow code in a [`node:vm`](https://nodejs.org/api/vm.html) context. Every resume replays the run's full event log, so resume cost grows with the log, and runs are subject to the World's default [per-run event limit](/docs/errors/max-events-exceeded).
194
+ - `quickjs` runs workflow code in a [QuickJS](https://github.com/quickjs-ng/quickjs) VM compiled to WebAssembly (via [`quickjs-wasi`](https://github.com/vercel-labs/quickjs-wasi)). **Use it for long-running workflows**: agents, chat sessions, and loops that wait on hooks or sleeps, or any run with many steps. With snapshotting (on by default for encrypted runs, see [`WORKFLOW_SNAPSHOT_THRESHOLD`](#workflow_snapshot_threshold); on world-local and world-postgres also set [`WORKFLOW_SNAPSHOT_ALLOW_UNENCRYPTED`](#workflow_snapshot_allow_unencrypted)), a run resumes from a VM-memory snapshot and replays only the events recorded since, so resume cost stays roughly flat as the log grows, and the run is exempt from the default per-run event limit on the Local and Vercel Worlds. It also runs on platforms that do not implement `node:vm`.
195
+ - Both engines implement the same event-replay execution model (seeded PRNG, deterministic clock, and correlation-ID sequences are identical), so workflow code that sticks to plain JavaScript and the Workflow APIs runs unchanged. To switch, set `WORKFLOW_VM=quickjs` in the environment that starts runs, and runs started after that use QuickJS. The few globals QuickJS does not provide in workflow functions are listed below.
196
+ - Global-surface differences under `quickjs` apply to workflow functions only. Step functions always have full Node.js, so the fix for each is to move that call into a step:
196
197
  - `crypto.getRandomValues()` and `crypto.randomUUID()` are provided and deterministic (seeded like the node engine's). All `crypto.subtle.*` methods, including `digest`, throw with guidance to move to a step function. The node engine supports `digest`.
197
198
  - `Intl` is not available (QuickJS has no ICU). The `Intl.*` constructors throw, and `toLocaleString`-family methods (including `localeCompare`) throw when called **with an explicit locale**. Calling them without arguments keeps the engine default. Perform locale-sensitive formatting in a step function.
198
199
  - `WebAssembly` and `Atomics` are not available.
@@ -212,7 +213,7 @@ For example, a workflow can run a 10-minute inline step even with `WORKFLOW_REPL
212
213
 
213
214
  - Default: `1000` when the QuickJS engine is selected
214
215
  - Values: non-negative integer. `0` disables snapshotting.
215
- - Experimental. Only used by the QuickJS engine (`WORKFLOW_VM=quickjs`), and only with a World that provides snapshot storage (world-local, world-postgres, and world-vercel do).
216
+ - Only used by the QuickJS engine (`WORKFLOW_VM=quickjs`), and only with a World that provides snapshot storage (world-local, world-postgres, and world-vercel do).
216
217
  - When above `0`, the runtime persists a **VM-memory snapshot** at a suspension once at least this many events have been processed since the last snapshot. Subsequent invocations restore the VM from the snapshot and replay only the events recorded since, instead of re-executing the workflow from the top against the full event log.
217
218
  - Short-lived runs below the threshold never pay the snapshot cost; long-running or unbounded runs stop scaling their resume cost with total event-log length. `1` snapshots at every qualifying suspension.
218
219
  - Choosing a value: a restore costs roughly the same regardless of log length (tens of milliseconds to decompress and restore the heap, plus fetching the snapshot), while a full replay grows with the log (tens of milliseconds at a few hundred events, seconds at several thousand). Restoring starts to pay off at a few hundred events, so values in the hundreds suit most long-running workflows. Very low values mostly add snapshot saves to runs that replay quickly anyway.
@@ -289,9 +290,9 @@ Node's own modules do less than the client they replace, so enabling this drops
289
290
  - Requests lose their transport-level retry. Failures still surface to the layers above, which retry event writes and redeliver queue messages, so nothing is silently dropped, but a failure that a same-connection retry would have hidden now costs a full redelivery.
290
291
  - Stream close loses its retry of retriable server errors. A transient failure at close can leave a stream marked closing until the run expires, where it would previously have resolved on the retry.
291
292
 
292
- Connection pooling, keep-alive, and the request, header, and body deadlines are preserved. Node's agents configure pooling and keep-alive, and each request receives the deadlines from the Local World's two queue timeouts or the same defaults that the Vercel World's HTTP client currently applies. Queue sends are the partial exception: that client takes no transport override, so it cannot move to Node's modules. It does honor this variable, by dispatching through the runtime's own copy of the library rather than the copy the World bundles, which is the distinction that matters when the bundled copy is the thing that does not work.
293
+ Connection pooling, keep-alive, and the request, header, and body deadlines are preserved. Node's agents configure pooling and keep-alive, and each request receives the deadlines from the Local World's two queue timeouts or the same defaults that the Vercel World's HTTP client currently applies. Queue sends are the partial exception: that client takes no transport override, so it cannot move to Node's modules. It does honor this variable, by dispatching through the runtime's own copy of the library rather than the copy the World bundles, which is the distinction that matters when the bundled copy is the thing that does not work. That copy's global agent has no connection cap and only undici's default 300-second timeouts, so queue sends lose the queue client's own cap and deadline (30 seconds by default): [`WORKFLOW_VERCEL_QUEUE_CONNECTIONS`](/docs/configuration/worlds#workflow_vercel_queue_connections) and [`WORKFLOW_VERCEL_QUEUE_TIMEOUT_MS`](/docs/configuration/worlds#workflow_vercel_queue_timeout_ms) do not apply.
293
294
 
294
- A `dispatcher` passed to `createVercelWorld()` still wins over this variable. The variable chooses which transport the World builds when you have not supplied one.
295
+ A `dispatcher` passed to `createWorld()` still wins over this variable. The variable chooses which transport the World builds when you have not supplied one.
295
296
 
296
297
  ## Queue namespace
297
298
 
@@ -381,14 +382,14 @@ These variables are primarily for tests, debugging, or unusual deployments.
381
382
 
382
383
  ## Spec 9 (experimental)
383
384
 
384
- Everything above describes spec 8 runs, the default. The experimental spec 9 runtime is opt-in with `WORKFLOW_SPEC_VERSION=9`, reads some of the settings above differently, and adds the settings below. See [Settings and behaviour on spec 9 runs](/docs/changelog/spec-9#settings-and-behaviour-on-spec-9-runs) for each one in full.
385
+ Everything above describes spec 8 runs, the default. The experimental spec 9 runtime is opt-in with `WORKFLOW_SPEC_VERSION=9`, reads some of the settings above differently, and adds the settings below.
385
386
 
386
387
  ### `WORKFLOW_SPEC_VERSION`
387
388
 
388
389
  - Default: unset. New runs use spec version 8.
389
390
  - `9` creates spec 9 runs on a World that declares the in-band fence (the Vercel, Local and Postgres Worlds do). `6` to `8` select that version. A run keeps the version it was created with.
390
391
  - `6` creates new runs on the scheme from before the [sealed log](/docs/how-it-works/event-sourcing), where each event position is allocated by the write that occupies it. Use it in an environment shared with a runtime that cannot read sealed logs yet, such as one that pins its own accepted spec range (the Python runtime). Runs below `8` cannot have their hook tokens taken over with [`experimental_force`](/docs/api-reference/workflow/create-hook#take-over-a-token-another-run-holds): a forced hook in another run gets `HookConflictError` instead.
391
- - Upgrade every deployment and process that shares the World before setting it, and do not roll back below this release once spec 9 runs exist. See [Opting in](/docs/changelog/spec-9#opting-in).
392
+ - Upgrade every deployment and process that shares the World before setting it, and do not roll back below this release once spec 9 runs exist.
392
393
 
393
394
  ### `WORKFLOW_ORCHESTRATOR_POLL_INTERVAL_MS`
394
395