Workflow DevKit: Build durable, reliable, and observable apps and AI Agents in TypeScript
by vercel2 of 6 standards met
Summary Enables to discover files with / directives inside dot-prefixed files and directories (e.g. , ) Switches from absolute glob patterns to relative patterns with per-directory and , working around a quirk where in ignore patterns does not match dot-prefixed segments when using absolute patterns The explicit ignore list (, , , etc.) continues to work correctly Test Plan Added with 4 tests covering: Discovery of files inside dot-prefixed directories Discovery of dot-prefixed files Exclusion of explicitly ignored dot-directories (, , , , , , ) Support for all file extensions in dot-directories
In #843, @karthikscale3 added an option to "limit the directories scanned for workflow directives". The docs continue to say "If your workflows are located in a specific directory, configure to only scan that directory". I tried it out (built the latest commit myself) and found that it doesn't do what I expected. What it sounded like (to me): It searches all files in those directories for functions with or (direct discovery). This is my understanding of where my "workflows are located" and what should be "scanned for workflow directives". I tried to use , but it didn't find anything. How it works: It looks only for well-known filenames like and and discovers the workflows referenced by those entrypoints (indirect discovery). Actually, the chain is: page file -> server action file -> workflow file -> step file. It seems to compile all of those, although it doesn't need the page nor the server action files. Possible solution*: If is used, don't limit the input filenames to Next.js entrypoints and let devs specify the directories where they define, not start* workflows. That's an even better optimiation from my point of view.
Repository: vercel/workflow. Description: Workflow DevKit: Build durable, reliable, and observable apps and AI Agents in TypeScript Stars: 1754, Forks: 200. Primary language: TypeScript. Languages: TypeScript (82.2%), Rust (10.9%), JavaScript (5%), CSS (1.6%), HTML (0.1%). License: Apache-2.0. Homepage: https://useworkflow.dev Latest release: workflow@4.1.0-beta.62 (1d ago). Open PRs: 84, open issues: 70. Last activity: 1h ago. Community health: 62%. Top contributors: TooTallNate, VaguelySerious, pranaygp, adriandlam, vercel-release-bot, ijjk, karthikscale3, Schniz, Copilot, haydenbleasel and others.
TypeScript
Last 12 weeks · 375 commits
This brings back the option introduced in #843 (and removed in #961), but with a slightly different meaning. Instead of specifying directories of pages whiuch call server actions which trigger workflows, the option is now meant to directly specify the directory with the workflow files. That removes two layers of indirection, imports way less files and therefore really improves performance as the original PR intended (~15s -> ~2.5s on a medium-sized app).
Steps and workflows defined inside dot-prefixed directories (e.g. ) were silently ignored because 's defaults to , which skips directories starting with . This broke the pattern used by agent frameworks like that generate step functions inside . What changed Added to the call in so dot-prefixed directories like are traversed — the explicit patterns already filter out directories that should remain excluded (, , , , etc.) Added test step/workflow files in for both and workbenches, with corresponding imports in their chat routes so the eager builder discovers them Added manifest tests verifying the steps and workflows appear in the build manifest Added an e2e test that runs the end-to-end on Next.js workbenches
If I have a workflow that's following the pattern at https://useworkflow.dev/docs/foundations/hooks#creating-your-first-hook , the hook will remain "open" for the entire duration of the workflow. After the hook has been resumed, I notice in the observability dashboard that the hook remains active for the entire lifetime of the workflow. I didn't find any documentation for stopping hooks from listening, either in hook config upon creation, or programmatically. I did find reference to a event here: https://github.com/vercel/workflow/blob/main/packages/world/src/interfaces.ts#L66 And I was able to use that event in Local World like this: which successfully disposed the hook. But in Vercel World, I get a 400 error like: 'WorkflowAPIError: POST /v2/runs/wrun_XXXXXXXXXXXX/events -> HTTP 400: Bad Request\n" I see this function in the package: https://github.com/vercel/workflow/blob/main/packages/world-vercel/src/hooks.ts#L114 , but I can't tell if I should expect to be able to use that. Should I expect to be able to dispose of open hooks in local and vercel worlds? If so, what is the best approach? Thank you :)