workflow 4.2.0-beta.72 → 4.2.0-beta.74
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 +6 -6
- package/docs/ai/defining-tools.mdx +2 -2
- package/docs/ai/human-in-the-loop.mdx +1 -1
- package/docs/ai/index.mdx +8 -8
- package/docs/ai/resumable-streams.mdx +1 -1
- package/docs/ai/sleep-and-delays.mdx +2 -2
- package/docs/ai/streaming-updates-from-tools.mdx +1 -1
- package/docs/api-reference/index.mdx +9 -3
- package/docs/api-reference/meta.json +10 -1
- package/docs/api-reference/workflow/index.mdx +2 -2
- package/docs/api-reference/workflow-ai/durable-agent.mdx +1 -1
- package/docs/api-reference/workflow-globals.mdx +102 -0
- package/docs/api-reference/workflow-next/index.mdx +1 -1
- package/docs/api-reference/workflow-serde/index.mdx +2 -2
- package/docs/changelog/index.mdx +2 -2
- package/docs/deploying/building-a-world.mdx +1 -1
- package/docs/deploying/world/postgres-world.mdx +7 -0
- package/docs/deploying/world/vercel-world.mdx +20 -13
- package/docs/errors/index.mdx +1 -1
- package/docs/errors/node-js-module-in-workflow.mdx +1 -1
- package/docs/errors/serialization-failed.mdx +1 -1
- package/docs/errors/start-invalid-workflow-function.mdx +3 -3
- package/docs/foundations/errors-and-retries.mdx +1 -1
- package/docs/foundations/hooks.mdx +1 -1
- package/docs/foundations/serialization.mdx +2 -2
- package/docs/foundations/streaming.mdx +2 -2
- package/docs/foundations/workflows-and-steps.mdx +2 -2
- package/docs/getting-started/astro.mdx +5 -5
- package/docs/getting-started/express.mdx +5 -5
- package/docs/getting-started/fastify.mdx +5 -5
- package/docs/getting-started/hono.mdx +5 -5
- package/docs/getting-started/nestjs.mdx +5 -5
- package/docs/getting-started/next.mdx +5 -5
- package/docs/getting-started/nitro.mdx +5 -5
- package/docs/getting-started/nuxt.mdx +5 -5
- package/docs/getting-started/sveltekit.mdx +5 -5
- package/docs/getting-started/vite.mdx +5 -5
- package/docs/how-it-works/code-transform.mdx +6 -6
- package/docs/how-it-works/encryption.mdx +3 -3
- package/docs/how-it-works/event-sourcing.mdx +5 -5
- package/docs/how-it-works/framework-integrations.mdx +9 -9
- package/docs/how-it-works/understanding-directives.mdx +11 -11
- package/docs/observability/index.mdx +5 -5
- package/docs/testing/index.mdx +5 -5
- package/package.json +11 -11
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
title: Astro
|
|
3
3
|
description: Set up your first durable workflow in an Astro application.
|
|
4
4
|
type: guide
|
|
5
|
-
summary: Set up Workflow
|
|
5
|
+
summary: Set up Workflow SDK in an Astro app.
|
|
6
6
|
prerequisites:
|
|
7
7
|
- /docs/getting-started
|
|
8
8
|
related:
|
|
@@ -105,7 +105,7 @@ export async function handleUserSignup(email: string) {
|
|
|
105
105
|
We'll fill in those functions next, but let's take a look at this code:
|
|
106
106
|
|
|
107
107
|
* We define a **workflow** function with the directive `"use workflow"`. Think of the workflow function as the _orchestrator_ of individual **steps**.
|
|
108
|
-
* The Workflow
|
|
108
|
+
* The Workflow SDK's `sleep` function allows us to suspend execution of the workflow without using up any resources. A sleep can be a few seconds, hours, days, or even months long.
|
|
109
109
|
|
|
110
110
|
## Create Your Workflow Steps
|
|
111
111
|
|
|
@@ -210,20 +210,20 @@ curl -X POST --json '{"email":"hello@example.com"}' http://localhost:4321/api/si
|
|
|
210
210
|
|
|
211
211
|
Check the Astro development server logs to see your workflow execute as well as the steps that are being processed.
|
|
212
212
|
|
|
213
|
-
Additionally, you can use the [Workflow
|
|
213
|
+
Additionally, you can use the [Workflow SDK CLI or Web UI](/docs/observability) to inspect your workflow runs and steps in detail.
|
|
214
214
|
|
|
215
215
|
```bash
|
|
216
216
|
npx workflow inspect runs
|
|
217
217
|
# or add '--web' for an interactive Web based UI
|
|
218
218
|
```
|
|
219
219
|
|
|
220
|
-

|
|
221
221
|
|
|
222
222
|
---
|
|
223
223
|
|
|
224
224
|
## Deploying to Production
|
|
225
225
|
|
|
226
|
-
Workflow
|
|
226
|
+
Workflow SDK apps currently work best when deployed to [Vercel](https://vercel.com/home) and needs no special configuration.
|
|
227
227
|
|
|
228
228
|
<FluidComputeCallout />
|
|
229
229
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
title: Express
|
|
3
3
|
description: Set up your first durable workflow in an Express application.
|
|
4
4
|
type: guide
|
|
5
|
-
summary: Set up Workflow
|
|
5
|
+
summary: Set up Workflow SDK in an Express app.
|
|
6
6
|
prerequisites:
|
|
7
7
|
- /docs/getting-started
|
|
8
8
|
related:
|
|
@@ -136,7 +136,7 @@ export async function handleUserSignup(email: string) {
|
|
|
136
136
|
We'll fill in those functions next, but let's take a look at this code:
|
|
137
137
|
|
|
138
138
|
- We define a **workflow** function with the directive `"use workflow"`. Think of the workflow function as the _orchestrator_ of individual **steps**.
|
|
139
|
-
- The Workflow
|
|
139
|
+
- The Workflow SDK's `sleep` function allows us to suspend execution of the workflow without using up any resources. A sleep can be a few seconds, hours, days, or even months long.
|
|
140
140
|
|
|
141
141
|
## Create Your Workflow Steps
|
|
142
142
|
|
|
@@ -237,7 +237,7 @@ curl -X POST --json '{"email":"hello@example.com"}' http://localhost:3000/api/si
|
|
|
237
237
|
|
|
238
238
|
Check the Express development server logs to see your workflow execute as well as the steps that are being processed.
|
|
239
239
|
|
|
240
|
-
Additionally, you can use the [Workflow
|
|
240
|
+
Additionally, you can use the [Workflow SDK CLI or Web UI](/docs/observability) to inspect your workflow runs and steps in detail.
|
|
241
241
|
|
|
242
242
|
```bash
|
|
243
243
|
# Open the observability Web UI
|
|
@@ -246,7 +246,7 @@ npx workflow web
|
|
|
246
246
|
npx workflow inspect runs
|
|
247
247
|
```
|
|
248
248
|
|
|
249
|
-

|
|
250
250
|
|
|
251
251
|
</Step>
|
|
252
252
|
|
|
@@ -256,7 +256,7 @@ npx workflow inspect runs
|
|
|
256
256
|
|
|
257
257
|
## Deploying to production
|
|
258
258
|
|
|
259
|
-
Workflow
|
|
259
|
+
Workflow SDK apps currently work best when deployed to [Vercel](https://vercel.com/home) and needs no special configuration.
|
|
260
260
|
|
|
261
261
|
<FluidComputeCallout />
|
|
262
262
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
title: Fastify
|
|
3
3
|
description: Set up your first durable workflow in a Fastify application.
|
|
4
4
|
type: guide
|
|
5
|
-
summary: Set up Workflow
|
|
5
|
+
summary: Set up Workflow SDK in a Fastify app.
|
|
6
6
|
prerequisites:
|
|
7
7
|
- /docs/getting-started
|
|
8
8
|
related:
|
|
@@ -135,7 +135,7 @@ export async function handleUserSignup(email: string) {
|
|
|
135
135
|
We'll fill in those functions next, but let's take a look at this code:
|
|
136
136
|
|
|
137
137
|
- We define a **workflow** function with the directive `"use workflow"`. Think of the workflow function as the _orchestrator_ of individual **steps**.
|
|
138
|
-
- The Workflow
|
|
138
|
+
- The Workflow SDK's `sleep` function allows us to suspend execution of the workflow without using up any resources. A sleep can be a few seconds, hours, days, or even months long.
|
|
139
139
|
## Create Your Workflow Steps
|
|
140
140
|
|
|
141
141
|
Let's now define those missing functions:
|
|
@@ -227,13 +227,13 @@ curl -X POST --json '{"email":"hello@example.com"}' http://localhost:3000/api/si
|
|
|
227
227
|
|
|
228
228
|
Check the Fastify development server logs to see your workflow execute as well as the steps that are being processed.
|
|
229
229
|
|
|
230
|
-
Additionally, you can use the [Workflow
|
|
230
|
+
Additionally, you can use the [Workflow SDK CLI or Web UI](/docs/observability) to inspect your workflow runs and steps in detail.
|
|
231
231
|
|
|
232
232
|
```bash
|
|
233
233
|
npx workflow inspect runs # add '--web' for an interactive Web based UI
|
|
234
234
|
```
|
|
235
235
|
|
|
236
|
-

|
|
237
237
|
|
|
238
238
|
</Step>
|
|
239
239
|
|
|
@@ -243,7 +243,7 @@ npx workflow inspect runs # add '--web' for an interactive Web based UI
|
|
|
243
243
|
|
|
244
244
|
## Deploying to production
|
|
245
245
|
|
|
246
|
-
Workflow
|
|
246
|
+
Workflow SDK apps currently work best when deployed to [Vercel](https://vercel.com/home) and needs no special configuration.
|
|
247
247
|
|
|
248
248
|
<FluidComputeCallout />
|
|
249
249
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
title: Hono
|
|
3
3
|
description: This guide will walk through setting up your first workflow in a Hono app. Along the way, you'll learn more about the concepts that are fundamental to using the development kit in your own projects.
|
|
4
4
|
type: guide
|
|
5
|
-
summary: Set up Workflow
|
|
5
|
+
summary: Set up Workflow SDK in a Hono app.
|
|
6
6
|
prerequisites:
|
|
7
7
|
- /docs/getting-started
|
|
8
8
|
related:
|
|
@@ -121,7 +121,7 @@ export async function handleUserSignup(email: string) {
|
|
|
121
121
|
We'll fill in those functions next, but let's take a look at this code:
|
|
122
122
|
|
|
123
123
|
- We define a **workflow** function with the directive `"use workflow"`. Think of the workflow function as the _orchestrator_ of individual **steps**.
|
|
124
|
-
- The Workflow
|
|
124
|
+
- The Workflow SDK's `sleep` function allows us to suspend execution of the workflow without using up any resources. A sleep can be a few seconds, hours, days, or even months long.
|
|
125
125
|
|
|
126
126
|
## Create Your Workflow Steps
|
|
127
127
|
|
|
@@ -221,7 +221,7 @@ curl -X POST --json '{"email":"hello@example.com"}' http://localhost:3000/api/si
|
|
|
221
221
|
|
|
222
222
|
Check the Hono development server logs to see your workflow execute as well as the steps that are being processed.
|
|
223
223
|
|
|
224
|
-
Additionally, you can use the [Workflow
|
|
224
|
+
Additionally, you can use the [Workflow SDK CLI or Web UI](/docs/observability) to inspect your workflow runs and steps in detail.
|
|
225
225
|
|
|
226
226
|
```bash
|
|
227
227
|
# Open the observability Web UI
|
|
@@ -230,7 +230,7 @@ npx workflow web
|
|
|
230
230
|
npx workflow inspect runs
|
|
231
231
|
```
|
|
232
232
|
|
|
233
|
-

|
|
234
234
|
|
|
235
235
|
</Step>
|
|
236
236
|
|
|
@@ -238,7 +238,7 @@ npx workflow inspect runs
|
|
|
238
238
|
|
|
239
239
|
## Deploying to production
|
|
240
240
|
|
|
241
|
-
Workflow
|
|
241
|
+
Workflow SDK apps currently work best when deployed to [Vercel](https://vercel.com/home) and needs no special configuration.
|
|
242
242
|
|
|
243
243
|
<FluidComputeCallout />
|
|
244
244
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
title: NestJS
|
|
3
3
|
description: Set up your first durable workflow in a NestJS application.
|
|
4
4
|
type: guide
|
|
5
|
-
summary: Set up Workflow
|
|
5
|
+
summary: Set up Workflow SDK in a NestJS app.
|
|
6
6
|
prerequisites:
|
|
7
7
|
- /docs/getting-started
|
|
8
8
|
related:
|
|
@@ -59,7 +59,7 @@ When using ESM with NestJS, local imports must include the `.js` extension (e.g.
|
|
|
59
59
|
|
|
60
60
|
### Configure NestJS to use SWC
|
|
61
61
|
|
|
62
|
-
NestJS supports SWC as an alternative compiler for faster builds. The Workflow
|
|
62
|
+
NestJS supports SWC as an alternative compiler for faster builds. The Workflow SDK uses an SWC plugin to transform workflow files.
|
|
63
63
|
|
|
64
64
|
Install the required SWC packages:
|
|
65
65
|
|
|
@@ -190,7 +190,7 @@ export async function handleUserSignup(email: string) {
|
|
|
190
190
|
We'll fill in those functions next, but let's take a look at this code:
|
|
191
191
|
|
|
192
192
|
- We define a **workflow** function with the directive `"use workflow"`. Think of the workflow function as the _orchestrator_ of individual **steps**.
|
|
193
|
-
- The Workflow
|
|
193
|
+
- The Workflow SDK's `sleep` function allows us to suspend execution of the workflow without using up any resources. A sleep can be a few seconds, hours, days, or even months long.
|
|
194
194
|
|
|
195
195
|
## Create Your Workflow Steps
|
|
196
196
|
|
|
@@ -291,7 +291,7 @@ curl -X POST -H "Content-Type: application/json" -d '{"email":"hello@example.com
|
|
|
291
291
|
|
|
292
292
|
Check the NestJS development server logs to see your workflow execute as well as the steps that are being processed.
|
|
293
293
|
|
|
294
|
-
Additionally, you can use the [Workflow
|
|
294
|
+
Additionally, you can use the [Workflow SDK CLI or Web UI](/docs/observability) to inspect your workflow runs and steps in detail.
|
|
295
295
|
|
|
296
296
|
```bash
|
|
297
297
|
# Open the observability Web UI
|
|
@@ -300,7 +300,7 @@ npx workflow web
|
|
|
300
300
|
npx workflow inspect runs
|
|
301
301
|
```
|
|
302
302
|
|
|
303
|
-

|
|
304
304
|
|
|
305
305
|
</Step>
|
|
306
306
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
title: Next.js
|
|
3
3
|
description: This guide will walk through setting up your first workflow in a Next.js app. Along the way, you'll learn more about the concepts that are fundamental to using the development kit in your own projects.
|
|
4
4
|
type: guide
|
|
5
|
-
summary: Set up Workflow
|
|
5
|
+
summary: Set up Workflow SDK in a Next.js app.
|
|
6
6
|
prerequisites:
|
|
7
7
|
- /docs/getting-started
|
|
8
8
|
related:
|
|
@@ -141,7 +141,7 @@ export async function handleUserSignup(email: string) {
|
|
|
141
141
|
We'll fill in those functions next, but let's take a look at this code:
|
|
142
142
|
|
|
143
143
|
* We define a **workflow** function with the directive `"use workflow"`. Think of the workflow function as the _orchestrator_ of individual **steps**.
|
|
144
|
-
* The Workflow
|
|
144
|
+
* The Workflow SDK's `sleep` function allows us to suspend execution of the workflow without using up any resources. A sleep can be a few seconds, hours, days, or even months long.
|
|
145
145
|
|
|
146
146
|
## Create Your Workflow Steps
|
|
147
147
|
|
|
@@ -245,7 +245,7 @@ curl -X POST --json '{"email":"hello@example.com"}' http://localhost:3000/api/si
|
|
|
245
245
|
|
|
246
246
|
Check the Next.js development server logs to see your workflow execute, as well as the steps that are being processed.
|
|
247
247
|
|
|
248
|
-
Additionally, you can use the [Workflow
|
|
248
|
+
Additionally, you can use the [Workflow SDK CLI or Web UI](/docs/observability) to inspect your workflow runs and steps in detail.
|
|
249
249
|
|
|
250
250
|
```bash
|
|
251
251
|
# Open the observability Web UI
|
|
@@ -254,11 +254,11 @@ npx workflow web
|
|
|
254
254
|
npx workflow inspect runs
|
|
255
255
|
```
|
|
256
256
|
|
|
257
|
-

|
|
258
258
|
|
|
259
259
|
## Deploying to production
|
|
260
260
|
|
|
261
|
-
Workflow
|
|
261
|
+
Workflow SDK apps currently work best when deployed to [Vercel](https://vercel.com/home) and need no special configuration.
|
|
262
262
|
|
|
263
263
|
<FluidComputeCallout />
|
|
264
264
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
title: Nitro
|
|
3
3
|
description: This guide will walk through setting up your first workflow in a Nitro v3 project. Along the way, you'll learn more about the concepts that are fundamental to using the development kit in your own projects.
|
|
4
4
|
type: guide
|
|
5
|
-
summary: Set up Workflow
|
|
5
|
+
summary: Set up Workflow SDK in a Nitro app.
|
|
6
6
|
prerequisites:
|
|
7
7
|
- /docs/getting-started
|
|
8
8
|
related:
|
|
@@ -101,7 +101,7 @@ export async function handleUserSignup(email: string) {
|
|
|
101
101
|
We'll fill in those functions next, but let's take a look at this code:
|
|
102
102
|
|
|
103
103
|
- We define a **workflow** function with the directive `"use workflow"`. Think of the workflow function as the _orchestrator_ of individual **steps**.
|
|
104
|
-
- The Workflow
|
|
104
|
+
- The Workflow SDK's `sleep` function allows us to suspend execution of the workflow without using up any resources. A sleep can be a few seconds, hours, days, or even months long.
|
|
105
105
|
|
|
106
106
|
## Create Your Workflow Steps
|
|
107
107
|
|
|
@@ -205,7 +205,7 @@ curl -X POST --json '{"email":"hello@example.com"}' http://localhost:3000/api/si
|
|
|
205
205
|
|
|
206
206
|
Check the Nitro development server logs to see your workflow execute as well as the steps that are being processed.
|
|
207
207
|
|
|
208
|
-
Additionally, you can use the [Workflow
|
|
208
|
+
Additionally, you can use the [Workflow SDK CLI or Web UI](/docs/observability) to inspect your workflow runs and steps in detail.
|
|
209
209
|
|
|
210
210
|
```bash
|
|
211
211
|
# Open the observability Web UI
|
|
@@ -214,7 +214,7 @@ npx workflow web
|
|
|
214
214
|
npx workflow inspect runs
|
|
215
215
|
```
|
|
216
216
|
|
|
217
|
-

|
|
218
218
|
|
|
219
219
|
</Step>
|
|
220
220
|
|
|
@@ -222,7 +222,7 @@ npx workflow inspect runs
|
|
|
222
222
|
|
|
223
223
|
## Deploying to production
|
|
224
224
|
|
|
225
|
-
Workflow
|
|
225
|
+
Workflow SDK apps currently work best when deployed to [Vercel](https://vercel.com/home) and needs no special configuration.
|
|
226
226
|
|
|
227
227
|
<FluidComputeCallout />
|
|
228
228
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
title: Nuxt
|
|
3
3
|
description: This guide will walk through setting up your first workflow in a Nuxt app. Along the way, you'll learn more about the concepts that are fundamental to using the development kit in your own projects.
|
|
4
4
|
type: guide
|
|
5
|
-
summary: Set up Workflow
|
|
5
|
+
summary: Set up Workflow SDK in a Nuxt app.
|
|
6
6
|
prerequisites:
|
|
7
7
|
- /docs/getting-started
|
|
8
8
|
related:
|
|
@@ -100,7 +100,7 @@ export async function handleUserSignup(email: string) {
|
|
|
100
100
|
We'll fill in those functions next, but let's take a look at this code:
|
|
101
101
|
|
|
102
102
|
- We define a **workflow** function with the directive `"use workflow"`. Think of the workflow function as the _orchestrator_ of individual **steps**.
|
|
103
|
-
- The Workflow
|
|
103
|
+
- The Workflow SDK's `sleep` function allows us to suspend execution of the workflow without using up any resources. A sleep can be a few seconds, hours, days, or even months long.
|
|
104
104
|
|
|
105
105
|
## Create Your Workflow Steps
|
|
106
106
|
|
|
@@ -206,7 +206,7 @@ curl -X POST --json '{"email":"hello@example.com"}' http://localhost:3000/api/si
|
|
|
206
206
|
|
|
207
207
|
Check the Nuxt development server logs to see your workflow execute as well as the steps that are being processed.
|
|
208
208
|
|
|
209
|
-
Additionally, you can use the [Workflow
|
|
209
|
+
Additionally, you can use the [Workflow SDK CLI or Web UI](/docs/observability) to inspect your workflow runs and steps in detail.
|
|
210
210
|
|
|
211
211
|
```bash
|
|
212
212
|
# Open the observability Web UI
|
|
@@ -215,7 +215,7 @@ npx workflow web
|
|
|
215
215
|
npx workflow inspect runs
|
|
216
216
|
```
|
|
217
217
|
|
|
218
|
-

|
|
219
219
|
|
|
220
220
|
</Step>
|
|
221
221
|
|
|
@@ -223,7 +223,7 @@ npx workflow inspect runs
|
|
|
223
223
|
|
|
224
224
|
## Deploying to production
|
|
225
225
|
|
|
226
|
-
Workflow
|
|
226
|
+
Workflow SDK apps currently work best when deployed to [Vercel](https://vercel.com/home) and needs no special configuration.
|
|
227
227
|
|
|
228
228
|
<FluidComputeCallout />
|
|
229
229
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
title: SvelteKit
|
|
3
3
|
description: This guide will walk through setting up your first workflow in a SvelteKit app. Along the way, you'll learn more about the concepts that are fundamental to using the development kit in your own projects.
|
|
4
4
|
type: guide
|
|
5
|
-
summary: Set up Workflow
|
|
5
|
+
summary: Set up Workflow SDK in a SvelteKit app.
|
|
6
6
|
prerequisites:
|
|
7
7
|
- /docs/getting-started
|
|
8
8
|
related:
|
|
@@ -102,7 +102,7 @@ export async function handleUserSignup(email: string) {
|
|
|
102
102
|
We'll fill in those functions next, but let's take a look at this code:
|
|
103
103
|
|
|
104
104
|
* We define a **workflow** function with the directive `"use workflow"`. Think of the workflow function as the _orchestrator_ of individual **steps**.
|
|
105
|
-
* The Workflow
|
|
105
|
+
* The Workflow SDK's `sleep` function allows us to suspend execution of the workflow without using up any resources. A sleep can be a few seconds, hours, days, or even months long.
|
|
106
106
|
|
|
107
107
|
## Create Your Workflow Steps
|
|
108
108
|
|
|
@@ -209,7 +209,7 @@ curl -X POST --json '{"email":"hello@example.com"}' http://localhost:5173/api/si
|
|
|
209
209
|
|
|
210
210
|
Check the SvelteKit development server logs to see your workflow execute as well as the steps that are being processed.
|
|
211
211
|
|
|
212
|
-
Additionally, you can use the [Workflow
|
|
212
|
+
Additionally, you can use the [Workflow SDK CLI or Web UI](/docs/observability) to inspect your workflow runs and steps in detail.
|
|
213
213
|
|
|
214
214
|
```bash
|
|
215
215
|
# Open the observability Web UI
|
|
@@ -218,11 +218,11 @@ npx workflow web
|
|
|
218
218
|
npx workflow inspect runs
|
|
219
219
|
```
|
|
220
220
|
|
|
221
|
-

|
|
222
222
|
|
|
223
223
|
## Deploying to production
|
|
224
224
|
|
|
225
|
-
Workflow
|
|
225
|
+
Workflow SDK apps currently work best when deployed to [Vercel](https://vercel.com/home) and needs no special configuration.
|
|
226
226
|
|
|
227
227
|
<FluidComputeCallout />
|
|
228
228
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
title: Vite
|
|
3
3
|
description: Set up your first durable workflow in a Vite application.
|
|
4
4
|
type: guide
|
|
5
|
-
summary: Set up Workflow
|
|
5
|
+
summary: Set up Workflow SDK in a Vite app.
|
|
6
6
|
prerequisites:
|
|
7
7
|
- /docs/getting-started
|
|
8
8
|
related:
|
|
@@ -111,7 +111,7 @@ export async function handleUserSignup(email: string) {
|
|
|
111
111
|
We'll fill in those functions next, but let's take a look at this code:
|
|
112
112
|
|
|
113
113
|
* We define a **workflow** function with the directive `"use workflow"`. Think of the workflow function as the _orchestrator_ of individual **steps**.
|
|
114
|
-
* The Workflow
|
|
114
|
+
* The Workflow SDK's `sleep` function allows us to suspend execution of the workflow without using up any resources. A sleep can be a few seconds, hours, days, or even months long.
|
|
115
115
|
|
|
116
116
|
## Create Your Workflow Steps
|
|
117
117
|
|
|
@@ -213,7 +213,7 @@ curl -X POST --json '{"email":"hello@example.com"}' http://localhost:3000/api/si
|
|
|
213
213
|
|
|
214
214
|
Check the Vite development server logs to see your workflow execute as well as the steps that are being processed.
|
|
215
215
|
|
|
216
|
-
Additionally, you can use the [Workflow
|
|
216
|
+
Additionally, you can use the [Workflow SDK CLI or Web UI](/docs/observability) to inspect your workflow runs and steps in detail.
|
|
217
217
|
|
|
218
218
|
```bash
|
|
219
219
|
# Open the observability Web UI
|
|
@@ -222,13 +222,13 @@ npx workflow web
|
|
|
222
222
|
npx workflow inspect runs
|
|
223
223
|
```
|
|
224
224
|
|
|
225
|
-

|
|
226
226
|
|
|
227
227
|
---
|
|
228
228
|
|
|
229
229
|
## Deploying to production
|
|
230
230
|
|
|
231
|
-
Workflow
|
|
231
|
+
Workflow SDK apps currently work best when deployed to [Vercel](https://vercel.com/home) and needs no special configuration.
|
|
232
232
|
|
|
233
233
|
<FluidComputeCallout />
|
|
234
234
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: How the Directives Work
|
|
3
|
-
description: Deep dive into the internals of how Workflow
|
|
3
|
+
description: Deep dive into the internals of how Workflow SDK directives transform your code.
|
|
4
4
|
type: conceptual
|
|
5
5
|
summary: Learn how the compiler transforms directive-annotated code into three execution modes.
|
|
6
6
|
prerequisites:
|
|
@@ -10,10 +10,10 @@ related:
|
|
|
10
10
|
---
|
|
11
11
|
|
|
12
12
|
<Callout>
|
|
13
|
-
This is an advanced guide that dives into internals of the Workflow
|
|
13
|
+
This is an advanced guide that dives into internals of the Workflow SDK directive and is not required reading to use workflows. To simply use the Workflow SDK, check out the [getting started](/docs/getting-started) guides for your framework.
|
|
14
14
|
</Callout>
|
|
15
15
|
|
|
16
|
-
Workflows use special directives to mark code for transformation by the Workflow
|
|
16
|
+
Workflows use special directives to mark code for transformation by the Workflow SDK compiler. This page explains how `"use workflow"` and `"use step"` directives work, what transformations are applied, and why they're necessary for durable execution.
|
|
17
17
|
|
|
18
18
|
## Directives Overview
|
|
19
19
|
|
|
@@ -210,7 +210,7 @@ The IDs are generated exactly like in workflow mode to ensure they can be direct
|
|
|
210
210
|
|
|
211
211
|
## Generated Files
|
|
212
212
|
|
|
213
|
-
When you build your application, the Workflow
|
|
213
|
+
When you build your application, the Workflow SDK generates three handler files in `.well-known/workflow/v1/`:
|
|
214
214
|
|
|
215
215
|
### `flow.js`
|
|
216
216
|
|
|
@@ -268,7 +268,7 @@ Contains webhook handling logic for delivering external data to running workflow
|
|
|
268
268
|
|
|
269
269
|
## Why Three Modes?
|
|
270
270
|
|
|
271
|
-
The multi-mode transformation enables the Workflow
|
|
271
|
+
The multi-mode transformation enables the Workflow SDK's durable execution model:
|
|
272
272
|
|
|
273
273
|
1. **Step Mode** (required) - Bundles executable step functions that can access the full runtime
|
|
274
274
|
2. **Workflow Mode** (required) - Creates orchestration logic that can replay from event logs
|
|
@@ -320,7 +320,7 @@ The compiler generates stable IDs for workflows and steps based on file paths an
|
|
|
320
320
|
- **Portable**: Works across different runtimes and deployments
|
|
321
321
|
|
|
322
322
|
<Callout type="info">
|
|
323
|
-
Although IDs can change when files are moved or functions are renamed, Workflow
|
|
323
|
+
Although IDs can change when files are moved or functions are renamed, Workflow SDK function assume atomic versioning in the World. This means changing IDs won't break old workflows from running, but will prevent run from being upgraded and will cause your workflow/step names to change in the observability across deployments.
|
|
324
324
|
</Callout>
|
|
325
325
|
|
|
326
326
|
## Framework Integration
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Encryption
|
|
3
|
-
description: Learn how Workflow
|
|
3
|
+
description: Learn how Workflow SDK encrypts user data end-to-end in the event log.
|
|
4
4
|
type: conceptual
|
|
5
5
|
summary: Understand how workflow and step data is encrypted at rest.
|
|
6
6
|
prerequisites:
|
|
@@ -11,10 +11,10 @@ related:
|
|
|
11
11
|
---
|
|
12
12
|
|
|
13
13
|
<Callout>
|
|
14
|
-
This guide explains how Workflow
|
|
14
|
+
This guide explains how Workflow SDK encrypts user data in the event log. Understanding these details is not required to use workflows — encryption is automatic and requires no code changes. For getting started, see the [getting started](/docs/getting-started) guides for your framework.
|
|
15
15
|
</Callout>
|
|
16
16
|
|
|
17
|
-
Workflow
|
|
17
|
+
Workflow SDK supports automatic end-to-end encryption of all user data before it is written to the event log. When a `World` implementation provides encryption support, it is safe to pass sensitive data — such as API keys, tokens, or user credentials — as workflow inputs, step arguments, and return values. The storage backend only ever sees ciphertext.
|
|
18
18
|
|
|
19
19
|
Encryption support varies by `World` implementation. See the [Worlds](/worlds) page to check which worlds support this feature. `World` implementations opt into encryption by providing a `getEncryptionKeyForRun()` method — the core runtime will use it automatically when present.
|
|
20
20
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Event Sourcing
|
|
3
|
-
description: Learn how Workflow
|
|
3
|
+
description: Learn how Workflow SDK uses event sourcing internally for debugging and observability.
|
|
4
4
|
type: conceptual
|
|
5
5
|
summary: Understand the event log that powers workflow replay and debugging.
|
|
6
6
|
prerequisites:
|
|
@@ -10,10 +10,10 @@ related:
|
|
|
10
10
|
---
|
|
11
11
|
|
|
12
12
|
<Callout>
|
|
13
|
-
This guide explores how the Workflow
|
|
13
|
+
This guide explores how the Workflow SDK uses event sourcing internally. Understanding these concepts is helpful for debugging and building observability tools, but is not required to use workflows. For getting started with workflows, see the [getting started](/docs/getting-started) guides for your framework.
|
|
14
14
|
</Callout>
|
|
15
15
|
|
|
16
|
-
The Workflow
|
|
16
|
+
The Workflow SDK uses event sourcing to track all state changes in workflow executions. Every mutation creates an event that is persisted to the event log, and entity state is derived by replaying these events.
|
|
17
17
|
|
|
18
18
|
This page explains the event sourcing model and entity lifecycles.
|
|
19
19
|
|
|
@@ -28,7 +28,7 @@ Event sourcing is a persistence pattern where state changes are stored as a sequ
|
|
|
28
28
|
- **Consistency**: Events provide a single source of truth for all entity state
|
|
29
29
|
- **Recoverability**: State can be reconstructed from the event log after failures
|
|
30
30
|
|
|
31
|
-
In the Workflow
|
|
31
|
+
In the Workflow SDK, the following entity types are managed through events:
|
|
32
32
|
|
|
33
33
|
- **Runs**: Workflow execution instances (materialized in storage)
|
|
34
34
|
- **Steps**: Individual atomic operations within a workflow (materialized in storage)
|
|
@@ -243,7 +243,7 @@ This correlation enables:
|
|
|
243
243
|
|
|
244
244
|
## Entity IDs
|
|
245
245
|
|
|
246
|
-
All entities in the Workflow
|
|
246
|
+
All entities in the Workflow SDK use a consistent ID format: a 4-character prefix followed by an underscore and a [ULID](https://github.com/ulid/spec) (Universally Unique Lexicographically Sortable Identifier).
|
|
247
247
|
|
|
248
248
|
| Entity | Prefix | Example |
|
|
249
249
|
|--------|--------|---------|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Framework Integrations
|
|
3
|
-
description: Guide for framework authors to integrate Workflow
|
|
3
|
+
description: Guide for framework authors to integrate Workflow SDK with custom frameworks or runtimes.
|
|
4
4
|
type: guide
|
|
5
|
-
summary: Build a custom framework integration using the Workflow
|
|
5
|
+
summary: Build a custom framework integration using the Workflow SDK compiler and runtime.
|
|
6
6
|
prerequisites:
|
|
7
7
|
- /docs/foundations/workflows-and-steps
|
|
8
8
|
related:
|
|
@@ -10,13 +10,13 @@ related:
|
|
|
10
10
|
---
|
|
11
11
|
|
|
12
12
|
<Callout>
|
|
13
|
-
**For users:** If you just want to use Workflow
|
|
13
|
+
**For users:** If you just want to use Workflow SDK with an existing framework, check out the [Getting Started](/docs/getting-started) guide instead. This page is for framework authors who want to integrate Workflow SDK with their framework or runtime.
|
|
14
14
|
</Callout>
|
|
15
15
|
|
|
16
|
-
This guide walks you through building a framework integration for Workflow
|
|
16
|
+
This guide walks you through building a framework integration for Workflow SDK using Bun as a concrete example. The same principles apply to any JavaScript runtime (Node.js, Deno, Cloudflare Workers, etc.).
|
|
17
17
|
|
|
18
18
|
<Callout type="info">
|
|
19
|
-
**Prerequisites:** Before building a framework integration, we recommend reading [How the Directives Work](/docs/how-it-works/code-transform) to understand the transformation system that powers Workflow
|
|
19
|
+
**Prerequisites:** Before building a framework integration, we recommend reading [How the Directives Work](/docs/how-it-works/code-transform) to understand the transformation system that powers Workflow SDK.
|
|
20
20
|
</Callout>
|
|
21
21
|
|
|
22
22
|
## What You'll Build
|
|
@@ -46,7 +46,7 @@ flowchart TD
|
|
|
46
46
|
style J fill:#a78bfa,stroke:#8b5cf6,color:#000
|
|
47
47
|
```
|
|
48
48
|
|
|
49
|
-
The purple boxes are what you implement—everything else is provided by Workflow
|
|
49
|
+
The purple boxes are what you implement—everything else is provided by Workflow SDK.
|
|
50
50
|
|
|
51
51
|
## Example: Bun Integration
|
|
52
52
|
|
|
@@ -259,7 +259,7 @@ class MyFrameworkBuilder extends BaseBuilder {
|
|
|
259
259
|
}
|
|
260
260
|
```
|
|
261
261
|
|
|
262
|
-
If your framework supports virtual server routes and dev mode watching, make sure to adapt accordingly. Please open a PR to the Workflow
|
|
262
|
+
If your framework supports virtual server routes and dev mode watching, make sure to adapt accordingly. Please open a PR to the Workflow SDK if the base builder class is missing necessary functionality.
|
|
263
263
|
|
|
264
264
|
Hook into your framework's build:
|
|
265
265
|
|
|
@@ -341,8 +341,8 @@ const server = Bun.serve({
|
|
|
341
341
|
```
|
|
342
342
|
|
|
343
343
|
Production framework integrations should handle this routing in the plugin instead of leaving it to the user, and this depends on each framework's unique implementaiton.
|
|
344
|
-
Check the Workflow
|
|
345
|
-
In the future, the Workflow
|
|
344
|
+
Check the Workflow SDK source code for examples of production framework implementations.
|
|
345
|
+
In the future, the Workflow SDK will emit more routes under the `.well-known/workflow` namespace.
|
|
346
346
|
|
|
347
347
|
## Security
|
|
348
348
|
|