Skip to content

Commit 38c3cde

Browse files
committed
Address all PR #1466 review feedback from VaguelySerious, pranaygp, and ijjk:
1. Remove the "Machine-Readable Surfaces" section from docs/content/docs/observability/index.mdx (reviewers say it's unnecessary and already in world docs) 2. Remove all @skip-typecheck annotations from durable-agent.mdx (8) and server-based.mdx (1) — types exist in built packages/ai/dist after pnpm build 3. In durable-agent.mdx, change "machine-readable tool activity" to "tool call details" in the stream() return description 4. In durable-agent.mdx "Aborting Long-Running Streams" section, add a warning callout that abortSignal is not yet supported (blocked by #1301), recommend timeout instead 5. In event-sourcing.mdx, update requestId description: "On Vercel, requestId is the platform request ID when available. Other worlds are not expected to provide a requestId." 6. In get-world.mdx, change "user-friendly names from the machine-readable workflowName field" to "human-readable names from the workflowName field" 7. In start-invalid-workflow-function.mdx, add "// Does NOT work" comment above the bad example line 8. In with-workflow.mdx: reframe outputFileTracingRoot as a workaround (Next.js auto-detects by default per ijjk); change options description from "control local development behavior" to "configure the Next.js integration"; scope the callout to "workflows.local options only affect local development" 9. Drop the withWorkflow() options callout from docs/content/docs/getting-started/next.mdx 10. Remove the Next.js-specific outputFileTracingRoot callout from framework-integrations.mdx 11. Add a Troubleshooting section with the start() invalid-workflow-function error to all 9 non-Next getting-started guides (astro, express, fastify, hono, nestjs, nitro, nuxt, sveltekit, vite), each with framework-appropriate config check in point 2
1 parent 3dd651e commit 38c3cde

18 files changed

Lines changed: 164 additions & 55 deletions

File tree

docs/content/docs/api-reference/workflow-ai/durable-agent.mdx

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ The `DurableAgent` class enables you to create AI-powered agents that can mainta
1717

1818
Tool calls can be implemented as workflow steps for automatic retries, or as regular workflow-level logic utilizing core library features such as [`sleep()`](/docs/api-reference/workflow/sleep) and [Hooks](/docs/foundations/hooks).
1919

20-
{/* @skip-typecheck - uses DurableAgentOptions properties not yet in published dist types */}
21-
2220
```typescript lineNumbers
2321
import { DurableAgent } from "@workflow/ai/agent";
2422
import { getWritable } from "workflow";
@@ -215,7 +213,7 @@ export default OutputSpecification;`}
215213
- Tools can use core library features like `sleep()` and Hooks within their `execute` functions
216214
- The agent processes tool calls iteratively until completion or `maxSteps` is reached
217215
- **Default `maxSteps` is unlimited** - set a value to limit the number of LLM calls
218-
- The `stream()` method returns `{ messages, steps, toolCalls, toolResults, experimental_output, uiMessages }` containing the full conversation history, per-step details, machine-readable tool activity, optional structured output, and optionally accumulated UI messages
216+
- The `stream()` method returns `{ messages, steps, toolCalls, toolResults, experimental_output, uiMessages }` containing the full conversation history, step details, tool call details, optional structured output, and optionally accumulated UI messages
219217
- Use `collectUIMessages: true` to accumulate `UIMessage[]` during streaming, useful for persisting conversation state without re-reading the stream
220218
- The `prepareStep` callback runs before each step and can modify model, messages, generation settings, tool choice, and context
221219
- Generation settings (temperature, maxOutputTokens, etc.) can be set on the constructor and overridden per-stream call
@@ -226,8 +224,6 @@ export default OutputSpecification;`}
226224

227225
### Basic Agent with Tools
228226

229-
{/* @skip-typecheck - uses DurableAgentOptions.instructions not yet in published dist types */}
230-
231227
```typescript
232228
import { DurableAgent } from "@workflow/ai/agent";
233229
import { getWritable } from "workflow";
@@ -442,8 +438,6 @@ async function agentWithLibraryFeaturesWorkflow(userRequest: string) {
442438

443439
Use `prepareStep` to modify settings before each step in the agent loop:
444440

445-
{/* @skip-typecheck - uses DurableAgentStreamOptions.prepareStep not yet in published dist types */}
446-
447441
```typescript
448442
import { DurableAgent } from "@workflow/ai/agent";
449443
import { getWritable } from "workflow";
@@ -488,8 +482,6 @@ async function agentWithPrepareStep(userMessage: string) {
488482

489483
Inject messages from external sources (like hooks) before each LLM call:
490484

491-
{/* @skip-typecheck - uses DurableAgentStreamOptions.prepareStep not yet in published dist types */}
492-
493485
```typescript
494486
import { DurableAgent } from "@workflow/ai/agent";
495487
import { getWritable, defineHook } from "workflow";
@@ -670,8 +662,6 @@ async function agentWithCallbacks() {
670662

671663
Parse structured data from the LLM response using `Output.object`:
672664

673-
{/* @skip-typecheck - uses OutputSpecification not yet in published dist types */}
674-
675665
```typescript
676666
import { DurableAgent, Output } from "@workflow/ai/agent";
677667
import { getWritable } from "workflow";
@@ -814,8 +804,6 @@ async function agentWithContext(userId: string) {
814804

815805
Use `collectUIMessages` to accumulate `UIMessage[]` during streaming. This is useful when you need to persist the conversation without re-reading the run's output stream:
816806

817-
{/* @skip-typecheck - uses collectUIMessages/uiMessages not yet in published dist types */}
818-
819807
```typescript lineNumbers
820808
import { DurableAgent } from "@workflow/ai/agent";
821809
import { getWritable } from "workflow";
@@ -858,8 +846,6 @@ The `uiMessages` property is only available when `collectUIMessages` is set to `
858846

859847
`stream()` returns structured tool activity you can inspect programmatically. Compare `toolCalls` with `toolResults` to find unresolved tool calls that need client-side handling:
860848

861-
{/* @skip-typecheck - uses toolCalls/toolResults not yet in published dist types */}
862-
863849
```typescript lineNumbers
864850
import { DurableAgent } from "@workflow/ai/agent";
865851
import { getWritable } from "workflow";
@@ -915,9 +901,11 @@ async function agentWithToolInspection(userMessage: string) {
915901

916902
### Aborting Long-Running Streams
917903

918-
Use `timeout` to abort a stream automatically after a fixed duration. If both `timeout` and `abortSignal` are provided, whichever triggers first will abort the operation:
904+
Use `timeout` to abort a stream automatically after a fixed duration:
919905

920-
{/* @skip-typecheck - uses DurableAgentStreamOptions.timeout not yet in published dist types */}
906+
<Callout type="warn">
907+
`abortSignal` is not yet supported and will be available in a future release. Use `timeout` for now.
908+
</Callout>
921909

922910
```typescript lineNumbers
923911
import { DurableAgent } from "@workflow/ai/agent";

docs/content/docs/api-reference/workflow-api/get-world.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ export async function GET(req: Request) {
198198

199199
### List Workflow Runs (Display Names)
200200

201-
List workflow runs and derive user-friendly names from the machine-readable `workflowName` field:
201+
List workflow runs and derive human-readable names from the `workflowName` field:
202202

203203
```typescript lineNumbers
204204
import { getWorld } from "workflow/runtime";

docs/content/docs/api-reference/workflow-next/with-workflow.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export default withWorkflow(nextConfig, workflowConfig); // [!code highlight]
2929

3030
### Monorepos and Workspace Imports
3131

32-
If your Next.js app lives in a subdirectory such as `apps/web` and your workflows import code from sibling workspace packages, set `outputFileTracingRoot` to the workspace root. `withWorkflow()` uses this value as the builder project root so workflow transforms can resolve workspace module specifiers correctly.
32+
By default, Next.js detects the correct workspace root automatically. If your Next.js app lives in a subdirectory such as `apps/web` and workspace resolution is not working correctly, you can set `outputFileTracingRoot` as a workaround:
3333

3434
```typescript title="apps/web/next.config.ts" lineNumbers
3535
import { resolve } from "node:path";
@@ -49,7 +49,7 @@ Use the smallest directory that contains every workspace package imported by you
4949

5050
## Options
5151

52-
`withWorkflow` accepts an optional second argument to control local development behavior.
52+
`withWorkflow` accepts an optional second argument to configure the Next.js integration.
5353

5454
```typescript title="next.config.ts" lineNumbers
5555
import type { NextConfig } from "next";
@@ -73,7 +73,7 @@ export default withWorkflow(nextConfig, {
7373
| `workflows.local.port` | `number` || Overrides the `PORT` environment variable for local development. Has no effect when deployed to Vercel. |
7474

7575
<Callout type="info">
76-
These options only affect local development. When deployed to Vercel, the runtime ignores `local` settings and uses the Vercel world automatically.
76+
The `workflows.local` options only affect local development. When deployed to Vercel, the runtime ignores `local` settings and uses the Vercel world automatically.
7777
</Callout>
7878

7979
## Exporting a Function

docs/content/docs/errors/start-invalid-workflow-function.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ import { start } from "workflow/api";
9898
import { sendReminder } from "./workflows/send-reminder";
9999

100100
export async function POST() {
101+
// Does NOT work
101102
await start(async () => sendReminder("hello@example.com"));
102103
return new Response("ok");
103104
}

docs/content/docs/getting-started/astro.mdx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,23 @@ npx astro add vercel
235235

236236
Additionally, check the [Deploying](/docs/deploying) section to learn how your workflows can be deployed elsewhere.
237237

238+
## Troubleshooting
239+
240+
### `start()` says it received an invalid workflow function
241+
242+
If you see this error:
243+
244+
```
245+
'start' received an invalid workflow function. Ensure the Workflow Development Kit is configured correctly and the function includes a 'use workflow' directive.
246+
```
247+
248+
Check both of these first:
249+
250+
1. The workflow function includes `"use workflow"`.
251+
2. Your `astro.config.mjs` includes the `workflow()` integration.
252+
253+
See [start-invalid-workflow-function](/docs/errors/start-invalid-workflow-function) for full examples and fixes.
254+
238255
## Next Steps
239256

240257
* Learn more about the [Foundations](/docs/foundations).

docs/content/docs/getting-started/express.mdx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,23 @@ Workflow DevKit apps currently work best when deployed to [Vercel](https://verce
262262

263263
Check the [Deploying](/docs/deploying) section to learn how your workflows can be deployed elsewhere.
264264

265+
## Troubleshooting
266+
267+
### `start()` says it received an invalid workflow function
268+
269+
If you see this error:
270+
271+
```
272+
'start' received an invalid workflow function. Ensure the Workflow Development Kit is configured correctly and the function includes a 'use workflow' directive.
273+
```
274+
275+
Check both of these first:
276+
277+
1. The workflow function includes `"use workflow"`.
278+
2. Your Nitro config includes the `workflow/nitro` module.
279+
280+
See [start-invalid-workflow-function](/docs/errors/start-invalid-workflow-function) for full examples and fixes.
281+
265282
## Next Steps
266283

267284
- Learn more about the [Foundations](/docs/foundations).

docs/content/docs/getting-started/fastify.mdx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,23 @@ Workflow DevKit apps currently work best when deployed to [Vercel](https://verce
249249

250250
Check the [Deploying](/docs/deploying) section to learn how your workflows can be deployed elsewhere.
251251

252+
## Troubleshooting
253+
254+
### `start()` says it received an invalid workflow function
255+
256+
If you see this error:
257+
258+
```
259+
'start' received an invalid workflow function. Ensure the Workflow Development Kit is configured correctly and the function includes a 'use workflow' directive.
260+
```
261+
262+
Check both of these first:
263+
264+
1. The workflow function includes `"use workflow"`.
265+
2. Your Nitro config includes the `workflow/nitro` module.
266+
267+
See [start-invalid-workflow-function](/docs/errors/start-invalid-workflow-function) for full examples and fixes.
268+
252269
## Next Steps
253270

254271
- Learn more about the [Foundations](/docs/foundations).

docs/content/docs/getting-started/hono.mdx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,23 @@ Workflow DevKit apps currently work best when deployed to [Vercel](https://verce
244244

245245
Check the [Deploying](/docs/deploying) section to learn how your workflows can be deployed elsewhere.
246246

247+
## Troubleshooting
248+
249+
### `start()` says it received an invalid workflow function
250+
251+
If you see this error:
252+
253+
```
254+
'start' received an invalid workflow function. Ensure the Workflow Development Kit is configured correctly and the function includes a 'use workflow' directive.
255+
```
256+
257+
Check both of these first:
258+
259+
1. The workflow function includes `"use workflow"`.
260+
2. Your Nitro config includes the `workflow/nitro` module.
261+
262+
See [start-invalid-workflow-function](/docs/errors/start-invalid-workflow-function) for full examples and fixes.
263+
247264
## Next Steps
248265

249266
- Learn more about the [Foundations](/docs/foundations).

docs/content/docs/getting-started/nestjs.mdx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,23 @@ Workflow DevKit apps currently work best when deployed to [Vercel](https://verce
392392

393393
Check the [Deploying](/docs/deploying) section to learn how your workflows can be deployed elsewhere.
394394

395+
## Troubleshooting
396+
397+
### `start()` says it received an invalid workflow function
398+
399+
If you see this error:
400+
401+
```
402+
'start' received an invalid workflow function. Ensure the Workflow Development Kit is configured correctly and the function includes a 'use workflow' directive.
403+
```
404+
405+
Check both of these first:
406+
407+
1. The workflow function includes `"use workflow"`.
408+
2. Your NestJS app imports and registers the `WorkflowModule`.
409+
410+
See [start-invalid-workflow-function](/docs/errors/start-invalid-workflow-function) for full examples and fixes.
411+
395412
## Next Steps
396413

397414
- Learn more about the [Foundations](/docs/foundations).

docs/content/docs/getting-started/next.mdx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,6 @@ export default withWorkflow(nextConfig); // [!code highlight]
5252
If your Next.js app lives inside a monorepo and your workflows import code from sibling workspace packages, set `outputFileTracingRoot` to the workspace root. See [`withWorkflow()`](/docs/api-reference/workflow-next/with-workflow#monorepos-and-workspace-imports) for the full example.
5353
</Callout>
5454

55-
<Callout type="info">
56-
You can pass a second argument to `withWorkflow()` to control local development behavior, such as enabling lazy workflow discovery or overriding the local port. See [`withWorkflow()` Options](/docs/api-reference/workflow-next/with-workflow#options) for details.
57-
</Callout>
58-
5955
<Accordion type="single" collapsible>
6056
<AccordionItem value="typescript-intellisense" className="[&_h3]:my-0">
6157
<AccordionTrigger className="text-sm">

0 commit comments

Comments
 (0)