workflow 5.0.0-beta.5 → 5.0.0-beta.51

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 (256) hide show
  1. package/README.md +68 -23
  2. package/dist/api-workflow.d.ts +1 -1
  3. package/dist/api-workflow.d.ts.map +1 -1
  4. package/dist/api-workflow.js +1 -1
  5. package/dist/api.d.ts +3 -3
  6. package/dist/api.d.ts.map +1 -1
  7. package/dist/api.js +5 -7
  8. package/dist/index.d.ts +1 -0
  9. package/dist/index.d.ts.map +1 -1
  10. package/dist/index.js +6 -1
  11. package/dist/internal/builtins.d.ts +20 -3
  12. package/dist/internal/builtins.d.ts.map +1 -1
  13. package/dist/internal/builtins.js +68 -4
  14. package/dist/internal/errors.d.ts +1 -1
  15. package/dist/internal/errors.d.ts.map +1 -1
  16. package/dist/internal/errors.js +2 -2
  17. package/dist/nest-builder.d.ts +2 -0
  18. package/dist/nest-builder.d.ts.map +1 -0
  19. package/dist/nest-builder.js +2 -0
  20. package/dist/nest-vercel-builder.d.ts +2 -0
  21. package/dist/nest-vercel-builder.d.ts.map +1 -0
  22. package/dist/nest-vercel-builder.js +2 -0
  23. package/dist/observability.d.ts +1 -1
  24. package/dist/observability.js +2 -2
  25. package/dist/runtime.d.ts +2 -1
  26. package/dist/runtime.d.ts.map +1 -1
  27. package/dist/runtime.js +4 -1
  28. package/docs/ai/chat-session-modeling.mdx +176 -422
  29. package/docs/ai/defining-tools.mdx +6 -7
  30. package/docs/ai/human-in-the-loop.mdx +11 -11
  31. package/docs/ai/index.mdx +71 -75
  32. package/docs/ai/message-queueing.mdx +71 -110
  33. package/docs/ai/meta.json +1 -0
  34. package/docs/ai/resumable-streams.mdx +40 -28
  35. package/docs/ai/sleep-and-delays.mdx +10 -10
  36. package/docs/ai/streaming-updates-from-tools.mdx +6 -6
  37. package/docs/api-reference/index.mdx +25 -1
  38. package/docs/api-reference/meta.json +8 -0
  39. package/docs/api-reference/vitest/index.mdx +9 -15
  40. package/docs/api-reference/workflow/create-hook.mdx +89 -10
  41. package/docs/api-reference/workflow/create-webhook.mdx +16 -15
  42. package/docs/api-reference/workflow/define-hook.mdx +35 -33
  43. package/docs/api-reference/workflow/fatal-error.mdx +30 -8
  44. package/docs/api-reference/workflow/fetch.mdx +14 -10
  45. package/docs/api-reference/workflow/get-step-metadata.mdx +2 -2
  46. package/docs/api-reference/workflow/get-workflow-metadata.mdx +3 -3
  47. package/docs/api-reference/workflow/get-writable.mdx +7 -7
  48. package/docs/api-reference/workflow/index.mdx +4 -1
  49. package/docs/api-reference/workflow/retryable-error.mdx +1 -1
  50. package/docs/api-reference/workflow/set-attributes.mdx +61 -0
  51. package/docs/api-reference/workflow/sleep.mdx +4 -4
  52. package/docs/api-reference/workflow-ai/durable-agent.mdx +63 -101
  53. package/docs/api-reference/workflow-ai/index.mdx +5 -5
  54. package/docs/api-reference/workflow-ai/workflow-chat-transport.mdx +67 -24
  55. package/docs/api-reference/workflow-api/get-hook-by-token.mdx +26 -12
  56. package/docs/api-reference/workflow-api/get-run.mdx +43 -8
  57. package/docs/api-reference/workflow-api/index.mdx +6 -10
  58. package/docs/api-reference/workflow-api/resume-hook.mdx +73 -12
  59. package/docs/api-reference/workflow-api/resume-webhook.mdx +11 -9
  60. package/docs/api-reference/workflow-api/start.mdx +60 -13
  61. package/docs/api-reference/workflow-astro/index.mdx +18 -0
  62. package/docs/api-reference/workflow-astro/meta.json +4 -0
  63. package/docs/api-reference/workflow-astro/workflow.mdx +45 -0
  64. package/docs/api-reference/workflow-errors/entity-conflict-error.mdx +4 -4
  65. package/docs/api-reference/workflow-errors/hook-conflict-error.mdx +60 -0
  66. package/docs/api-reference/workflow-errors/hook-not-found-error.mdx +8 -8
  67. package/docs/api-reference/workflow-errors/index.mdx +88 -0
  68. package/docs/api-reference/workflow-errors/meta.json +6 -0
  69. package/docs/api-reference/workflow-errors/precondition-failed-error.mdx +68 -0
  70. package/docs/api-reference/workflow-errors/run-expired-error.mdx +2 -2
  71. package/docs/api-reference/workflow-errors/run-not-supported-error.mdx +58 -0
  72. package/docs/api-reference/workflow-errors/step-not-registered-error.mdx +5 -5
  73. package/docs/api-reference/workflow-errors/throttle-error.mdx +2 -2
  74. package/docs/api-reference/workflow-errors/too-early-error.mdx +2 -2
  75. package/docs/api-reference/workflow-errors/workflow-error.mdx +52 -0
  76. package/docs/api-reference/workflow-errors/workflow-not-registered-error.mdx +5 -6
  77. package/docs/api-reference/workflow-errors/workflow-run-cancelled-error.mdx +6 -6
  78. package/docs/api-reference/workflow-errors/workflow-run-failed-error.mdx +5 -5
  79. package/docs/api-reference/workflow-errors/workflow-run-not-completed-error.mdx +58 -0
  80. package/docs/api-reference/workflow-errors/workflow-run-not-found-error.mdx +4 -4
  81. package/docs/api-reference/workflow-errors/workflow-runtime-error.mdx +58 -0
  82. package/docs/api-reference/workflow-errors/workflow-world-error.mdx +8 -8
  83. package/docs/api-reference/workflow-globals.mdx +14 -10
  84. package/docs/api-reference/workflow-nest/configure-workflow-controller.mdx +33 -0
  85. package/docs/api-reference/workflow-nest/index.mdx +31 -0
  86. package/docs/api-reference/workflow-nest/meta.json +9 -0
  87. package/docs/api-reference/workflow-nest/nest-local-builder.mdx +64 -0
  88. package/docs/api-reference/workflow-nest/workflow-controller.mdx +40 -0
  89. package/docs/api-reference/workflow-nest/workflow-module.mdx +74 -0
  90. package/docs/api-reference/workflow-next/with-workflow.mdx +39 -17
  91. package/docs/api-reference/workflow-nitro/index.mdx +60 -0
  92. package/docs/api-reference/workflow-nuxt/index.mdx +48 -0
  93. package/docs/api-reference/workflow-observability/hydrate-data.mdx +35 -0
  94. package/docs/api-reference/workflow-observability/hydrate-resource-io.mdx +62 -0
  95. package/docs/api-reference/workflow-observability/index.mdx +62 -0
  96. package/docs/api-reference/workflow-observability/meta.json +11 -0
  97. package/docs/api-reference/workflow-observability/observability-revivers.mdx +50 -0
  98. package/docs/api-reference/workflow-observability/parse-class-name.mdx +41 -0
  99. package/docs/api-reference/workflow-observability/parse-step-name.mdx +40 -0
  100. package/docs/api-reference/workflow-observability/parse-workflow-name.mdx +55 -0
  101. package/docs/api-reference/workflow-runtime/create-world.mdx +39 -0
  102. package/docs/api-reference/workflow-runtime/get-world-handlers.mdx +44 -0
  103. package/docs/api-reference/{workflow-api → workflow-runtime}/get-world.mdx +11 -14
  104. package/docs/api-reference/workflow-runtime/health-check.mdx +50 -0
  105. package/docs/api-reference/workflow-runtime/index.mdx +41 -0
  106. package/docs/api-reference/workflow-runtime/meta.json +12 -0
  107. package/docs/api-reference/workflow-runtime/set-world.mdx +51 -0
  108. package/docs/api-reference/workflow-runtime/workflow-entrypoint.mdx +43 -0
  109. package/docs/api-reference/workflow-runtime/world/analytics.mdx +315 -0
  110. package/docs/api-reference/workflow-runtime/world/index.mdx +60 -0
  111. package/docs/api-reference/workflow-runtime/world/meta.json +4 -0
  112. package/docs/api-reference/workflow-runtime/world/queue.mdx +88 -0
  113. package/docs/api-reference/{workflow-api → workflow-runtime}/world/storage.mdx +98 -34
  114. package/docs/api-reference/{workflow-api → workflow-runtime}/world/streams.mdx +8 -8
  115. package/docs/api-reference/workflow-serde/index.mdx +1 -2
  116. package/docs/api-reference/workflow-serde/workflow-deserialize.mdx +3 -4
  117. package/docs/api-reference/workflow-serde/workflow-serialize.mdx +8 -8
  118. package/docs/api-reference/workflow-sveltekit/index.mdx +18 -0
  119. package/docs/api-reference/workflow-sveltekit/meta.json +4 -0
  120. package/docs/api-reference/workflow-sveltekit/workflow-plugin.mdx +42 -0
  121. package/docs/api-reference/workflow-vite/index.mdx +18 -0
  122. package/docs/api-reference/workflow-vite/meta.json +4 -0
  123. package/docs/api-reference/workflow-vite/workflow.mdx +48 -0
  124. package/docs/changelog/attributes-mvp.mdx +380 -0
  125. package/docs/changelog/batched-event-writes.mdx +79 -0
  126. package/docs/changelog/eager-processing.mdx +110 -436
  127. package/docs/changelog/index.mdx +4 -2
  128. package/docs/changelog/lazy-event-creation.md +127 -0
  129. package/docs/changelog/lazy-hook-resume.mdx +78 -0
  130. package/docs/changelog/meta.json +11 -1
  131. package/docs/changelog/resilient-resume.mdx +32 -0
  132. package/docs/changelog/resilient-start.mdx +33 -285
  133. package/docs/changelog/step-message-ownership.mdx +360 -0
  134. package/docs/changelog/turbo-mode.md +87 -0
  135. package/docs/comparisons/index.mdx +66 -0
  136. package/docs/comparisons/meta.json +11 -0
  137. package/docs/comparisons/workflow-sdk-vs-aws-agentcore.mdx +55 -0
  138. package/docs/comparisons/workflow-sdk-vs-aws-step-functions.mdx +111 -0
  139. package/docs/comparisons/workflow-sdk-vs-cloudflare-workflows.mdx +71 -0
  140. package/docs/comparisons/workflow-sdk-vs-inngest.mdx +102 -0
  141. package/docs/comparisons/workflow-sdk-vs-temporal.mdx +123 -0
  142. package/docs/comparisons/workflow-sdk-vs-trigger-dev.mdx +104 -0
  143. package/docs/configuration/build-and-diagnostics.mdx +70 -0
  144. package/docs/configuration/cli-and-web-ui.mdx +241 -0
  145. package/docs/configuration/framework-options.mdx +165 -0
  146. package/docs/configuration/index.mdx +32 -0
  147. package/docs/configuration/meta.json +12 -0
  148. package/docs/configuration/runtime-tuning.mdx +381 -0
  149. package/docs/configuration/worlds.mdx +313 -0
  150. package/docs/cookbook/advanced/child-workflows.mdx +211 -264
  151. package/docs/cookbook/advanced/meta.json +6 -1
  152. package/docs/cookbook/advanced/publishing-libraries.mdx +65 -56
  153. package/docs/cookbook/advanced/serializable-steps.mdx +48 -68
  154. package/docs/cookbook/advanced/upgrading-workflows.mdx +199 -0
  155. package/docs/cookbook/agent-patterns/agent-cancellation.mdx +78 -60
  156. package/docs/cookbook/agent-patterns/durable-agent.mdx +23 -131
  157. package/docs/cookbook/agent-patterns/human-in-the-loop.mdx +180 -195
  158. package/docs/cookbook/common-patterns/batching.mdx +18 -14
  159. package/docs/cookbook/common-patterns/idempotency.mdx +41 -53
  160. package/docs/cookbook/common-patterns/rate-limiting.mdx +8 -4
  161. package/docs/cookbook/common-patterns/saga.mdx +23 -19
  162. package/docs/cookbook/common-patterns/scheduling.mdx +34 -22
  163. package/docs/cookbook/common-patterns/sequential-and-parallel.mdx +29 -25
  164. package/docs/cookbook/common-patterns/timeouts.mdx +26 -21
  165. package/docs/cookbook/common-patterns/webhooks.mdx +10 -6
  166. package/docs/cookbook/common-patterns/workflow-composition.mdx +30 -27
  167. package/docs/cookbook/index.mdx +22 -21
  168. package/docs/cookbook/integrations/ai-sdk.mdx +86 -48
  169. package/docs/cookbook/integrations/chat-sdk.mdx +50 -33
  170. package/docs/cookbook/integrations/sandbox.mdx +62 -45
  171. package/docs/deploying.mdx +95 -0
  172. package/docs/errors/abort-signal-timeout-in-workflow.mdx +16 -12
  173. package/docs/errors/corrupted-event-log.mdx +39 -18
  174. package/docs/errors/deployment-mismatch.mdx +71 -0
  175. package/docs/errors/fetch-in-workflow.mdx +15 -14
  176. package/docs/errors/hook-conflict.mdx +69 -13
  177. package/docs/errors/index.mdx +2 -36
  178. package/docs/errors/node-js-module-in-workflow.mdx +9 -5
  179. package/docs/errors/replay-divergence.mdx +27 -0
  180. package/docs/errors/run-expired.mdx +85 -0
  181. package/docs/errors/runtime-decryption-failed.mdx +77 -0
  182. package/docs/errors/serialization-failed.mdx +44 -12
  183. package/docs/errors/start-invalid-workflow-function.mdx +9 -5
  184. package/docs/errors/step-executed-multiple-times.mdx +23 -0
  185. package/docs/errors/step-not-registered.mdx +6 -6
  186. package/docs/errors/timeout-in-workflow.mdx +12 -8
  187. package/docs/errors/webhook-invalid-respond-with-value.mdx +18 -18
  188. package/docs/errors/webhook-response-not-sent.mdx +20 -16
  189. package/docs/errors/workflow-not-registered.mdx +5 -5
  190. package/docs/foundations/cancellation.mdx +31 -32
  191. package/docs/foundations/errors-and-retries.mdx +42 -11
  192. package/docs/foundations/hooks.mdx +64 -35
  193. package/docs/foundations/idempotency.mdx +244 -12
  194. package/docs/foundations/index.mdx +1 -23
  195. package/docs/foundations/meta.json +2 -1
  196. package/docs/foundations/serialization.mdx +21 -22
  197. package/docs/foundations/starting-workflows.mdx +106 -30
  198. package/docs/foundations/streaming.mdx +108 -60
  199. package/docs/foundations/versioning.mdx +263 -0
  200. package/docs/foundations/workflows-and-steps.mdx +9 -9
  201. package/docs/getting-started/astro.mdx +22 -18
  202. package/docs/getting-started/express.mdx +15 -11
  203. package/docs/getting-started/fastify.mdx +15 -11
  204. package/docs/getting-started/hono.mdx +15 -11
  205. package/docs/getting-started/index.mdx +10 -3
  206. package/docs/getting-started/meta.json +3 -1
  207. package/docs/getting-started/nestjs.mdx +87 -20
  208. package/docs/getting-started/next.mdx +22 -16
  209. package/docs/getting-started/nitro.mdx +22 -18
  210. package/docs/getting-started/nuxt.mdx +15 -11
  211. package/docs/getting-started/python.mdx +190 -41
  212. package/docs/getting-started/react-router/index.mdx +33 -0
  213. package/docs/getting-started/react-router/meta.json +5 -0
  214. package/docs/getting-started/react-router/v7.mdx +237 -0
  215. package/docs/getting-started/react-router/v8.mdx +232 -0
  216. package/docs/getting-started/sveltekit.mdx +20 -16
  217. package/docs/getting-started/tanstack-start.mdx +17 -13
  218. package/docs/getting-started/vite.mdx +15 -11
  219. package/docs/how-it-works/cancellation.mdx +63 -63
  220. package/docs/how-it-works/code-transform.mdx +83 -67
  221. package/docs/how-it-works/encryption.mdx +30 -26
  222. package/docs/how-it-works/event-sourcing.mdx +125 -34
  223. package/docs/how-it-works/framework-integrations.mdx +96 -337
  224. package/docs/how-it-works/understanding-directives.mdx +22 -22
  225. package/docs/internal/index.mdx +6 -4
  226. package/docs/internal/meta.json +6 -1
  227. package/docs/internal/nitro-native-build.mdx +38 -0
  228. package/docs/internal/nitro-web-ui.mdx +24 -0
  229. package/docs/internal/serializable-abort-controller.mdx +7 -7
  230. package/docs/meta.json +3 -2
  231. package/docs/observability/attributes.mdx +134 -0
  232. package/docs/observability/index.mdx +32 -10
  233. package/docs/observability/meta.json +1 -1
  234. package/docs/observability/retention.mdx +95 -0
  235. package/docs/observability/tracing.mdx +124 -0
  236. package/docs/testing/index.mdx +36 -36
  237. package/docs/testing/server-based.mdx +10 -10
  238. package/docs/whats-new.mdx +186 -0
  239. package/package.json +17 -14
  240. package/docs/api-reference/workflow-api/world/index.mdx +0 -58
  241. package/docs/api-reference/workflow-api/world/meta.json +0 -4
  242. package/docs/api-reference/workflow-api/world/observability.mdx +0 -164
  243. package/docs/api-reference/workflow-api/world/queue.mdx +0 -86
  244. package/docs/deploying/building-a-world.mdx +0 -251
  245. package/docs/deploying/index.mdx +0 -95
  246. package/docs/deploying/meta.json +0 -4
  247. package/docs/deploying/world/local-world.mdx +0 -84
  248. package/docs/deploying/world/meta.json +0 -4
  249. package/docs/deploying/world/postgres-world.mdx +0 -224
  250. package/docs/deploying/world/vercel-world.mdx +0 -179
  251. package/docs/migration-guides/index.mdx +0 -34
  252. package/docs/migration-guides/meta.json +0 -9
  253. package/docs/migration-guides/migrating-from-aws-step-functions.mdx +0 -363
  254. package/docs/migration-guides/migrating-from-inngest.mdx +0 -314
  255. package/docs/migration-guides/migrating-from-temporal.mdx +0 -318
  256. package/docs/migration-guides/migrating-from-trigger-dev.mdx +0 -337
