workflow 5.0.0-beta.4 → 5.0.0-beta.40
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/README.md +63 -20
- 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/internal/errors.d.ts +1 -1
- package/dist/internal/errors.d.ts.map +1 -1
- package/dist/internal/errors.js +2 -2
- package/dist/nest-builder.d.ts +2 -0
- package/dist/nest-builder.d.ts.map +1 -0
- package/dist/nest-builder.js +2 -0
- package/dist/nest-vercel-builder.d.ts +2 -0
- package/dist/nest-vercel-builder.d.ts.map +1 -0
- package/dist/nest-vercel-builder.js +2 -0
- 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 +30 -25
- 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 +79 -0
- package/docs/api-reference/workflow/create-webhook.mdx +1 -0
- package/docs/api-reference/workflow/define-hook.mdx +26 -24
- package/docs/api-reference/workflow/fatal-error.mdx +29 -7
- package/docs/api-reference/workflow/fetch.mdx +8 -4
- package/docs/api-reference/workflow/index.mdx +3 -0
- package/docs/api-reference/workflow/set-attributes.mdx +61 -0
- package/docs/api-reference/workflow/sleep.mdx +1 -1
- 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 +9 -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 +60 -1
- package/docs/api-reference/workflow-api/resume-webhook.mdx +6 -4
- package/docs/api-reference/workflow-api/start.mdx +39 -6
- 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 +88 -0
- package/docs/api-reference/workflow-errors/meta.json +6 -0
- package/docs/api-reference/workflow-errors/precondition-failed-error.mdx +68 -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-globals.mdx +4 -1
- 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-runtime/world/analytics.mdx +138 -0
- package/docs/api-reference/{workflow-api → workflow-runtime}/world/index.mdx +10 -10
- package/docs/api-reference/workflow-runtime/world/meta.json +4 -0
- package/docs/api-reference/{workflow-api → workflow-runtime}/world/queue.mdx +8 -6
- package/docs/api-reference/{workflow-api → workflow-runtime}/world/storage.mdx +18 -5
- 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 +2 -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 +3 -1
- package/docs/changelog/lazy-event-creation.md +127 -0
- package/docs/changelog/meta.json +9 -1
- package/docs/changelog/resilient-resume.mdx +22 -0
- 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/comparisons/index.mdx +66 -0
- package/docs/comparisons/meta.json +11 -0
- package/docs/comparisons/workflow-sdk-vs-aws-agentcore.mdx +55 -0
- package/docs/comparisons/workflow-sdk-vs-aws-step-functions.mdx +111 -0
- package/docs/comparisons/workflow-sdk-vs-cloudflare-workflows.mdx +71 -0
- package/docs/comparisons/workflow-sdk-vs-inngest.mdx +102 -0
- package/docs/comparisons/workflow-sdk-vs-temporal.mdx +123 -0
- package/docs/comparisons/workflow-sdk-vs-trigger-dev.mdx +103 -0
- package/docs/configuration/build-and-diagnostics.mdx +70 -0
- package/docs/configuration/cli-and-web-ui.mdx +182 -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 +276 -0
- package/docs/configuration/worlds.mdx +275 -0
- package/docs/cookbook/advanced/child-workflows.mdx +203 -256
- package/docs/cookbook/advanced/meta.json +1 -1
- package/docs/cookbook/advanced/publishing-libraries.mdx +33 -24
- package/docs/cookbook/advanced/serializable-steps.mdx +12 -4
- package/docs/cookbook/advanced/upgrading-workflows.mdx +199 -0
- package/docs/cookbook/agent-patterns/agent-cancellation.mdx +34 -75
- package/docs/cookbook/agent-patterns/durable-agent.mdx +14 -142
- package/docs/cookbook/agent-patterns/human-in-the-loop.mdx +11 -3
- package/docs/cookbook/common-patterns/batching.mdx +4 -0
- package/docs/cookbook/common-patterns/idempotency.mdx +40 -52
- package/docs/cookbook/common-patterns/rate-limiting.mdx +5 -1
- package/docs/cookbook/common-patterns/saga.mdx +6 -2
- package/docs/cookbook/common-patterns/scheduling.mdx +12 -0
- package/docs/cookbook/common-patterns/sequential-and-parallel.mdx +4 -0
- package/docs/cookbook/common-patterns/timeouts.mdx +6 -1
- package/docs/cookbook/common-patterns/webhooks.mdx +4 -0
- package/docs/cookbook/common-patterns/workflow-composition.mdx +19 -16
- package/docs/cookbook/index.mdx +3 -3
- package/docs/cookbook/integrations/ai-sdk.mdx +64 -28
- package/docs/cookbook/integrations/chat-sdk.mdx +17 -0
- package/docs/cookbook/integrations/sandbox.mdx +17 -0
- package/docs/{deploying/index.mdx → deploying.mdx} +7 -7
- package/docs/errors/abort-signal-timeout-in-workflow.mdx +84 -0
- package/docs/errors/corrupted-event-log.mdx +5 -5
- package/docs/errors/deployment-mismatch.mdx +71 -0
- package/docs/errors/fetch-in-workflow.mdx +4 -0
- package/docs/errors/hook-conflict.mdx +60 -4
- package/docs/errors/index.mdx +1 -35
- package/docs/errors/node-js-module-in-workflow.mdx +4 -0
- package/docs/errors/replay-divergence.mdx +27 -0
- package/docs/errors/runtime-decryption-failed.mdx +77 -0
- package/docs/errors/serialization-failed.mdx +4 -0
- package/docs/errors/start-invalid-workflow-function.mdx +4 -0
- package/docs/errors/step-executed-multiple-times.mdx +23 -0
- package/docs/errors/step-not-registered.mdx +1 -1
- package/docs/errors/timeout-in-workflow.mdx +4 -0
- package/docs/errors/webhook-response-not-sent.mdx +4 -0
- 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 +243 -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 +79 -2
- package/docs/foundations/streaming.mdx +14 -23
- package/docs/foundations/versioning.mdx +263 -0
- package/docs/getting-started/astro.mdx +12 -2
- package/docs/getting-started/express.mdx +6 -2
- package/docs/getting-started/fastify.mdx +6 -2
- package/docs/getting-started/hono.mdx +6 -2
- package/docs/getting-started/index.mdx +16 -10
- package/docs/getting-started/meta.json +4 -1
- package/docs/getting-started/nestjs.mdx +77 -3
- package/docs/getting-started/next.mdx +12 -6
- package/docs/getting-started/nitro.mdx +28 -2
- package/docs/getting-started/nuxt.mdx +6 -2
- package/docs/getting-started/python.mdx +24 -18
- package/docs/getting-started/react-router/index.mdx +33 -0
- package/docs/getting-started/react-router/meta.json +5 -0
- package/docs/getting-started/react-router/v7.mdx +237 -0
- package/docs/getting-started/react-router/v8.mdx +232 -0
- package/docs/getting-started/sveltekit.mdx +12 -2
- package/docs/getting-started/tanstack-start.mdx +245 -0
- package/docs/getting-started/vite.mdx +6 -2
- package/docs/how-it-works/cancellation.mdx +287 -0
- package/docs/how-it-works/code-transform.mdx +21 -17
- package/docs/how-it-works/encryption.mdx +5 -5
- package/docs/how-it-works/event-sourcing.mdx +6 -6
- package/docs/how-it-works/framework-integrations.mdx +96 -337
- 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 +2 -2
- package/docs/observability/attributes.mdx +112 -0
- package/docs/observability/index.mdx +20 -1
- package/docs/observability/meta.json +1 -1
- package/docs/observability/tracing.mdx +124 -0
- package/docs/testing/index.mdx +2 -2
- package/package.json +17 -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
- package/docs/deploying/building-a-world.mdx +0 -251
- package/docs/deploying/meta.json +0 -4
- package/docs/deploying/world/local-world.mdx +0 -84
- package/docs/deploying/world/meta.json +0 -4
- package/docs/deploying/world/postgres-world.mdx +0 -222
- package/docs/deploying/world/vercel-world.mdx +0 -179
- package/docs/migration-guides/index.mdx +0 -34
- package/docs/migration-guides/meta.json +0 -9
- package/docs/migration-guides/migrating-from-aws-step-functions.mdx +0 -363
- package/docs/migration-guides/migrating-from-inngest.mdx +0 -314
- package/docs/migration-guides/migrating-from-temporal.mdx +0 -318
- package/docs/migration-guides/migrating-from-trigger-dev.mdx +0 -337
|
@@ -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,363 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: Migrating from AWS Step Functions
|
|
3
|
-
description: Move an AWS Step Functions state machine to the Workflow SDK by replacing JSON state definitions, Task states, Choice/Wait/Parallel states, Retry/Catch blocks, and .waitForTaskToken callbacks with Workflows, Steps, Hooks, and idiomatic TypeScript control flow.
|
|
4
|
-
type: guide
|
|
5
|
-
summary: Translate an AWS Step Functions state machine into the Workflow SDK with side-by-side code examples.
|
|
6
|
-
prerequisites:
|
|
7
|
-
- /docs/getting-started/next
|
|
8
|
-
- /docs/foundations/workflows-and-steps
|
|
9
|
-
related:
|
|
10
|
-
- /docs/foundations/starting-workflows
|
|
11
|
-
- /docs/foundations/errors-and-retries
|
|
12
|
-
- /docs/foundations/hooks
|
|
13
|
-
- /docs/foundations/streaming
|
|
14
|
-
- /docs/deploying/world/vercel-world
|
|
15
|
-
---
|
|
16
|
-
|
|
17
|
-
Move an AWS Step Functions state machine to the Workflow SDK by replacing JSON state definitions with TypeScript functions. This guide shows the direct mapping between ASL states and Workflow SDK primitives.
|
|
18
|
-
|
|
19
|
-
<Callout type="info">
|
|
20
|
-
Install the Workflow SDK migration skill:
|
|
21
|
-
|
|
22
|
-
```bash
|
|
23
|
-
npx skills add https://github.com/vercel/workflow --skill migrating-to-workflow-sdk
|
|
24
|
-
```
|
|
25
|
-
</Callout>
|
|
26
|
-
|
|
27
|
-
## Why migrate to the Workflow SDK
|
|
28
|
-
|
|
29
|
-
- Orchestration code is TypeScript, not JSON ASL. Transitions are `await`, branches are `if`/`switch`, and parallelism is `Promise.all`.
|
|
30
|
-
- Streaming is built in. Write durable progress from steps with `getWritable()` and named streams. No DynamoDB or SNS glue to surface status to clients.
|
|
31
|
-
- Infrastructure lives in one deployment. No separate state machine, per-task Lambda, IAM role wiring, or callback SQS queues.
|
|
32
|
-
- Error handling is TypeScript-native: step-level retries, `RetryableError`, and `FatalError` replace per-state Retry/Catch blocks.
|
|
33
|
-
- The `npx workflow` CLI and `npx workflow web` observability UI ship out of the box.
|
|
34
|
-
- AI/agent helpers — `@workflow/ai` for AI-SDK integration and the Claude migration skill — are available as separate installs.
|
|
35
|
-
|
|
36
|
-
## Before you migrate
|
|
37
|
-
|
|
38
|
-
This guide assumes **Standard** workflows. Express workflows have different semantics (at-least-once, 5-minute max duration, no execution history) and may need a different target — consider keeping them on Step Functions, moving them to a queue consumer, or ensuring your steps are idempotent before replaying the pattern here.
|
|
39
|
-
|
|
40
|
-
## What changes when you leave Step Functions?
|
|
41
|
-
|
|
42
|
-
AWS Step Functions defines workflows as JSON state machines using Amazon States Language (ASL). Each state (Task, Choice, Wait, Parallel, Map) is a node in a declarative graph. Lambda functions handle tasks, Retry/Catch blocks configure per-state error handling, and `.waitForTaskToken` manages callbacks.
|
|
43
|
-
|
|
44
|
-
The Workflow SDK replaces that JSON DSL with TypeScript. `"use workflow"` functions orchestrate `"use step"` functions in the same file. Branching is `if`/`else`. Waiting is `sleep()`. Parallelism is `Promise.all()`. Retries move down to the step level.
|
|
45
|
-
|
|
46
|
-
The migration replaces declarative configuration with idiomatic TypeScript and collapses the orchestrator and compute split. Business logic stays the same.
|
|
47
|
-
|
|
48
|
-
## Concept mapping
|
|
49
|
-
|
|
50
|
-
| AWS Step Functions | Workflow SDK | Migration note |
|
|
51
|
-
| --- | --- | --- |
|
|
52
|
-
| State machine (ASL JSON) | `"use workflow"` function | The workflow function is the state machine. |
|
|
53
|
-
| Task state / Lambda | `"use step"` function | Side effects go in steps. No separate Lambda. |
|
|
54
|
-
| Choice state | `if` / `else` / `switch` | Native TypeScript control flow. |
|
|
55
|
-
| Wait state | `sleep()` | Import `sleep` from `workflow`. |
|
|
56
|
-
| Parallel state | `Promise.all()` | Standard concurrency primitives. |
|
|
57
|
-
| Map state | Inline sequential → `for` loop; bounded parallel (`MaxConcurrency: N`) → batched `Promise.all` or a concurrency limiter like `p-limit`; Distributed Map / large fan-out → step-wrapped `start()` per item, then step-wrapped `getRun()` to collect. | Match the concurrency mode of the original Map. |
|
|
58
|
-
| Retry / Catch | Step retries, `RetryableError`, `FatalError` | Retry logic moves to step boundaries. |
|
|
59
|
-
| `Catch` to a compensation state | `try`/`catch` in the workflow function, calling compensation steps in reverse order (push/pop a rollback stack) | See [`/docs/foundations/errors-and-retries`](/docs/foundations/errors-and-retries) for the SAGA pattern. |
|
|
60
|
-
| `.waitForTaskToken` | `createHook()` or `createWebhook()` | Hooks for typed signals; webhooks for HTTP. |
|
|
61
|
-
| Child state machine (`StartExecution`) | `"use step"` around `start()` / `getRun()` | Return the `Run` object, await its result from another step. |
|
|
62
|
-
| Execution event history | Workflow event log | Same durable replay model. |
|
|
63
|
-
| Progress via DynamoDB / SNS for client polling | `getWritable()` + named streams | Stream durable updates; clients read from the stream. |
|
|
64
|
-
|
|
65
|
-
<Callout type="info">
|
|
66
|
-
`.waitForTaskToken` becomes `createHook()` or `createWebhook()`. Choice states become `if`/`else`. Map states become `Promise.all()`. Retry policies move from per-state configuration to step-level defaults.
|
|
67
|
-
</Callout>
|
|
68
|
-
|
|
69
|
-
## Translate your first workflow
|
|
70
|
-
|
|
71
|
-
Start with a single Task state. In ASL, even "call one Lambda" requires a state machine shell:
|
|
72
|
-
|
|
73
|
-
```json title="stateMachine.asl.json (Step Functions)"
|
|
74
|
-
"LoadOrder": {
|
|
75
|
-
"Type": "Task",
|
|
76
|
-
"Resource": "arn:aws:states:::lambda:invoke",
|
|
77
|
-
"Parameters": { "FunctionName": "loadOrder", "Payload.$": "$" },
|
|
78
|
-
"End": true
|
|
79
|
-
}
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
<Callout type="info">
|
|
83
|
-
Examples use JSONPath mode. If your state machine sets `QueryLanguage: 'JSONata'`, the shape of `Arguments`/`Output` fields differs but the TypeScript translation is identical.
|
|
84
|
-
</Callout>
|
|
85
|
-
|
|
86
|
-
```typescript title="workflow/workflows/order.ts (Workflow SDK)"
|
|
87
|
-
export async function processOrder(orderId: string) {
|
|
88
|
-
'use workflow'; // [!code highlight]
|
|
89
|
-
return await loadOrder(orderId);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
async function loadOrder(orderId: string) {
|
|
93
|
-
'use step'; // [!code highlight]
|
|
94
|
-
const res = await fetch(`https://example.com/api/orders/${orderId}`);
|
|
95
|
-
return res.json() as Promise<{ id: string }>;
|
|
96
|
-
}
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
What changed: the ASL state machine and its Lambda collapse into two directive-tagged functions in one file.
|
|
100
|
-
|
|
101
|
-
### Adding a second step
|
|
102
|
-
|
|
103
|
-
In ASL, a second Task means a new state and a `"Next"` transition. In the Workflow SDK, it's another `await`:
|
|
104
|
-
|
|
105
|
-
```typescript
|
|
106
|
-
export async function processOrder(orderId: string) {
|
|
107
|
-
'use workflow';
|
|
108
|
-
const order = await loadOrder(orderId);
|
|
109
|
-
await reserveInventory(order.id); // [!code highlight]
|
|
110
|
-
return { orderId: order.id, status: 'reserved' };
|
|
111
|
-
}
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
`await` replaces `"Next"`. Each new step is a new function with `"use step"`; no additional deployment. The second version also reshapes the return value; the workflow return type can be anything serializable.
|
|
115
|
-
|
|
116
|
-
### Starting from an API route
|
|
117
|
-
|
|
118
|
-
Step Functions starts a run via `StartExecution` (AWS SDK or API Gateway integration). The Workflow SDK starts a run with `start()` from a route handler:
|
|
119
|
-
|
|
120
|
-
```typescript title="app/api/orders/route.ts"
|
|
121
|
-
import { start } from 'workflow/api';
|
|
122
|
-
import { processOrder } from '@/workflows/order';
|
|
123
|
-
|
|
124
|
-
export async function POST(request: Request) {
|
|
125
|
-
const { orderId } = (await request.json()) as { orderId: string };
|
|
126
|
-
const run = await start(processOrder, [orderId]); // [!code highlight]
|
|
127
|
-
return Response.json({ runId: run.runId });
|
|
128
|
-
}
|
|
129
|
-
```
|
|
130
|
-
|
|
131
|
-
### Waiting for a fixed duration
|
|
132
|
-
|
|
133
|
-
A `Wait` state becomes `sleep()`:
|
|
134
|
-
|
|
135
|
-
```json title="stateMachine.asl.json (Step Functions)"
|
|
136
|
-
{ "Type": "Wait", "Seconds": 60, "Next": "Next" }
|
|
137
|
-
```
|
|
138
|
-
|
|
139
|
-
{/* @skip-typecheck: one-line snippet fragment */}
|
|
140
|
-
|
|
141
|
-
```typescript title="workflow/workflows/order.ts (Workflow SDK)"
|
|
142
|
-
await sleep('1m');
|
|
143
|
-
```
|
|
144
|
-
|
|
145
|
-
## Wait for an external signal
|
|
146
|
-
|
|
147
|
-
The minimal ASL for a callback is a Task with `.waitForTaskToken`:
|
|
148
|
-
|
|
149
|
-
```json title="approval.asl.json (Step Functions)"
|
|
150
|
-
"WaitForApproval": {
|
|
151
|
-
"Type": "Task",
|
|
152
|
-
"Resource": "arn:aws:states:::sqs:sendMessage.waitForTaskToken",
|
|
153
|
-
"Parameters": {
|
|
154
|
-
"QueueUrl": "https://sqs.us-east-1.amazonaws.com/123456789012/approvals",
|
|
155
|
-
"MessageBody": {
|
|
156
|
-
"refundId.$": "$.refundId",
|
|
157
|
-
"TaskToken.$": "$$.Task.Token"
|
|
158
|
-
}
|
|
159
|
-
},
|
|
160
|
-
"End": true
|
|
161
|
-
}
|
|
162
|
-
```
|
|
163
|
-
|
|
164
|
-
```typescript title="workflow/workflows/refund.ts (Workflow SDK)"
|
|
165
|
-
import { createHook } from 'workflow';
|
|
166
|
-
|
|
167
|
-
export async function refundWorkflow(refundId: string) {
|
|
168
|
-
'use workflow';
|
|
169
|
-
using approval = createHook<{ approved: boolean }>({ // [!code highlight]
|
|
170
|
-
token: `refund:${refundId}:approval`,
|
|
171
|
-
});
|
|
172
|
-
return await approval;
|
|
173
|
-
}
|
|
174
|
-
```
|
|
175
|
-
|
|
176
|
-
What changed: no SQS queue, no task token, no callback Lambda. The hook suspends the workflow durably until it is resumed.
|
|
177
|
-
|
|
178
|
-
### Resuming the hook
|
|
179
|
-
|
|
180
|
-
Step Functions resumes by calling `SendTaskSuccess` with the task token. The Workflow SDK resumes by calling `resumeHook` with the hook's token:
|
|
181
|
-
|
|
182
|
-
```typescript title="app/api/refunds/[refundId]/approve/route.ts"
|
|
183
|
-
import { resumeHook } from 'workflow/api';
|
|
184
|
-
|
|
185
|
-
export async function POST(req: Request, { params }: { params: Promise<{ refundId: string }> }) {
|
|
186
|
-
const { refundId } = await params;
|
|
187
|
-
const { approved } = (await req.json()) as { approved: boolean };
|
|
188
|
-
await resumeHook(`refund:${refundId}:approval`, { approved }); // [!code highlight]
|
|
189
|
-
return Response.json({ ok: true });
|
|
190
|
-
}
|
|
191
|
-
```
|
|
192
|
-
|
|
193
|
-
### Branching on the result
|
|
194
|
-
|
|
195
|
-
In ASL, branching after the wait requires a Choice state. In TypeScript, it's just `if`/`else`:
|
|
196
|
-
|
|
197
|
-
```json title="approval.asl.json (Step Functions)"
|
|
198
|
-
"CheckApproval": {
|
|
199
|
-
"Type": "Choice",
|
|
200
|
-
"Choices": [
|
|
201
|
-
{ "Variable": "$.approved", "BooleanEquals": true, "Next": "Approved" }
|
|
202
|
-
],
|
|
203
|
-
"Default": "Rejected"
|
|
204
|
-
}
|
|
205
|
-
```
|
|
206
|
-
|
|
207
|
-
{/* @skip-typecheck: continuation snippet */}
|
|
208
|
-
```typescript title="workflow/workflows/refund.ts (Workflow SDK)"
|
|
209
|
-
const { approved } = await approval;
|
|
210
|
-
if (approved) return { refundId, status: 'approved' }; // [!code highlight]
|
|
211
|
-
return { refundId, status: 'rejected' };
|
|
212
|
-
```
|
|
213
|
-
|
|
214
|
-
## Spawn a child workflow
|
|
215
|
-
|
|
216
|
-
In ASL, a parent machine calls `StartExecution` (usually via `.sync` or `.waitForTaskToken`) to launch a child. In the Workflow SDK, `start()` and `getRun()` are runtime APIs, so wrap them in `"use step"` functions. Returning the `Run` object from the spawn step lets workflow observability deep-link to the child run.
|
|
217
|
-
|
|
218
|
-
### Parent starts a child
|
|
219
|
-
|
|
220
|
-
```typescript title="workflow/workflows/parent.ts"
|
|
221
|
-
import { start } from 'workflow/api';
|
|
222
|
-
|
|
223
|
-
async function spawnChild(item: string) {
|
|
224
|
-
'use step'; // [!code highlight]
|
|
225
|
-
return await start(childWorkflow, [item]);
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
export async function parentWorkflow(item: string) {
|
|
229
|
-
'use workflow';
|
|
230
|
-
const run = await spawnChild(item);
|
|
231
|
-
return { childRunId: run.runId };
|
|
232
|
-
}
|
|
233
|
-
```
|
|
234
|
-
|
|
235
|
-
### Awaiting the child's result
|
|
236
|
-
|
|
237
|
-
Add a second step that wraps `getRun()` and awaits `returnValue`:
|
|
238
|
-
|
|
239
|
-
```typescript
|
|
240
|
-
import { getRun } from 'workflow/api';
|
|
241
|
-
|
|
242
|
-
async function collectResult(runId: string) {
|
|
243
|
-
'use step'; // [!code highlight]
|
|
244
|
-
const run = getRun(runId);
|
|
245
|
-
return (await run.returnValue) as { item: string; result: string };
|
|
246
|
-
}
|
|
247
|
-
```
|
|
248
|
-
|
|
249
|
-
Then in the workflow: `const result = await collectResult(run.runId);`. The child workflow itself (`childWorkflow`) is defined elsewhere with `"use workflow"`.
|
|
250
|
-
|
|
251
|
-
## What you stop operating
|
|
252
|
-
|
|
253
|
-
Moving off Step Functions removes these surfaces from the application:
|
|
254
|
-
|
|
255
|
-
- ASL state machine JSON and its reference syntax.
|
|
256
|
-
- Per-task Lambda functions, their IAM roles, and CloudFormation/CDK wiring.
|
|
257
|
-
- Task-token delivery infrastructure (SQS queues, callback Lambdas).
|
|
258
|
-
- Separate progress channels (DynamoDB, SNS) for client-visible updates.
|
|
259
|
-
- Remove CloudWatch and X-Ray wiring that was specific to orchestrator state transitions. Keep (or re-wire) any application-level CloudWatch alarms, log retention policies, or X-Ray propagation that the rest of your AWS footprint still depends on. Workflow SDK exports OTEL traces, so existing OTEL-compatible backends can continue to ingest them.
|
|
260
|
-
|
|
261
|
-
Workflow and step functions live in the same deployment as the application. State transitions are ordinary control flow (`await`, `if`, `Promise.all`, `for`). Progress streaming, retries, and observability are built in.
|
|
262
|
-
|
|
263
|
-
### What you take on
|
|
264
|
-
|
|
265
|
-
Steps that previously invoked AWS services via optimized integrations (EventBridge, DynamoDB, Bedrock, ECS.RunTask.sync, etc.) become ordinary SDK calls inside `'use step'` functions. Credentials and retries move into the step, and `.sync`-style waits for long-running jobs become explicit polling loops or hook-based callbacks.
|
|
266
|
-
|
|
267
|
-
## Step-by-step first migration
|
|
268
|
-
|
|
269
|
-
Pick one state machine and migrate it end-to-end before touching the rest. The steps below describe the smallest viable path.
|
|
270
|
-
|
|
271
|
-
### Step 1: Install the Workflow SDK
|
|
272
|
-
|
|
273
|
-
Add the `workflow` runtime package.
|
|
274
|
-
|
|
275
|
-
```bash
|
|
276
|
-
pnpm add workflow
|
|
277
|
-
```
|
|
278
|
-
|
|
279
|
-
### Step 2: Rewrite the state machine as a `"use workflow"` function
|
|
280
|
-
|
|
281
|
-
Transitions become `await` calls. Control flow (`Choice`, `Wait`, `Parallel`, `Map`) becomes `if`/`switch`, `sleep`, `Promise.all`, and loops.
|
|
282
|
-
|
|
283
|
-
```ts title="workflows/order.ts"
|
|
284
|
-
export async function processOrder(orderId: string) {
|
|
285
|
-
"use workflow"; // [!code highlight]
|
|
286
|
-
const order = await loadOrder(orderId);
|
|
287
|
-
if (order.total > 1000) await reviewManually(order);
|
|
288
|
-
await chargePayment(order);
|
|
289
|
-
}
|
|
290
|
-
```
|
|
291
|
-
|
|
292
|
-
### Step 3: Move each Lambda into a step function
|
|
293
|
-
|
|
294
|
-
Inline the Lambda body into a function with `"use step"` on the first line. Step functions keep full Node.js access, so existing SDK calls work unchanged.
|
|
295
|
-
|
|
296
|
-
```ts
|
|
297
|
-
async function loadOrder(id: string) {
|
|
298
|
-
"use step"; // [!code highlight]
|
|
299
|
-
return fetch(`/api/orders/${id}`).then((r) => r.json());
|
|
300
|
-
}
|
|
301
|
-
```
|
|
302
|
-
|
|
303
|
-
### Step 4: Replace `.waitForTaskToken` with a hook
|
|
304
|
-
|
|
305
|
-
Swap the task-token callback Lambda for `createHook()`. Callers `resumeHook(token, payload)` instead of `SendTaskSuccess`.
|
|
306
|
-
|
|
307
|
-
Move Retry/Catch off per-state configuration and onto step boundaries. Set `maxRetries` as a function property; throw `RetryableError` or `FatalError` to control retry behavior:
|
|
308
|
-
|
|
309
|
-
```typescript
|
|
310
|
-
async function chargePayment(orderId: string) {
|
|
311
|
-
"use step";
|
|
312
|
-
// ...
|
|
313
|
-
}
|
|
314
|
-
chargePayment.maxRetries = 5;
|
|
315
|
-
```
|
|
316
|
-
|
|
317
|
-
See [`/docs/foundations/errors-and-retries`](/docs/foundations/errors-and-retries) for the full retry and SAGA compensation patterns.
|
|
318
|
-
|
|
319
|
-
### Step 5: Start runs from an API route
|
|
320
|
-
|
|
321
|
-
Delete the `StartExecution` call and IAM wiring. Launch runs directly from a route handler:
|
|
322
|
-
|
|
323
|
-
```ts title="app/api/orders/route.ts"
|
|
324
|
-
import { start } from "workflow/api";
|
|
325
|
-
import { processOrder } from "@/workflows/order";
|
|
326
|
-
|
|
327
|
-
export async function POST(req: Request) {
|
|
328
|
-
const { orderId } = await req.json();
|
|
329
|
-
const run = await start(processOrder, [orderId]);
|
|
330
|
-
return Response.json({ runId: run.runId });
|
|
331
|
-
}
|
|
332
|
-
```
|
|
333
|
-
|
|
334
|
-
### Step 6: Retire the Step Functions infrastructure
|
|
335
|
-
|
|
336
|
-
Delete the ASL JSON, per-task Lambda deployments, IAM roles, and callback queues. Remove CloudWatch and X-Ray wiring that was specific to orchestrator state transitions — keep alarms, log retention, and traces for resources you still depend on. Verify the run in `npx workflow web` before shipping.
|
|
337
|
-
|
|
338
|
-
## Features without a 1:1 equivalent
|
|
339
|
-
|
|
340
|
-
- **Express workflows.** At-least-once semantics and 5-minute duration make them a poor fit for the SDK's durable replay model. Consider keeping them on Step Functions or migrating to a queue consumer.
|
|
341
|
-
- **Distributed Map state.** Up to 10,000 concurrent child executions with S3 item sources has no 1:1 analog; fan out with step-wrapped `start()` per item, then `Promise.all` with `p-limit` to bound concurrency.
|
|
342
|
-
- **Optimized AWS service integrations (`arn:aws:states:::dynamodb:*`, `eventbridge:*`, `bedrock:*`, `ecs:runTask.sync`, etc.).** These become regular SDK calls inside `'use step'` functions — credentials, retries, and polling move into the step.
|
|
343
|
-
- **Per-state IAM roles.** ASL lets each state run under its own IAM role. In the SDK, all steps share the deployment's credentials; scope secrets and roles at deployment time.
|
|
344
|
-
- **CloudWatch alarms / X-Ray cross-service traces / CloudWatch Logs retention.** The SDK event log + observability UI replaces orchestrator state transitions, not AWS-wide observability. Keep alarms and traces for other resources.
|
|
345
|
-
- **`JSONata` `QueryLanguage` mode.** Valid at the source; the TS translation is identical regardless of mode.
|
|
346
|
-
|
|
347
|
-
## Quick-start checklist
|
|
348
|
-
|
|
349
|
-
- Replace the ASL state machine with a single `"use workflow"` function. Transitions become `await` calls.
|
|
350
|
-
- Convert each Task / Lambda into a `"use step"` function in the same file.
|
|
351
|
-
- Replace Choice states with `if`/`else`/`switch`.
|
|
352
|
-
- Replace Wait states with `sleep()` from `workflow`.
|
|
353
|
-
- Replace Parallel states with `Promise.all()`.
|
|
354
|
-
- Replace Map states based on their concurrency mode: inline sequential → `for` loop; bounded parallel (`MaxConcurrency: N`) → batched `Promise.all` or a concurrency limiter like `p-limit`; Distributed Map / large fan-out → step-wrapped `start()` per item, then step-wrapped `getRun()` to collect.
|
|
355
|
-
- Replace `StartExecution` child machines with `"use step"` wrappers around `start()` and `getRun()`.
|
|
356
|
-
- Replace `.waitForTaskToken` with `createHook()` (internal callers) or `createWebhook()` (HTTP callers).
|
|
357
|
-
- Move Retry/Catch to step boundaries using `maxRetries`, `RetryableError`, and `FatalError`.
|
|
358
|
-
- Use `getStepMetadata().stepId` as the idempotency key for external side effects.
|
|
359
|
-
- Stream progress from steps with `getWritable()` instead of polling DynamoDB or SNS.
|
|
360
|
-
- Deploy and verify runs end-to-end with built-in observability.
|
|
361
|
-
|
|
362
|
-
---
|
|
363
|
-
*Verified against `workflow@5.0.0-beta.1` and the AWS Step Functions Amazon States Language spec on 2026-04-16.*
|