workflow 5.0.0-beta.3 → 5.0.0-beta.30
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.
- package/dist/api-workflow.d.ts +1 -1
- package/dist/api-workflow.d.ts.map +1 -1
- package/dist/api-workflow.js +1 -1
- package/dist/api.d.ts +5 -1
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +12 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -1
- package/dist/internal/builtins.d.ts +17 -0
- package/dist/internal/builtins.d.ts.map +1 -1
- package/dist/internal/builtins.js +65 -1
- package/dist/observability.d.ts +1 -1
- package/dist/observability.js +2 -2
- package/dist/runtime.d.ts +2 -1
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +5 -2
- package/docs/ai/chat-session-modeling.mdx +7 -3
- package/docs/ai/defining-tools.mdx +2 -2
- package/docs/ai/index.mdx +28 -23
- package/docs/ai/message-queueing.mdx +10 -10
- package/docs/ai/resumable-streams.mdx +9 -1
- package/docs/api-reference/index.mdx +24 -0
- package/docs/api-reference/meta.json +8 -0
- package/docs/api-reference/vitest/index.mdx +28 -7
- package/docs/api-reference/workflow/create-hook.mdx +38 -0
- package/docs/api-reference/workflow/create-webhook.mdx +1 -0
- package/docs/api-reference/workflow/experimental-set-attributes.mdx +65 -0
- package/docs/api-reference/workflow/fetch.mdx +5 -0
- package/docs/api-reference/workflow/index.mdx +3 -0
- package/docs/api-reference/workflow-ai/durable-agent.mdx +7 -45
- package/docs/api-reference/workflow-ai/index.mdx +2 -2
- package/docs/api-reference/workflow-ai/workflow-chat-transport.mdx +44 -1
- package/docs/api-reference/workflow-api/get-hook-by-token.mdx +7 -0
- package/docs/api-reference/workflow-api/get-run.mdx +25 -0
- package/docs/api-reference/workflow-api/index.mdx +6 -8
- package/docs/api-reference/workflow-api/resume-hook.mdx +57 -0
- package/docs/api-reference/workflow-api/start.mdx +13 -5
- package/docs/api-reference/workflow-astro/index.mdx +18 -0
- package/docs/api-reference/workflow-astro/meta.json +4 -0
- package/docs/api-reference/workflow-astro/workflow.mdx +45 -0
- package/docs/api-reference/workflow-errors/hook-conflict-error.mdx +60 -0
- package/docs/api-reference/workflow-errors/index.mdx +85 -0
- package/docs/api-reference/workflow-errors/meta.json +5 -0
- package/docs/api-reference/workflow-errors/run-not-supported-error.mdx +58 -0
- package/docs/api-reference/workflow-errors/workflow-error.mdx +52 -0
- package/docs/api-reference/workflow-errors/workflow-run-failed-error.mdx +16 -6
- package/docs/api-reference/workflow-errors/workflow-run-not-completed-error.mdx +58 -0
- package/docs/api-reference/workflow-errors/workflow-runtime-error.mdx +58 -0
- package/docs/api-reference/workflow-nest/configure-workflow-controller.mdx +33 -0
- package/docs/api-reference/workflow-nest/index.mdx +31 -0
- package/docs/api-reference/workflow-nest/meta.json +9 -0
- package/docs/api-reference/workflow-nest/nest-local-builder.mdx +64 -0
- package/docs/api-reference/workflow-nest/workflow-controller.mdx +40 -0
- package/docs/api-reference/workflow-nest/workflow-module.mdx +74 -0
- package/docs/api-reference/workflow-next/with-workflow.mdx +56 -2
- package/docs/api-reference/workflow-nitro/index.mdx +60 -0
- package/docs/api-reference/workflow-nuxt/index.mdx +48 -0
- package/docs/api-reference/workflow-observability/hydrate-data.mdx +35 -0
- package/docs/api-reference/workflow-observability/hydrate-resource-io.mdx +62 -0
- package/docs/api-reference/workflow-observability/index.mdx +64 -0
- package/docs/api-reference/workflow-observability/meta.json +11 -0
- package/docs/api-reference/workflow-observability/observability-revivers.mdx +50 -0
- package/docs/api-reference/workflow-observability/parse-class-name.mdx +41 -0
- package/docs/api-reference/workflow-observability/parse-step-name.mdx +40 -0
- package/docs/api-reference/workflow-observability/parse-workflow-name.mdx +55 -0
- package/docs/api-reference/workflow-runtime/create-world.mdx +39 -0
- package/docs/api-reference/workflow-runtime/get-world-handlers.mdx +44 -0
- package/docs/api-reference/{workflow-api → workflow-runtime}/get-world.mdx +7 -10
- package/docs/api-reference/workflow-runtime/health-check.mdx +50 -0
- package/docs/api-reference/workflow-runtime/index.mdx +43 -0
- package/docs/api-reference/workflow-runtime/meta.json +12 -0
- package/docs/api-reference/workflow-runtime/set-world.mdx +49 -0
- package/docs/api-reference/workflow-runtime/workflow-entrypoint.mdx +42 -0
- package/docs/api-reference/{workflow-api → workflow-runtime}/world/index.mdx +5 -8
- package/docs/api-reference/workflow-runtime/world/meta.json +4 -0
- package/docs/api-reference/{workflow-api → workflow-runtime}/world/queue.mdx +4 -2
- package/docs/api-reference/{workflow-api → workflow-runtime}/world/storage.mdx +11 -4
- package/docs/api-reference/{workflow-api → workflow-runtime}/world/streams.mdx +2 -2
- package/docs/api-reference/workflow-serde/index.mdx +0 -1
- package/docs/api-reference/workflow-serde/workflow-deserialize.mdx +1 -2
- package/docs/api-reference/workflow-serde/workflow-serialize.mdx +1 -2
- package/docs/api-reference/workflow-sveltekit/index.mdx +18 -0
- package/docs/api-reference/workflow-sveltekit/meta.json +4 -0
- package/docs/api-reference/workflow-sveltekit/workflow-plugin.mdx +42 -0
- package/docs/api-reference/workflow-vite/index.mdx +18 -0
- package/docs/api-reference/workflow-vite/meta.json +4 -0
- package/docs/api-reference/workflow-vite/workflow.mdx +48 -0
- package/docs/changelog/attributes-mvp.mdx +380 -0
- package/docs/changelog/eager-processing.mdx +269 -0
- package/docs/changelog/index.mdx +2 -1
- package/docs/changelog/lazy-event-creation.md +127 -0
- package/docs/changelog/meta.json +8 -1
- package/docs/changelog/resilient-start.mdx +31 -283
- package/docs/changelog/step-message-ownership.mdx +360 -0
- package/docs/changelog/turbo-mode.md +87 -0
- package/docs/configuration/build-and-diagnostics.mdx +51 -0
- package/docs/configuration/cli-and-web-ui.mdx +154 -0
- package/docs/configuration/framework-options.mdx +165 -0
- package/docs/configuration/index.mdx +32 -0
- package/docs/configuration/meta.json +12 -0
- package/docs/configuration/runtime-tuning.mdx +156 -0
- package/docs/configuration/worlds.mdx +228 -0
- package/docs/cookbook/advanced/child-workflows.mdx +199 -256
- package/docs/cookbook/advanced/meta.json +1 -1
- package/docs/cookbook/advanced/publishing-libraries.mdx +13 -12
- package/docs/cookbook/advanced/serializable-steps.mdx +8 -4
- package/docs/cookbook/advanced/upgrading-workflows.mdx +195 -0
- package/docs/cookbook/agent-patterns/agent-cancellation.mdx +31 -76
- package/docs/cookbook/agent-patterns/durable-agent.mdx +11 -143
- package/docs/cookbook/agent-patterns/human-in-the-loop.mdx +7 -3
- package/docs/cookbook/common-patterns/idempotency.mdx +36 -52
- package/docs/cookbook/common-patterns/rate-limiting.mdx +1 -1
- package/docs/cookbook/common-patterns/saga.mdx +2 -2
- package/docs/cookbook/common-patterns/scheduling.mdx +8 -0
- package/docs/cookbook/common-patterns/timeouts.mdx +2 -1
- package/docs/cookbook/common-patterns/workflow-composition.mdx +15 -16
- package/docs/cookbook/index.mdx +3 -3
- package/docs/cookbook/integrations/ai-sdk.mdx +60 -28
- package/docs/cookbook/integrations/chat-sdk.mdx +13 -0
- package/docs/cookbook/integrations/sandbox.mdx +13 -0
- package/docs/deploying/building-a-world.mdx +1 -1
- package/docs/deploying/index.mdx +1 -0
- package/docs/deploying/world/local-world.mdx +23 -6
- package/docs/deploying/world/postgres-world.mdx +79 -13
- package/docs/deploying/world/vercel-world.mdx +47 -12
- package/docs/errors/abort-signal-timeout-in-workflow.mdx +80 -0
- package/docs/errors/corrupted-event-log.mdx +5 -5
- package/docs/errors/hook-conflict.mdx +56 -4
- package/docs/errors/index.mdx +1 -35
- package/docs/errors/replay-divergence.mdx +27 -0
- package/docs/errors/runtime-decryption-failed.mdx +77 -0
- package/docs/errors/step-executed-multiple-times.mdx +23 -0
- package/docs/errors/step-not-registered.mdx +1 -1
- package/docs/foundations/cancellation.mdx +459 -0
- package/docs/foundations/errors-and-retries.mdx +7 -3
- package/docs/foundations/hooks.mdx +29 -0
- package/docs/foundations/idempotency.mdx +236 -11
- package/docs/foundations/index.mdx +1 -23
- package/docs/foundations/meta.json +3 -1
- package/docs/foundations/serialization.mdx +77 -41
- package/docs/foundations/starting-workflows.mdx +5 -1
- package/docs/foundations/streaming.mdx +14 -23
- package/docs/foundations/versioning.mdx +263 -0
- package/docs/getting-started/astro.mdx +6 -0
- package/docs/getting-started/index.mdx +6 -7
- package/docs/getting-started/meta.json +1 -0
- package/docs/getting-started/nestjs.mdx +9 -0
- package/docs/getting-started/next.mdx +5 -3
- package/docs/getting-started/nitro.mdx +22 -0
- package/docs/getting-started/sveltekit.mdx +6 -0
- package/docs/getting-started/tanstack-start.mdx +241 -0
- package/docs/how-it-works/cancellation.mdx +287 -0
- package/docs/how-it-works/code-transform.mdx +2 -2
- package/docs/how-it-works/encryption.mdx +2 -2
- package/docs/how-it-works/event-sourcing.mdx +2 -2
- package/docs/how-it-works/meta.json +2 -1
- package/docs/internal/index.mdx +21 -0
- package/docs/internal/meta.json +10 -0
- package/docs/internal/nitro-native-build.mdx +38 -0
- package/docs/internal/nitro-web-ui.mdx +24 -0
- package/docs/internal/serializable-abort-controller.mdx +148 -0
- package/docs/meta.json +1 -1
- package/docs/migration-guides/migrating-from-aws-step-functions.mdx +7 -12
- package/docs/migration-guides/migrating-from-inngest.mdx +7 -17
- package/docs/migration-guides/migrating-from-temporal.mdx +6 -11
- package/docs/migration-guides/migrating-from-trigger-dev.mdx +8 -17
- package/docs/observability/attributes.mdx +87 -0
- package/docs/observability/index.mdx +18 -1
- package/docs/observability/meta.json +1 -1
- package/docs/observability/tracing.mdx +119 -0
- package/docs/testing/index.mdx +2 -2
- package/package.json +14 -13
- package/docs/api-reference/workflow-api/world/meta.json +0 -4
- package/docs/api-reference/workflow-api/world/observability.mdx +0 -164
- package/docs/cookbook/advanced/distributed-abort-controller.mdx +0 -318
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Framework Options
|
|
3
|
+
description: Build-time and dev-server configuration for Workflow framework integrations.
|
|
4
|
+
type: reference
|
|
5
|
+
summary: Configure Workflow through framework plugins and module options.
|
|
6
|
+
related:
|
|
7
|
+
- /docs/api-reference/workflow-next/with-workflow
|
|
8
|
+
- /docs/configuration/build-and-diagnostics
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
Framework options are read at build or dev-server startup. Use them for settings that belong in source control, such as source-map behavior or framework-specific output paths.
|
|
12
|
+
|
|
13
|
+
## Next.js
|
|
14
|
+
|
|
15
|
+
`withWorkflow()` accepts an optional second argument.
|
|
16
|
+
|
|
17
|
+
### `workflows.local.port`
|
|
18
|
+
|
|
19
|
+
- Environment override: `PORT`
|
|
20
|
+
- Default: auto-detected
|
|
21
|
+
- Local-only. Sets the application port used by the Local World when queue messages call back into the app.
|
|
22
|
+
- The option writes `PORT` for non-Vercel builds.
|
|
23
|
+
|
|
24
|
+
### `workflows.sourcemap`
|
|
25
|
+
|
|
26
|
+
- Environment override: `WORKFLOW_SOURCEMAP`
|
|
27
|
+
- Default: `inline` in development, `false` in production
|
|
28
|
+
- Controls source maps for generated workflow bundles.
|
|
29
|
+
- Explicit config wins over `WORKFLOW_SOURCEMAP`.
|
|
30
|
+
|
|
31
|
+
```typescript title="next.config.ts" lineNumbers
|
|
32
|
+
import { withWorkflow } from "workflow/next";
|
|
33
|
+
|
|
34
|
+
export default withWorkflow(
|
|
35
|
+
{},
|
|
36
|
+
{
|
|
37
|
+
workflows: {
|
|
38
|
+
local: {
|
|
39
|
+
port: 4000,
|
|
40
|
+
},
|
|
41
|
+
sourcemap: false,
|
|
42
|
+
},
|
|
43
|
+
}
|
|
44
|
+
);
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Nitro and Nuxt
|
|
48
|
+
|
|
49
|
+
Configure Workflow through the Nitro `workflow` module options.
|
|
50
|
+
|
|
51
|
+
### `workflow.dirs`
|
|
52
|
+
|
|
53
|
+
- Environment override: none
|
|
54
|
+
- Default: `["workflows"]`
|
|
55
|
+
- Directories scanned for workflow files.
|
|
56
|
+
|
|
57
|
+
### `workflow.typescriptPlugin`
|
|
58
|
+
|
|
59
|
+
- Environment override: none
|
|
60
|
+
- Default: `false` for raw Nitro, `true` through the Nuxt module
|
|
61
|
+
- Enables the Workflow TypeScript language-service plugin in generated `tsconfig.json`.
|
|
62
|
+
- This affects editor diagnostics and completions. Workflow builds do not require it.
|
|
63
|
+
- Raw Nitro leaves it opt-in because it changes TypeScript editor behavior. Nuxt enables it by default because the Nuxt module owns the generated `tsconfig.json` flow.
|
|
64
|
+
|
|
65
|
+
### `workflow.runtime`
|
|
66
|
+
|
|
67
|
+
- Environment override: none
|
|
68
|
+
- Default: framework default
|
|
69
|
+
- Node.js runtime emitted for Vercel Functions, such as `nodejs22.x` or `nodejs24.x`.
|
|
70
|
+
|
|
71
|
+
### `workflow.sourcemap`
|
|
72
|
+
|
|
73
|
+
- Environment override: `WORKFLOW_SOURCEMAP`
|
|
74
|
+
- Default: `inline` in development, `false` in production
|
|
75
|
+
- Controls source maps for generated workflow bundles.
|
|
76
|
+
|
|
77
|
+
## NestJS
|
|
78
|
+
|
|
79
|
+
Configure Workflow through `WorkflowModule.forRoot()`.
|
|
80
|
+
|
|
81
|
+
### `workingDir`
|
|
82
|
+
|
|
83
|
+
- Environment override: none
|
|
84
|
+
- Default: `process.cwd()`
|
|
85
|
+
- Application root used for workflow discovery and bundling.
|
|
86
|
+
|
|
87
|
+
### `dirs`
|
|
88
|
+
|
|
89
|
+
- Environment override: none
|
|
90
|
+
- Default: `["src"]`
|
|
91
|
+
- Directories scanned for workflow files.
|
|
92
|
+
|
|
93
|
+
### `outDir`
|
|
94
|
+
|
|
95
|
+
- Environment override: none
|
|
96
|
+
- Default: `.nestjs/workflow`
|
|
97
|
+
- Directory for generated workflow bundles.
|
|
98
|
+
|
|
99
|
+
### `watch`
|
|
100
|
+
|
|
101
|
+
- Environment override: none
|
|
102
|
+
- Default: `false`
|
|
103
|
+
- Rebuilds workflow bundles during development.
|
|
104
|
+
|
|
105
|
+
### `moduleType`
|
|
106
|
+
|
|
107
|
+
- Environment override: none
|
|
108
|
+
- Default: `es6`
|
|
109
|
+
- Set to `commonjs` when the Nest app compiles TypeScript to CJS through SWC.
|
|
110
|
+
|
|
111
|
+
### `distDir`
|
|
112
|
+
|
|
113
|
+
- Environment override: none
|
|
114
|
+
- Default: `dist`
|
|
115
|
+
- Compiled JavaScript output directory used by the CJS import rewrite.
|
|
116
|
+
|
|
117
|
+
### `sourcemap`
|
|
118
|
+
|
|
119
|
+
- Environment override: `WORKFLOW_SOURCEMAP`
|
|
120
|
+
- Default: `inline` in development, `false` in production
|
|
121
|
+
- Controls source maps for generated workflow bundles.
|
|
122
|
+
|
|
123
|
+
### `skipBuild`
|
|
124
|
+
|
|
125
|
+
- Environment override: none
|
|
126
|
+
- Default: `false`
|
|
127
|
+
- Skips bundle generation when bundles are already pre-built.
|
|
128
|
+
|
|
129
|
+
## Astro
|
|
130
|
+
|
|
131
|
+
### `sourcemap`
|
|
132
|
+
|
|
133
|
+
- Environment override: `WORKFLOW_SOURCEMAP`
|
|
134
|
+
- Default: `inline` in development, `false` in production
|
|
135
|
+
- Controls source maps for generated workflow bundles.
|
|
136
|
+
|
|
137
|
+
## SvelteKit
|
|
138
|
+
|
|
139
|
+
### `sourcemap`
|
|
140
|
+
|
|
141
|
+
- Environment override: `WORKFLOW_SOURCEMAP`
|
|
142
|
+
- Default: `inline` in development, `false` in production
|
|
143
|
+
- Controls source maps for generated workflow bundles.
|
|
144
|
+
|
|
145
|
+
## Rollup
|
|
146
|
+
|
|
147
|
+
### `exclude`
|
|
148
|
+
|
|
149
|
+
- Environment override: none
|
|
150
|
+
- Default: `[]`
|
|
151
|
+
- Path prefixes skipped by the directive transform.
|
|
152
|
+
|
|
153
|
+
## Source-map values
|
|
154
|
+
|
|
155
|
+
`WORKFLOW_SOURCEMAP` accepts these values:
|
|
156
|
+
|
|
157
|
+
- `true`, `inline`, or `1` - append an inline base64 source map to each generated bundle.
|
|
158
|
+
- `linked` - write a `.map` file and add a `sourceMappingURL` comment.
|
|
159
|
+
- `external` - write a `.map` file without adding the comment.
|
|
160
|
+
- `both` - emit inline and external source maps.
|
|
161
|
+
- `false` or `0` - omit source maps.
|
|
162
|
+
|
|
163
|
+
<Callout type="info">
|
|
164
|
+
The legacy `WORKFLOW_EMIT_SOURCEMAPS_FOR_DEBUGGING=1` variable still works, but it only affects the final workflow wrapper and webhook bundle. Prefer `WORKFLOW_SOURCEMAP` or a framework `sourcemap` option.
|
|
165
|
+
</Callout>
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Configuration
|
|
3
|
+
description: Reference for Workflow SDK configuration options, environment variables, and CLI overrides.
|
|
4
|
+
type: conceptual
|
|
5
|
+
summary: Configure framework integrations, Worlds, runtime tuning, builds, and CLI observability.
|
|
6
|
+
prerequisites:
|
|
7
|
+
- /docs/foundations/workflows-and-steps
|
|
8
|
+
related:
|
|
9
|
+
- /docs/configuration/framework-options
|
|
10
|
+
- /docs/configuration/worlds
|
|
11
|
+
- /docs/configuration/runtime-tuning
|
|
12
|
+
- /docs/configuration/build-and-diagnostics
|
|
13
|
+
- /docs/configuration/cli-and-web-ui
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
Workflow SDK is configured through typed framework options, World factory options, environment variables, and CLI flags.
|
|
17
|
+
|
|
18
|
+
When more than one surface controls the same setting, the usual precedence is:
|
|
19
|
+
|
|
20
|
+
```txt
|
|
21
|
+
explicit option or CLI flag > environment variable > built-in default
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Invalid environment variable values do not crash the app. They log a warning and fall back to the default, or to the documented clamp range.
|
|
25
|
+
|
|
26
|
+
## Configuration areas
|
|
27
|
+
|
|
28
|
+
- [Framework options](/docs/configuration/framework-options) - build-time and dev-server options for Next.js, Nitro, NestJS, Astro, SvelteKit, and Rollup.
|
|
29
|
+
- [Worlds](/docs/configuration/worlds) - `WORKFLOW_TARGET_WORLD`, Local World, Postgres World, and Vercel World configuration.
|
|
30
|
+
- [Runtime tuning](/docs/configuration/runtime-tuning) - replay budgets, inline execution, queue delivery limits, compression, tracing, and advanced runtime escape hatches.
|
|
31
|
+
- [Build and diagnostics](/docs/configuration/build-and-diagnostics) - public manifests, HMR logs, and source-map controls.
|
|
32
|
+
- [CLI and web UI](/docs/configuration/cli-and-web-ui) - `workflow inspect`, `workflow web`, `workflow health`, and observability environment overrides.
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Runtime Tuning
|
|
3
|
+
description: Runtime environment variables for replay, inline execution, queue delivery, compression, tracing, and advanced limits.
|
|
4
|
+
type: reference
|
|
5
|
+
summary: Tune Workflow runtime behavior where workflows execute.
|
|
6
|
+
related:
|
|
7
|
+
- /docs/configuration/worlds
|
|
8
|
+
- /docs/how-it-works/event-sourcing
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
Runtime variables are read where workflows execute. Set them on the deployment or dev server.
|
|
12
|
+
|
|
13
|
+
## Replay and queue delivery
|
|
14
|
+
|
|
15
|
+
### `WORKFLOW_REPLAY_TIMEOUT_MS`
|
|
16
|
+
|
|
17
|
+
- Default: `240000`
|
|
18
|
+
- Clamp: `30000` to `780000`
|
|
19
|
+
- Charged time budget for replay and orchestration work in one handler invocation.
|
|
20
|
+
- Covers loading events, re-running the workflow function, resolving suspensions, and scheduling follow-up work.
|
|
21
|
+
- Does not include time spent inside inline `"use step"` bodies. Steps are bounded by the platform function duration instead.
|
|
22
|
+
|
|
23
|
+
For example, a workflow can run a 10-minute inline step even with `WORKFLOW_REPLAY_TIMEOUT_MS=300000`, because the replay budget is paused while the step body runs.
|
|
24
|
+
|
|
25
|
+
### `WORKFLOW_REPLAY_TIMEOUT_MAX_RETRIES`
|
|
26
|
+
|
|
27
|
+
- Default: `3`
|
|
28
|
+
- Queue deliveries that may hit the replay timeout before the run is failed with `REPLAY_TIMEOUT`.
|
|
29
|
+
|
|
30
|
+
### `WORKFLOW_MAX_QUEUE_DELIVERIES`
|
|
31
|
+
|
|
32
|
+
- Default: `48`
|
|
33
|
+
- Delivery attempts before a run or step is failed gracefully.
|
|
34
|
+
- Can only be lowered. The default is calibrated so Workflow can record failure before the queue expires the message.
|
|
35
|
+
|
|
36
|
+
### `WORKFLOW_REPLAY_DIVERGENCE_MAX_RETRIES`
|
|
37
|
+
|
|
38
|
+
- Default: `3`
|
|
39
|
+
- Recovery replays before replay divergence is recorded as corruption.
|
|
40
|
+
|
|
41
|
+
## Inline execution
|
|
42
|
+
|
|
43
|
+
### `WORKFLOW_V2_TIMEOUT_MS`
|
|
44
|
+
|
|
45
|
+
- Default: `120000`
|
|
46
|
+
- Wall-clock guard for the inline replay loop.
|
|
47
|
+
- Once elapsed, the handler requeues the workflow instead of continuing to run more inline work in the same invocation.
|
|
48
|
+
|
|
49
|
+
### `WORKFLOW_MAX_INLINE_STEPS`
|
|
50
|
+
|
|
51
|
+
- Default: `3`
|
|
52
|
+
- Clamp: `1` to `16`
|
|
53
|
+
- Number of newly-created steps one invocation runs inline in parallel before queueing the rest.
|
|
54
|
+
|
|
55
|
+
### `WORKFLOW_TURBO`
|
|
56
|
+
|
|
57
|
+
- Default: enabled
|
|
58
|
+
- Fast path for a run's first delivery.
|
|
59
|
+
- Set `0` or `false` to disable.
|
|
60
|
+
|
|
61
|
+
### `WORKFLOW_OPTIMISTIC_INLINE_START`
|
|
62
|
+
|
|
63
|
+
- Default: disabled
|
|
64
|
+
- Starts inline step bodies before their `step_started` event is confirmed.
|
|
65
|
+
- Use only when step side effects are idempotent.
|
|
66
|
+
- Set `0` or `false` to force it off, including the first-delivery fast path used by `WORKFLOW_TURBO`.
|
|
67
|
+
|
|
68
|
+
### `WORKFLOW_INLINE_OWNERSHIP`
|
|
69
|
+
|
|
70
|
+
- Default: enabled
|
|
71
|
+
- Records which queue message owns each inline step execution, so a wake (hook resume, elapsed wait) that replays the run mid-step schedules a delayed backstop instead of immediately re-dispatching — and re-executing — the step. See [Inline step message ownership](/v5/docs/changelog/step-message-ownership).
|
|
72
|
+
- Set `0` or `false` to revert to the previous unconditional immediate re-dispatch.
|
|
73
|
+
|
|
74
|
+
### `WORKFLOW_INLINE_OWNERSHIP_LEASE_SECONDS`
|
|
75
|
+
|
|
76
|
+
- Default: `860`
|
|
77
|
+
- Clamp: `1` to `900`
|
|
78
|
+
- How long after an inline step's latest `step_started` other invocations assume its owner may still be executing the body. Within the lease they defer the step's backstop message; past it they enqueue immediately.
|
|
79
|
+
- Raise this on self-hosted multi-instance deployments whose inline steps run longer than the default (the default is sized for Vercel's function duration ceiling).
|
|
80
|
+
|
|
81
|
+
## Compression and tracing
|
|
82
|
+
|
|
83
|
+
### `WORKFLOW_DISABLE_COMPRESSION`
|
|
84
|
+
|
|
85
|
+
- Default: compression enabled
|
|
86
|
+
- Set `1` to disable compression when writing payloads.
|
|
87
|
+
- Reads still decompress existing payloads.
|
|
88
|
+
|
|
89
|
+
### `WORKFLOW_COMPRESSION_CODEC`
|
|
90
|
+
|
|
91
|
+
- Default: automatic
|
|
92
|
+
- Forces the write-side codec to `zstd` or `gzip`.
|
|
93
|
+
- Invalid values are ignored. Automatic mode prefers `zstd` when the current Node.js runtime supports it, otherwise it falls back to `gzip`.
|
|
94
|
+
|
|
95
|
+
### `WORKFLOW_TRACE_MODE`
|
|
96
|
+
|
|
97
|
+
- Default: `linked`
|
|
98
|
+
- OpenTelemetry span topology for runs.
|
|
99
|
+
- Accepts `linked` or `continuous`.
|
|
100
|
+
|
|
101
|
+
### `DEBUG`
|
|
102
|
+
|
|
103
|
+
- Default: unset
|
|
104
|
+
- Debug log filter with wildcards and negation.
|
|
105
|
+
- Examples: `workflow:*`, `workflow:*,-workflow:telemetry:*`.
|
|
106
|
+
|
|
107
|
+
## Queue namespace
|
|
108
|
+
|
|
109
|
+
### `WORKFLOW_QUEUE_NAMESPACE`
|
|
110
|
+
|
|
111
|
+
- Default: none
|
|
112
|
+
- Queue topic namespace shared by build output and Worlds.
|
|
113
|
+
- Must match `^[a-z][a-z0-9]*$`.
|
|
114
|
+
- Set it consistently at build and runtime.
|
|
115
|
+
|
|
116
|
+
## Streams and waits
|
|
117
|
+
|
|
118
|
+
These variables are primarily for tests, debugging, or unusual deployments.
|
|
119
|
+
|
|
120
|
+
### `WORKFLOW_STREAM_FLUSH_INTERVAL_MS`
|
|
121
|
+
|
|
122
|
+
- Default: `10`
|
|
123
|
+
- Stream write buffering interval.
|
|
124
|
+
- Also available as `streamFlushIntervalMs` on Worlds that expose it.
|
|
125
|
+
|
|
126
|
+
### `WORKFLOW_FRAMED_STREAM_MAX_RECONNECTS`
|
|
127
|
+
|
|
128
|
+
- Default: `50`
|
|
129
|
+
- Consecutive reconnect cap for framed stream readers.
|
|
130
|
+
|
|
131
|
+
### `WORKFLOW_FRAMED_STREAM_MAX_TOTAL_RECONNECTS`
|
|
132
|
+
|
|
133
|
+
- Default: `1000`
|
|
134
|
+
- Total reconnect cap per stream session.
|
|
135
|
+
|
|
136
|
+
### `WORKFLOW_WAIT_CONTINUATION_MAX_DELAY_SECONDS`
|
|
137
|
+
|
|
138
|
+
- Default: `82800` (23 hours)
|
|
139
|
+
- Longest single queue delay used for `sleep()` continuations.
|
|
140
|
+
- If a wait is longer than this, Workflow queues one continuation for the maximum delay, then queues another continuation after that message fires, repeating until the wait's target time is reached.
|
|
141
|
+
|
|
142
|
+
### `WORKFLOW_NEAR_ELAPSED_WAIT_THRESHOLD_SECONDS`
|
|
143
|
+
|
|
144
|
+
- Default: `2`
|
|
145
|
+
- Clock-skew tolerance for wait continuations that arrive near their target time.
|
|
146
|
+
|
|
147
|
+
### `WORKFLOW_DEFERRED_CHECK_DELAY_MS`
|
|
148
|
+
|
|
149
|
+
- Default: `100`
|
|
150
|
+
- Delay before the unconsumed-event check fires.
|
|
151
|
+
- Minimum: `10`.
|
|
152
|
+
|
|
153
|
+
### `WORKFLOW_LOCK_POLL_INTERVAL_MS`
|
|
154
|
+
|
|
155
|
+
- Default: `10`
|
|
156
|
+
- Poll interval for detecting stream lock release.
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Worlds
|
|
3
|
+
description: Configure the Workflow backend that stores runs and delivers queue messages.
|
|
4
|
+
type: reference
|
|
5
|
+
summary: Select and configure Local, Postgres, Vercel, or custom Worlds.
|
|
6
|
+
related:
|
|
7
|
+
- /docs/deploying/world/local-world
|
|
8
|
+
- /docs/deploying/world/postgres-world
|
|
9
|
+
- /docs/deploying/world/vercel-world
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
A [World](/docs/deploying) stores workflow state and delivers queue messages.
|
|
13
|
+
|
|
14
|
+
## Selecting a World
|
|
15
|
+
|
|
16
|
+
### `WORKFLOW_TARGET_WORLD`
|
|
17
|
+
|
|
18
|
+
- Surface: environment variable
|
|
19
|
+
- Default: `local` outside Vercel; automatic Vercel World inside Vercel deployments
|
|
20
|
+
- Selects a non-default World module.
|
|
21
|
+
|
|
22
|
+
Outside Vercel, Workflow defaults to the Local World. On Vercel, leave `WORKFLOW_TARGET_WORLD` unset for the normal case; Workflow detects the Vercel deployment and selects the Vercel World automatically.
|
|
23
|
+
|
|
24
|
+
Set `WORKFLOW_TARGET_WORLD` only when you want to use a custom or self-hosted World:
|
|
25
|
+
|
|
26
|
+
- `local` - alias for `@workflow/world-local`.
|
|
27
|
+
- `@workflow/world-postgres` - Postgres World package.
|
|
28
|
+
- `./my-world.ts` - local module exporting a World, `createWorld()`, or a default factory.
|
|
29
|
+
- Any package specifier - custom World package.
|
|
30
|
+
|
|
31
|
+
The `vercel` alias exists for manual selection and tooling, but deployed Vercel apps do not need to set it.
|
|
32
|
+
|
|
33
|
+
Export a configured World from a module when you need factory options instead of pure environment configuration:
|
|
34
|
+
|
|
35
|
+
```typescript title="my-world.ts" lineNumbers
|
|
36
|
+
import { createWorld } from "@workflow/world-postgres";
|
|
37
|
+
|
|
38
|
+
export default createWorld({
|
|
39
|
+
connectionString: process.env.DATABASE_URL!,
|
|
40
|
+
jobPrefix: "myapp_",
|
|
41
|
+
});
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
```bash title=".env"
|
|
45
|
+
WORKFLOW_TARGET_WORLD="./my-world.ts"
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Local World
|
|
49
|
+
|
|
50
|
+
The Local World is the default outside Vercel and is intended for development.
|
|
51
|
+
|
|
52
|
+
### `dataDir`
|
|
53
|
+
|
|
54
|
+
- Environment variable: `WORKFLOW_LOCAL_DATA_DIR`
|
|
55
|
+
- Default: `.workflow-data`
|
|
56
|
+
- Directory where runs, steps, events, hooks, streams, and the local manifest are written.
|
|
57
|
+
|
|
58
|
+
### `baseUrl`
|
|
59
|
+
|
|
60
|
+
- Environment variable: `WORKFLOW_LOCAL_BASE_URL`
|
|
61
|
+
- Default: inferred from the app port
|
|
62
|
+
- Full base URL used when queue messages call back into the app.
|
|
63
|
+
- Overrides `port` and `PORT`.
|
|
64
|
+
|
|
65
|
+
### `port`
|
|
66
|
+
|
|
67
|
+
- Environment variable: `PORT`
|
|
68
|
+
- Default: auto-detected
|
|
69
|
+
- Local app port used to build the callback URL when `baseUrl` is unset.
|
|
70
|
+
|
|
71
|
+
### `WORKFLOW_LOCAL_QUEUE_CONCURRENCY`
|
|
72
|
+
|
|
73
|
+
- Factory option: none
|
|
74
|
+
- Default: `1000`
|
|
75
|
+
- Maximum number of concurrent local queue message handlers.
|
|
76
|
+
|
|
77
|
+
### `WORKFLOW_LOCAL_QUEUE_MAX_VISIBILITY`
|
|
78
|
+
|
|
79
|
+
- Factory option: none
|
|
80
|
+
- Default: unlimited
|
|
81
|
+
- Maximum seconds a local queue message stays hidden before the handler rechecks the run.
|
|
82
|
+
|
|
83
|
+
### `recoverActiveRuns`
|
|
84
|
+
|
|
85
|
+
- Environment variable: none
|
|
86
|
+
- Default: `true`
|
|
87
|
+
- Re-enqueues pending and running local runs when the World starts.
|
|
88
|
+
|
|
89
|
+
### `tag`
|
|
90
|
+
|
|
91
|
+
- Environment variable: none
|
|
92
|
+
- Default: unset
|
|
93
|
+
- Scopes local storage files to a tag, mainly for test isolation.
|
|
94
|
+
|
|
95
|
+
### `streamFlushIntervalMs`
|
|
96
|
+
|
|
97
|
+
- Environment variable fallback: `WORKFLOW_STREAM_FLUSH_INTERVAL_MS`
|
|
98
|
+
- Default: `10`
|
|
99
|
+
- Flush interval for buffered stream writes. The World option wins when set.
|
|
100
|
+
|
|
101
|
+
## Postgres World
|
|
102
|
+
|
|
103
|
+
The Postgres World is a self-hosted durable backend for long-running server processes.
|
|
104
|
+
|
|
105
|
+
### `connectionString`
|
|
106
|
+
|
|
107
|
+
- Environment variable: `WORKFLOW_POSTGRES_URL`, then `DATABASE_URL`
|
|
108
|
+
- Default: `postgres://world:world@localhost:5432/world`
|
|
109
|
+
- PostgreSQL connection string used by the runtime World.
|
|
110
|
+
- The `bootstrap` migration command uses the same precedence.
|
|
111
|
+
|
|
112
|
+
### `pool`
|
|
113
|
+
|
|
114
|
+
- Environment variable: none
|
|
115
|
+
- Default: new `pg.Pool`
|
|
116
|
+
- Existing `pg.Pool` to use instead of constructing one from `connectionString`.
|
|
117
|
+
|
|
118
|
+
### `jobPrefix`
|
|
119
|
+
|
|
120
|
+
- Environment variable: `WORKFLOW_POSTGRES_JOB_PREFIX`
|
|
121
|
+
- Default: `workflow_`
|
|
122
|
+
- Prefix for Graphile Worker job names.
|
|
123
|
+
|
|
124
|
+
### `queueConcurrency`
|
|
125
|
+
|
|
126
|
+
- Environment variable: `WORKFLOW_POSTGRES_WORKER_CONCURRENCY`
|
|
127
|
+
- Default: `50`
|
|
128
|
+
- Number of concurrent workers polling for jobs.
|
|
129
|
+
- Also bounds concurrent parent-to-child workflow return-value polls.
|
|
130
|
+
|
|
131
|
+
### `maxPoolSize`
|
|
132
|
+
|
|
133
|
+
- Environment variable: `WORKFLOW_POSTGRES_MAX_POOL_SIZE`
|
|
134
|
+
- Default: `pg` default
|
|
135
|
+
- Maximum size of the internal `pg.Pool` when the World creates the pool.
|
|
136
|
+
|
|
137
|
+
### `namespace`
|
|
138
|
+
|
|
139
|
+
- Environment variable fallback: `WORKFLOW_QUEUE_NAMESPACE`
|
|
140
|
+
- Default: none
|
|
141
|
+
- Queue topic namespace. For example, `custom` changes `__wkf_*` topics to `__custom_wkf_*`.
|
|
142
|
+
|
|
143
|
+
### `streamFlushIntervalMs`
|
|
144
|
+
|
|
145
|
+
- Environment variable fallback: `WORKFLOW_STREAM_FLUSH_INTERVAL_MS`
|
|
146
|
+
- Default: `10`
|
|
147
|
+
- Flush interval for buffered stream writes. The World option wins when set.
|
|
148
|
+
|
|
149
|
+
## Vercel World
|
|
150
|
+
|
|
151
|
+
The Vercel World is configured automatically inside Vercel deployments. The platform provides the deployment ID, project ID, request authentication, queue integration, storage, and encryption material.
|
|
152
|
+
|
|
153
|
+
Most applications should not set `WORKFLOW_VERCEL_*` variables on Vercel. They configure tooling that talks to a Vercel Workflow project from outside a deployment, such as the `workflow` CLI, the web UI, CI, or tests. The runtime warns if these variables are set in a deployed Vercel function because they do not control runtime configuration there.
|
|
154
|
+
|
|
155
|
+
Platform-provided values such as `VERCEL_DEPLOYMENT_ID`, `VERCEL_PROJECT_ID`, and `VERCEL_DEPLOYMENT_KEY` are read by the runtime inside Vercel deployments. Do not set them yourself.
|
|
156
|
+
|
|
157
|
+
### `token`
|
|
158
|
+
|
|
159
|
+
- Environment variable: `WORKFLOW_VERCEL_AUTH_TOKEN`, then `VERCEL_TOKEN`, then Vercel CLI login
|
|
160
|
+
- CLI flag: `--authToken`
|
|
161
|
+
- Default: inferred when possible
|
|
162
|
+
- Vercel API token for external tooling. Keep it secret.
|
|
163
|
+
|
|
164
|
+
### `projectConfig.environment`
|
|
165
|
+
|
|
166
|
+
- Environment variable: `WORKFLOW_VERCEL_ENV`
|
|
167
|
+
- CLI flag: `--env` or `-e`
|
|
168
|
+
- Default: `production`
|
|
169
|
+
- Vercel environment targeted by tooling. Accepts `production` or `preview`.
|
|
170
|
+
|
|
171
|
+
### `projectConfig.projectId`
|
|
172
|
+
|
|
173
|
+
- Environment variable: `WORKFLOW_VERCEL_PROJECT`
|
|
174
|
+
- CLI flag: `--project`
|
|
175
|
+
- Default: inferred from `.vercel/project.json` when possible
|
|
176
|
+
- Vercel project ID.
|
|
177
|
+
|
|
178
|
+
### `projectConfig.teamId`
|
|
179
|
+
|
|
180
|
+
- Environment variable: `WORKFLOW_VERCEL_TEAM`
|
|
181
|
+
- CLI flag: `--team`
|
|
182
|
+
- Default: inferred from `.vercel/project.json` when possible
|
|
183
|
+
- Vercel team ID.
|
|
184
|
+
|
|
185
|
+
### `WORKFLOW_VERCEL_PROJECT_NAME`
|
|
186
|
+
|
|
187
|
+
- Factory option: none
|
|
188
|
+
- CLI flag: none
|
|
189
|
+
- Default: inferred when possible
|
|
190
|
+
- Project slug used for dashboard links.
|
|
191
|
+
|
|
192
|
+
### `WORKFLOW_VERCEL_BACKEND_URL`
|
|
193
|
+
|
|
194
|
+
- Factory option: none
|
|
195
|
+
- CLI flag: none
|
|
196
|
+
- Default: `https://api.vercel.com/v1/workflow`
|
|
197
|
+
- Workflow API proxy URL for external tooling.
|
|
198
|
+
|
|
199
|
+
### `VERCEL_WORKFLOW_SERVER_URL`
|
|
200
|
+
|
|
201
|
+
- Factory option: none
|
|
202
|
+
- CLI flag: none
|
|
203
|
+
- Default: unset
|
|
204
|
+
- Direct workflow-server URL override for testing or custom infrastructure. Normal deployments do not need it.
|
|
205
|
+
|
|
206
|
+
### `VERCEL_QUEUE_MAX_DELAY_SECONDS`
|
|
207
|
+
|
|
208
|
+
- Factory option: none
|
|
209
|
+
- CLI flag: none
|
|
210
|
+
- Default: `82800` (23 hours)
|
|
211
|
+
- Maximum delay for one Vercel Queues continuation message when implementing `sleep()`.
|
|
212
|
+
- Longer sleeps schedule another continuation when the first one fires.
|
|
213
|
+
|
|
214
|
+
`VERCEL_QUEUE_MAX_DELAY_SECONDS` defaults to 23 hours because Vercel Queues message delays are capped by the message TTL, and the default TTL is 24 hours. Workflow stays inside that default and chains continuation messages for longer sleeps.
|
|
215
|
+
|
|
216
|
+
### `WORKFLOW_REQUEST_TIMEOUT_MS`
|
|
217
|
+
|
|
218
|
+
- Factory option: none
|
|
219
|
+
- CLI flag: none
|
|
220
|
+
- Default: `60000`
|
|
221
|
+
- Per-request timeout for Vercel World HTTP calls to workflow-server.
|
|
222
|
+
|
|
223
|
+
### `WORKFLOW_MAX_CHUNKS_PER_REQUEST`
|
|
224
|
+
|
|
225
|
+
- Factory option: none
|
|
226
|
+
- CLI flag: none
|
|
227
|
+
- Default: `1000`
|
|
228
|
+
- Maximum stream chunks written in one Vercel World request. Larger batches are split.
|