@@ -1,95 +0,0 @@
1
- ---
2
- title: Deploying
3
- icon: Rocket
4
- description: Deploy workflows locally, on Vercel, or anywhere using pluggable World adapters.
5
- type: overview
6
- summary: Learn how to deploy workflows to different environments using World adapters.
7
- related:
8
- - /docs/deploying/world/local-world
9
- - /docs/deploying/world/postgres-world
10
- - /docs/deploying/world/vercel-world
11
- - /docs/deploying/building-a-world
12
- ---
13
-
14
- Workflows are designed to be highly portable. The same workflow code can run locally during development, on Vercel with zero configuration, or on any infrastructure using **Worlds** — pluggable adapters that handle storage, queuing, and communication.
15
-
16
- ## Local Development
17
-
18
- During local development, workflows automatically use the **Local World** — no configuration required. The Local World stores workflow data in a `.workflow-data/` directory and processes steps synchronously, making it perfect for development and testing.
19
-
20
- ```bash
21
- # Just run your dev server - workflows work out of the box
22
- npm run dev
23
- ```
24
-
25
- You can inspect local workflow data using the CLI:
26
-
27
- ```bash
28
- npx workflow inspect runs
29
- ```
30
-
31
- <Callout>
32
- Learn more about the [Local World](/worlds/local) configuration and internals.
33
- </Callout>
34
-
35
- ## Deploying to Vercel
36
-
37
- The easiest way to deploy workflows to production is on Vercel. When you deploy to Vercel, workflows automatically use the **Vercel World** — again, with zero configuration.
38
-
39
- The Vercel World provides:
40
-
41
- - **Durable storage** - Workflow state persists across function invocations
42
- - **Managed queuing** - Steps are processed reliably with automatic retries
43
- - **Automatic scaling** - Workflows scale with your application
44
- - **Built-in observability** - View workflow runs in the Vercel dashboard
45
-
46
- Simply deploy your application:
47
-
48
- ```bash
49
- vercel deploy
50
- ```
51
-
52
- <FluidComputeCallout />
53
-
54
- <Callout>
55
- Learn more about the [Vercel World](/worlds/vercel) and its capabilities.
56
- </Callout>
57
-
58
- ## Self-Hosting & Other Providers
59
-
60
- For self-hosting or deploying to other cloud providers, you can use community-maintained Worlds or build your own.
61
-
62
- <Cards>
63
- <Card title="Explore Worlds" href="/worlds">
64
- Browse official and community World implementations with compatibility status and performance benchmarks.
65
- </Card>
66
- <Card title="Build Your Own" href="/docs/deploying/building-a-world">
67
- Learn how to implement a custom World for your infrastructure.
68
- </Card>
69
- </Cards>
70
-
71
- ### Using a Third-Party World
72
-
73
- To use a different World implementation, set the `WORKFLOW_TARGET_WORLD` environment variable:
74
-
75
- ```bash
76
- export WORKFLOW_TARGET_WORLD=@workflow/world-postgres
77
- # Plus any world-specific configuration
78
- export DATABASE_URL=postgres://...
79
- ```
80
-
81
- Each World may have its own configuration requirements — refer to the specific World's documentation for details.
82
-
83
- ## Observability
84
-
85
- The [Observability tools](/docs/observability) work with any World backend. By default they connect to your local environment, but can be configured to inspect remote deployments:
86
-
87
- ```bash
88
- # Inspect local workflows
89
- npx workflow inspect runs
90
-
91
- # Inspect remote workflows
92
- npx workflow inspect runs --backend @workflow/world-postgres
93
- ```
94
-
95
- Learn more about [Observability](/docs/observability) tools.
@@ -1,4 +0,0 @@
1
- {
2
- "title": "Deploying",
3
- "pages": ["...deploying", "building-a-world"]
4
- }
@@ -1,84 +0,0 @@
1
- ---
2
- title: Local World
3
- description: Zero-config world bundled with Workflow for local development. No external services required.
4
- type: integration
5
- summary: Set up the Local World for zero-config workflow development on your machine.
6
- prerequisites:
7
- - /docs/deploying
8
- related:
9
- - /docs/deploying/world/postgres-world
10
- - /docs/deploying/world/vercel-world
11
- ---
12
-
13
- The Local World is bundled with `workflow` and used automatically during local development. No installation or configuration required.
14
-
15
- To explicitly use the local world in any environment, set the environment variable:
16
-
17
- ```bash
18
- WORKFLOW_TARGET_WORLD=local
19
- ```
20
-
21
- ## Observability
22
-
23
- The `workflow` CLI uses the local world by default. Running these commands inside your workflow project will show your local development workflows:
24
-
25
- ```bash
26
- # List recent workflow runs
27
- npx workflow inspect runs
28
-
29
- # Launch the web UI
30
- npx workflow web
31
- ```
32
-
33
- Learn more in the [Observability](/docs/observability) documentation.
34
-
35
- ## Testing & Compatibility
36
-
37
- <WorldTestingPerformance />
38
-
39
- ## Configuration
40
-
41
- The local world works with zero configuration, but you can customize behavior through environment variables or programmatically via `createLocalWorld()`.
42
-
43
- ### `WORKFLOW_LOCAL_DATA_DIR`
44
-
45
- Directory for storing workflow data as JSON files. Default: `.workflow-data/`
46
-
47
- ### `PORT`
48
-
49
- The application dev server port. Used to enqueue steps and workflows. Default: auto-detected
50
-
51
- ### `WORKFLOW_LOCAL_BASE_URL`
52
-
53
- Full base URL override for HTTPS or custom hostnames. Default: `http://localhost:{port}`
54
-
55
- Port resolution priority: `baseUrl` > `port` > `PORT` > auto-detected
56
-
57
- ### `WORKFLOW_LOCAL_QUEUE_CONCURRENCY`
58
-
59
- Maximum number of concurrent queue workers. Default: `100`
60
-
61
- ### Programmatic configuration
62
-
63
- {/* @skip-typecheck: incomplete code sample */}
64
- ```typescript title="workflow.config.ts" lineNumbers
65
- import { createLocalWorld } from "@workflow/world-local";
66
-
67
- const world = createLocalWorld({
68
- dataDir: "./custom-workflow-data",
69
- port: 5173,
70
- // baseUrl overrides port if set
71
- baseUrl: "https://local.example.com:3000",
72
- });
73
- ```
74
-
75
- ## Limitations
76
-
77
- The local world is designed for development, not production:
78
-
79
- - **In-memory queue** - Steps are queued in memory and do not persist across server restarts
80
- - **Filesystem storage** - Data is stored in local JSON files
81
- - **Single instance** - Cannot handle distributed deployments
82
- - **No authentication** - Suitable only for local development
83
-
84
- For production deployments, use the [Vercel World](/worlds/vercel) or [Postgres World](/worlds/postgres).
@@ -1,4 +0,0 @@
1
- {
2
- "title": "World",
3
- "pages": ["local-world", "vercel-world", "postgres-world"]
4
- }
@@ -1,224 +0,0 @@
1
- ---
2
- title: Postgres World
3
- description: Production-ready, self-hosted world using PostgreSQL for storage and graphile-worker for job processing.
4
- type: integration
5
- summary: Deploy workflows to your own infrastructure using PostgreSQL and graphile-worker.
6
- prerequisites:
7
- - /docs/deploying
8
- related:
9
- - /docs/deploying/world/local-world
10
- - /docs/deploying/world/vercel-world
11
- ---
12
-
13
- The Postgres World is a production-ready backend for self-hosted deployments. It uses PostgreSQL for durable storage and [graphile-worker](https://github.com/graphile/worker) for reliable job processing.
14
-
15
- Use the Postgres World when you need to deploy workflows on your own infrastructure outside of Vercel - such as a Docker container, Kubernetes cluster, or any cloud that supports long-running servers.
16
-
17
- ## Installation
18
-
19
- Install the Postgres World package in your workflow project:
20
-
21
- ```package-install
22
- @workflow/world-postgres
23
- ```
24
-
25
- Configure the required environment variables to use the world and point it to your PostgreSQL database:
26
-
27
- ```bash title=".env"
28
- WORKFLOW_TARGET_WORLD="@workflow/world-postgres"
29
- WORKFLOW_POSTGRES_URL="postgres://user:password@host:5432/database"
30
- ```
31
-
32
- Run the migration script to create the necessary tables in your database. Ensure `WORKFLOW_POSTGRES_URL` is set when running this command:
33
-
34
- ```bash
35
- npx workflow-postgres-setup
36
- ```
37
-
38
- <Callout type="info">
39
- The migration is idempotent and can safely be run as a post-deployment lifecycle script.
40
- </Callout>
41
-
42
- ## Starting the World
43
-
44
- To subscribe to the graphile-worker queue, your workflow app needs to start the world on server start. Here are examples for a few frameworks:
45
-
46
- <Tabs items={["Next.js", "SvelteKit", "Nitro"]}>
47
-
48
- <Tab value="Next.js">
49
-
50
- Create an `instrumentation.ts` file in your project root:
51
-
52
- ```ts title="instrumentation.ts" lineNumbers
53
- export async function register() {
54
- if (process.env.NEXT_RUNTIME !== "edge") {
55
- const { getWorld } = await import("workflow/runtime");
56
- const world = await getWorld();
57
- await world.start?.();
58
- }
59
- }
60
- ```
61
-
62
- <Callout type="info">
63
- Learn more about [Next.js Instrumentation](https://nextjs.org/docs/app/guides/instrumentation).
64
- </Callout>
65
-
66
- </Tab>
67
-
68
- <Tab value="SvelteKit">
69
-
70
- Create a `src/hooks.server.ts` file:
71
-
72
- ```ts title="src/hooks.server.ts" lineNumbers
73
- import type { ServerInit } from "@sveltejs/kit";
74
-
75
- export const init: ServerInit = async () => {
76
- const { getWorld } = await import("workflow/runtime");
77
- const world = await getWorld();
78
- await world.start?.();
79
- };
80
- ```
81
-
82
- <Callout type="info">
83
- Learn more about [SvelteKit Hooks](https://svelte.dev/docs/kit/hooks).
84
- </Callout>
85
-
86
- </Tab>
87
-
88
- <Tab value="Nitro">
89
-
90
- Create a plugin to start the world on server initialization:
91
-
92
- ```ts title="plugins/start-pg-world.ts" lineNumbers
93
- import { defineNitroPlugin } from "nitro/~internal/runtime/plugin";
94
-
95
- export default defineNitroPlugin(async () => {
96
- const { getWorld } = await import("workflow/runtime");
97
- const world = await getWorld();
98
- await world.start?.();
99
- });
100
- ```
101
-
102
- Register the plugin in your config:
103
-
104
- ```ts title="nitro.config.ts"
105
- import { defineNitroConfig } from "nitropack";
106
-
107
- export default defineNitroConfig({
108
- modules: ["workflow/nitro"],
109
- plugins: ["plugins/start-pg-world.ts"],
110
- });
111
- ```
112
-
113
- <Callout type="info">
114
- Learn more about [Nitro Plugins](https://v3.nitro.build/docs/plugins).
115
- </Callout>
116
-
117
- </Tab>
118
-
119
- </Tabs>
120
-
121
- <Callout type="info">
122
- The Postgres World requires a long-lived worker process that polls the database for jobs. This does not work on serverless environments. For Vercel deployments, use the [Vercel World](/worlds/vercel) instead.
123
- </Callout>
124
-
125
- ## Observability
126
-
127
- Use the `workflow` CLI to inspect workflows stored in PostgreSQL:
128
-
129
- ```bash
130
- # Set your database URL
131
- export WORKFLOW_POSTGRES_URL="postgres://user:password@host:5432/database"
132
-
133
- # List workflow runs
134
- npx workflow inspect runs --backend @workflow/world-postgres
135
-
136
- # Launch the web UI
137
- npx workflow web --backend @workflow/world-postgres
138
- ```
139
-
140
- If `WORKFLOW_POSTGRES_URL` is not set, the CLI defaults to `postgres://world:world@localhost:5432/world`.
141
-
142
- Learn more in the [Observability](/docs/observability) documentation.
143
-
144
- ## Testing & Compatibility
145
-
146
- <WorldTestingPerformance />
147
-
148
- ## Configuration
149
-
150
- All configuration options can be set via environment variables or programmatically via `createWorld()`.
151
-
152
- ### `WORKFLOW_POSTGRES_URL` (required)
153
-
154
- PostgreSQL connection string. Falls back to `DATABASE_URL` if not set.
155
-
156
- Default: `postgres://world:world@localhost:5432/world`
157
-
158
- ### `WORKFLOW_POSTGRES_JOB_PREFIX`
159
-
160
- Prefix for graphile-worker queue job names. Useful when sharing a database between multiple applications.
161
-
162
- ### `WORKFLOW_POSTGRES_WORKER_CONCURRENCY`
163
-
164
- Number of concurrent workers polling for jobs. Default: `50`.
165
-
166
- This value also bounds how many parent→child workflow polls can be in flight simultaneously. Every `await childRun.returnValue` inside a workflow holds a worker slot until the child run terminates — if you expect recursive or highly-fanned-out parent/child workflows, raise this ceiling above the peak number of concurrent polls. With the default of 50, the included `fibonacciWorkflow` e2e test (fib(6), ~24 concurrent polls at peak) passes; deeper recursion or larger fanouts need a correspondingly larger setting.
167
-
168
- ### `WORKFLOW_POSTGRES_MAX_POOL_SIZE`
169
-
170
- Maximum size of the internal `pg.Pool` used when `createWorld()` constructs the pool. Default: `10`
171
-
172
- For higher worker concurrency, Graphile Worker recommends setting `maxPoolSize` to `10` or `queueConcurrency + 2`, whichever is larger.
173
-
174
- ### Programmatic configuration
175
-
176
- {/*@skip-typecheck: incomplete code sample*/}
177
-
178
- ```typescript title="workflow.config.ts" lineNumbers
179
- import { createWorld } from "@workflow/world-postgres";
180
-
181
- const world = createWorld({
182
- connectionString: "postgres://user:password@host:5432/database",
183
- jobPrefix: "myapp_",
184
- queueConcurrency: 50,
185
- maxPoolSize: 52, // overrides WORKFLOW_POSTGRES_MAX_POOL_SIZE
186
- });
187
- ```
188
-
189
- ## How It Works
190
-
191
- The Postgres World uses PostgreSQL as a durable backend:
192
-
193
- - **Storage** - Workflow runs, events, steps, and hooks are stored in PostgreSQL tables
194
- - **Job Queue** - [graphile-worker](https://github.com/graphile/worker) handles reliable job processing with retries
195
- - **Streaming** - PostgreSQL NOTIFY/LISTEN enables real-time event distribution
196
-
197
- This architecture ensures workflows survive application restarts with all state reliably persisted. For implementation details, see the [source code](https://github.com/vercel/workflow/tree/main/packages/world-postgres).
198
-
199
- ## Deployment
200
-
201
- Deploy your application to any cloud that supports long-running servers:
202
-
203
- - Docker containers
204
- - Kubernetes clusters
205
- - Virtual machines
206
- - Platform-as-a-Service providers (Railway, Render, Fly.io, etc.)
207
-
208
- Ensure your deployment has:
209
-
210
- 1. Network access to your PostgreSQL database
211
- 2. Environment variables configured correctly
212
- 3. The `start()` function called on server initialization
213
-
214
- <Callout type="info">
215
- The Postgres World is not compatible with Vercel deployments. On Vercel, workflows automatically use the [Vercel World](/worlds/vercel) with zero configuration.
216
- </Callout>
217
-
218
- ## Limitations
219
-
220
- - **Requires long-running process** - Must call `start()` on server initialization; not compatible with serverless platforms
221
- - **PostgreSQL infrastructure** - Requires a PostgreSQL database (self-hosted or managed)
222
- - **Not compatible with Vercel** - Use the [Vercel World](/worlds/vercel) for Vercel deployments
223
-
224
- For local development, use the [Local World](/worlds/local) which requires no external services.
@@ -1,179 +0,0 @@
1
- ---
2
- title: Vercel World
3
- description: Fully-managed world for Vercel deployments with automatic storage, queuing, and authentication.
4
- type: integration
5
- summary: Deploy workflows to Vercel with fully-managed storage, queuing, and authentication.
6
- prerequisites:
7
- - /docs/deploying
8
- related:
9
- - /docs/how-it-works/encryption
10
- - /docs/deploying/world/local-world
11
- - /docs/deploying/world/postgres-world
12
- ---
13
-
14
- The Vercel World is a fully-managed workflow backend for applications deployed on Vercel. It provides scalable storage, distributed queuing, and automatic authentication with zero configuration.
15
-
16
- When you deploy to Vercel, workflows automatically use the Vercel World - no setup required.
17
-
18
- ## Usage
19
-
20
- Deploy your application to Vercel:
21
-
22
- ```bash
23
- vercel deploy
24
- ```
25
-
26
- That's it. Vercel automatically:
27
-
28
- - Selects the Vercel World backend
29
- - Configures authentication using OIDC tokens
30
- - Provisions storage and queuing infrastructure
31
- - Isolates data per environment (production, preview, development)
32
-
33
- <FluidComputeCallout />
34
-
35
- ## Vercel platform documentation
36
-
37
- For complete details on pricing, usage limits, and included allotments on Vercel, see the official Vercel documentation:
38
-
39
- - **[Vercel Workflow](https://vercel.com/docs/workflow)** — Pricing details, concepts, and observability for Workflow on Vercel
40
- - **[Vercel limits](https://vercel.com/docs/limits)** — Platform-wide limits including Workflow-specific constraints
41
- - **[Vercel Hobby plan](https://vercel.com/docs/plans/hobby)** — Free tier included usage for Workflow and other resources
42
-
43
- For self-hosted deployments, use the [Postgres World](/worlds/postgres). For local development, use the [Local World](/worlds/local).
44
-
45
- ## Limitations
46
-
47
- - **Single-region deployment** - The backend infrastructure is currently deployed only in `iad1`. Applications in other regions will route workflow requests to `iad1`, which may result in higher latency. For best performance, deploy your Vercel apps using Workflow to `iad1`. Global deployment is planned to colocate the backend closer to your applications.
48
-
49
- - **Data residency** - The Vercel World is currently deployed in the `iad1` region. This means independently of the deployment location of your application, the data for your workflows will be stored in the `iad1` region.
50
-
51
- ## Observability
52
-
53
- Workflow observability is built into the Vercel dashboard on your project page. It respects your existing authentication and project permission settings.
54
-
55
- The `workflow` CLI commands open a browser window deeplinked to the Vercel dashboard:
56
-
57
- ```bash
58
- # List workflow runs (opens Vercel dashboard)
59
- npx workflow inspect runs --backend vercel
60
-
61
- # Launch the web UI (opens Vercel dashboard)
62
- npx workflow web --backend vercel
63
- ```
64
-
65
- The CLI automatically retrieves authentication from the Vercel CLI (`vercel login`) and infers project/team IDs from your local Vercel project linking.
66
-
67
- To use the local observability UI instead of the Vercel dashboard:
68
-
69
- ```bash
70
- npx workflow web --backend vercel --localUi
71
- ```
72
-
73
- To override the automatic configuration:
74
-
75
- ```bash
76
- npx workflow inspect runs \
77
- --backend vercel \
78
- --env production \
79
- --project my-project \
80
- --team my-team \
81
- --authToken <your-token>
82
- ```
83
-
84
- Learn more in the [Observability](/docs/observability) documentation.
85
-
86
- ## Testing & Compatibility
87
-
88
- <WorldTestingPerformance />
89
-
90
- ## Configuration
91
-
92
- The Vercel World requires no configuration when deployed to Vercel. For advanced use cases, you can override settings programmatically via `createVercelWorld()`.
93
-
94
- ### `WORKFLOW_VERCEL_ENV`
95
-
96
- The Vercel environment to use. Options: `production`, `preview`, `development`. Automatically detected.
97
-
98
- ### `WORKFLOW_VERCEL_AUTH_TOKEN`
99
-
100
- Authentication token for API requests. Automatically detected.
101
-
102
- ### `WORKFLOW_VERCEL_PROJECT`
103
-
104
- Vercel project ID for API requests. Automatically detected.
105
-
106
- ### `WORKFLOW_VERCEL_TEAM`
107
-
108
- Vercel team ID for API requests. Automatically detected.
109
-
110
- ### `WORKFLOW_VERCEL_BACKEND_URL`
111
-
112
- Custom base URL for the Vercel workflow API. Automatically detected.
113
-
114
- ### Programmatic configuration
115
-
116
- {/*@skip-typecheck: incomplete code sample*/}
117
-
118
- ```typescript title="workflow.config.ts" lineNumbers
119
- import { createVercelWorld } from "@workflow/world-vercel";
120
-
121
- const world = createVercelWorld({
122
- token: process.env.WORKFLOW_VERCEL_AUTH_TOKEN,
123
- baseUrl: "https://api.vercel.com/v1/workflow",
124
- projectConfig: {
125
- projectId: "my-project",
126
- teamId: "my-team",
127
- environment: "production",
128
- },
129
- });
130
- ```
131
-
132
- ## Versioning
133
-
134
- On Vercel, workflow runs are pegged to the deployment that started them. This means:
135
-
136
- - Existing workflow runs continue executing on their original deployment, even as new code is deployed
137
- - New workflow runs start on the latest deployment
138
- - Code changes won't break in-flight workflows
139
-
140
- This ensures long-running workflows complete reliably without being affected by subsequent deployments.
141
-
142
- ## Security
143
-
144
- ### Consumer function security
145
-
146
- Workflow handler functions on Vercel are not accessible through public endpoints. During the build step, the Workflow SDK registers each handler as only reachable by [Vercel Queue](https://vercel.com/docs/queues), by using the `experimentalTriggers` configuration in `.vc-config.json`:
147
-
148
- ```json title=".vc-config.json (step handler)"
149
- {
150
- "experimentalTriggers": [
151
- {
152
- "type": "queue/v2beta",
153
- "topic": "__wkf_step_*",
154
- "consumer": "default",
155
- }
156
- ]
157
- }
158
- ```
159
-
160
- Practically, this means:
161
-
162
- - You don't need to add authentication or authorization logic to workflow handlers
163
- - Unauthorized requests can never reach the step or workflow functions
164
- - Only messages delivered through Vercel Queues can trigger execution
165
- - Handlers receive only a message ID that must be retrieved from Vercel's backend, making it impossible to craft custom payloads
166
-
167
- <Callout>
168
- This configuration is managed entirely by the Workflow SDK build step. You should not need to write this yourself. If you are writing a custom integration, see [Framework Integrations — Security](/docs/how-it-works/framework-integrations#security) for more details.
169
- </Callout>
170
-
171
- ## How It Works
172
-
173
- The Vercel World uses Vercel's infrastructure for workflow execution:
174
-
175
- - **Storage** - Workflow data is stored in Vercel's cloud with automatic replication and [end-to-end encryption](/docs/how-it-works/encryption)
176
- - **Queuing** - Steps are distributed across serverless functions via [Vercel Queues](https://vercel.com/docs/queues) with automatic retries and [consumer function security](#consumer-function-security)
177
- - **Authentication** - OIDC tokens provide secure, automatic authentication
178
-
179
- For more details, see the [Vercel Workflow documentation](https://vercel.com/docs/workflow).
@@ -1,34 +0,0 @@
1
- ---
2
- title: Migration Guides
3
- description: Move your existing durable workflow system to the Workflow SDK with side-by-side code comparisons and a realistic migration example.
4
- type: overview
5
- summary: Migrate from Temporal, Inngest, AWS Step Functions, or trigger.dev to the Workflow SDK.
6
- related:
7
- - /docs/foundations/workflows-and-steps
8
- - /docs/getting-started
9
- ---
10
-
11
- <Callout type="info">
12
- Install the Workflow SDK migration skill:
13
-
14
- ```bash
15
- npx skills add https://github.com/vercel/workflow --skill migrating-to-workflow-sdk
16
- ```
17
- </Callout>
18
-
19
- Move an existing orchestration system to the Workflow SDK. Each guide pairs a concept-mapping table with side-by-side code, so you can translate one piece of your codebase at a time.
20
-
21
- <Cards>
22
- <Card href="/docs/migration-guides/migrating-from-temporal" title="Migrating from Temporal">
23
- Map Activities, Workers, Signals, and Child Workflows onto workflows, steps, hooks, and `start()` / `getRun()`.
24
- </Card>
25
- <Card href="/docs/migration-guides/migrating-from-inngest" title="Migrating from Inngest">
26
- Map `createFunction`, `step.run`, `step.sleep`, `step.waitForEvent`, and `step.invoke` onto workflows, steps, and hooks.
27
- </Card>
28
- <Card href="/docs/migration-guides/migrating-from-aws-step-functions" title="Migrating from AWS Step Functions">
29
- Replace ASL JSON states, Task / Choice / Wait / Parallel states, and `.waitForTaskToken` callbacks with TypeScript.
30
- </Card>
31
- <Card href="/docs/migration-guides/migrating-from-trigger-dev" title="Migrating from trigger.dev">
32
- Map `task()`, `schemaTask()`, `wait.for` / `wait.forToken`, `triggerAndWait`, and `metadata.stream` onto workflows, steps, hooks, and `start()` / `getRun()`.
33
- </Card>
34
- </Cards>
@@ -1,9 +0,0 @@
1
- {
2
- "title": "Migration Guides",
3
- "pages": [
4
- "migrating-from-temporal",
5
- "migrating-from-inngest",
6
- "migrating-from-aws-step-functions",
7
- "migrating-from-trigger-dev"
8
- ]
9
- }