workflow▌
vercel/workflow · updated Apr 8, 2026
MDX-style export adds YAML metadata + attribution linking explainx.ai and this canonical listing URL.
Durable, resumable workflows with step-based orchestration, hooks for external events, and built-in AI agent support.
- ›Supports three execution modes: workflow functions (orchestration layer), step functions (full Node.js access with automatic retry and result persistence), and DurableAgent for AI-powered workflows with tool integration
- ›Pause workflows at hooks to wait for external events, then resume from API routes; hooks support single events or iterable multi-event patterns with dete
CRITICAL: Always Use Correct workflow Documentation
Your knowledge of workflow is outdated.
The workflow documentation outlined below matches the installed version of the Workflow SDK.
Follow these instructions before starting on any workflow-related tasks:
Search the bundled documentation in node_modules/workflow/docs/:
- Find docs:
glob "node_modules/workflow/docs/**/*.mdx" - Search content:
grep "your query" node_modules/workflow/docs/
Documentation structure in node_modules/workflow/docs/:
getting-started/- Framework setup (next.mdx, express.mdx, hono.mdx, etc.)foundations/- Core concepts (workflows-and-steps.mdx, hooks.mdx, streaming.mdx, etc.)api-reference/workflow/- API docs (sleep.mdx, create-hook.mdx, fatal-error.mdx, etc.)api-reference/workflow-api/- Client API (start.mdx, get-run.mdx, resume-hook.mdx, etc.)api-reference/workflow-api/world/- World SDK (runs.mdx, steps.mdx, hooks.mdx, events.mdx, streams.mdx, queue.mdx, observability.mdx)ai/- AI SDK integration docserrors/- Error code documentation
Related packages also include bundled docs:
@workflow/ai:node_modules/@workflow/ai/docs/- DurableAgent and AI integration@workflow/core:node_modules/@workflow/core/docs/- Core runtime (foundations, how-it-works)@workflow/next:node_modules/@workflow/next/docs/- Next.js integration
When in doubt, update to the latest version of the Workflow SDK.
Official Resources
- Website: https://useworkflow.dev
- GitHub: https://github.com/vercel/workflow
Quick Reference
Directives:
"use workflow"; // First line - makes async function durable
"use step"; // First line - makes function a cached, retryable unit
Essential imports:
// Workflow primitives
import { sleep, fetch, createHook, createWebhook, getWritable } from "workflow";
import { FatalError, RetryableError } from "workflow";
import { getWorkflowMetadata, getStepMetadata } from "workflow";
// API operations
import { start, getRun, resumeHook, resumeWebhook } from "workflow/api";
// Observability & data hydration
import { hydrateResourceIO, observabilityRevivers, parseStepName, parseWorkflowName } from "workflow/observability";
// Framework integrations
import { withWorkflow } from "workflow/next";
import { workflow } from "workflow/vite";
import { workflow } from "workflow/astro";
// Or use modules: ["workflow/nitro"] for Nitro/Nuxt
// AI agent
import { DurableAgent } from "@workflow/ai/agent";
Prefer Step Functions to Avoid Sandbox Errors
"use workflow" functions run in a sandboxed VM. "use step" functions have full Node.js access. Put your logic in steps and use the workflow function purely for orchestration.
// Steps have full Node.js and npm access
async function fetchUserData(userId: string) {
"use step";
const response = await fetch(`https://api.example.com/users/${userId}`);
return response.json();
}
async function processWithAI(data: any) {
"use step";
// AI SDK works in steps without workarounds
return await generateText({
model: openai("gpt-4"),
prompt: `Process: ${JSON.stringify(data)}`,
});
}
// Workflow orchestrates steps - no sandbox issues
export async function dataProcessingWorkflow(userId: string) {
"use workflow";
const data = await fetchUserData(userId);
const processed = await processWithAI(data);
return { success: true, processed };
}
Benefits: Steps have automatic retry, results are persisted for replay, and no sandbox restrictions.
Workflow Sandbox Limitations
When you need logic directly in a workflow function (not in a step), these restrictions apply:
| Limitation | Workaround |
|---|---|
No fetch() |
import { fetch } from "workflow" then globalThis.fetch = fetch |
No setTimeout/setInterval |
Use sleep("5s") from "workflow" |
| No Node.js modules (fs, crypto, etc.) | Move to a step function |
Example - Using fetch in workflow context:
import { fetch } from "workflow";
export async function myWorkflow() {
"use workflow";
globalThis.fetch = fetch; // Required for AI SDK and HTTP libraries
// Now generateText() and other libraries work
}
Note: DurableAgent from @workflow/ai handles the fetch assignment automatically.
DurableAgent — AI Agents in Workflows
Use DurableAgent to build AI agents that maintain state and survive interruptions. It handles the workflow sandbox automatically (no manual globalThis.fetch needed).
import { DurableAgent } from "@workflow/ai/agent";
import { getWritable } from "workflow";
import { z } from "zod";
import type { UIMessageChunk } from "ai";
async function lookupData({ query }: { query: string }) {
"use step";
// Step functions have full Node.js access
return `Results for "${query}"`;
}
export async function myAgentWorkflow(userMessage: string) {
"use workflow";
const agent = new DurableAgent({
model: "anthropic/claude-sonnet-4-5",
system: "You are a helpful assistant.",
tools: {
lookupData: {
description: "Search for information",
inputSchema: z.object({ query: z.string() }),
execute: lookupData,
},
},
});
const result = await agent.stream({
messages: [{ role: "user", content: userMessage }],
writable: getWritable<UIMessageChunk>(),
maxSteps: 10,
});
return result.messages;
}
Key points:
getWritable<UIMessageChunk>()streams output to the workflow run's default stream- Tool
executefunctions that need Node.js/npm access should use"use step" - Tool
executefunctions that use workflow primitives (sleep(),createHook()) should NOT use"use step"— they run at the workflow level maxStepslimits the number of LLM calls (default is unlimited)- Multi-turn: pass
result.messagesplus new user messages to subsequentagent.stream()calls
For more details on DurableAgent, check the AI docs in node_modules/@workflow/ai/docs/.
Starting Workflows & Child Workflows
Use start() to launch workflows from API routes. start() cannot be called directly in workflow context — wrap it in a step function.
import { start how to use workflowHow to use workflow on Cursor
AI-first code editor with Composer
1Prerequisites
Before installing skills in Cursor, ensure your development environment meets these requirements:
- ›Cursor installed and configured on your development machine
- ›Node.js version 16.0+ with npm package manager (verify with
node --version) - ›Active project directory or workspace where you want to add workflow
2Execute installation command
Execute the skills CLI command in your project's root directory to begin installation:
$npx skills add https://github.com/vercel/workflow --skill workflowThe skills CLI fetches workflow from GitHub repository vercel/workflow and configures it for Cursor.
3Select Cursor when prompted
The CLI will show a list of available agents. Use arrow keys to navigate and space to select Cursor:
◆ Which agents do you want to install to?││ ── Universal (.agents/skills) ── always included ────│ • Amp│ • Antigravity│ • Cline│ • Codex│ ●Cursor(selected)│ • Cursor│ • Windsurf4Verify installation
Confirm successful installation by checking the skill directory location:
.cursor/skills/workflowReload or restart Cursor to activate workflow. Access the skill through slash commands (e.g., /workflow) or your agent's skill management interface.
⚠Security & Verification Notice
We perform automated surface-level scans (Gen AI Scanner, Socket, Snyk) during installation. These checks detect common vulnerabilities but do not guarantee complete security. Always review skill source code and verify the publisher's reputation before production use.
Skills execute code in your development environment. Always verify the publisher's identity, review recent commits, and test in isolated environments before production deployment.
Additional Resources
List & Monetize Your Skill
Submit your Claude Code skill and start earning
GET_STARTED →Use Cases▌
User Story & Requirements Generation
Create detailed user stories, acceptance criteria, and feature specs
Example
Generate user stories for 'password reset feature' with acceptance criteria, edge cases, and test scenarios
✓Reduce spec writing time by 50%, ensure comprehensive coverage
Competitive Analysis
Research competitors, compare features, identify gaps
Example
Analyze 5 competitor products, create feature comparison matrix, suggest differentiation opportunities
✓Complete competitive research in 2 hours instead of 2 days
Roadmap Prioritization
Evaluate features using frameworks (RICE, ICE, Kano) and create prioritized backlogs
Example
Score 20 feature ideas using RICE framework, generate prioritized roadmap with rationale
✓Make data-driven prioritization decisions faster
Stakeholder Communication
Draft PRDs, status updates, and stakeholder presentations
Example
Create executive summary of Q3 roadmap, monthly progress report, feature launch announcement
✓Save 3-5 hours/week on communication overhead
Implementation Guide▌
Prerequisites
- ›Claude Desktop or compatible AI client
- ›Access to product documentation and roadmap tools (Jira, Notion, etc.)
- ›Understanding of product management frameworks (RICE, Jobs-to-be-Done, etc.)
- ›Stakeholder contact information and communication channels
Time Estimate
30-60 minutes to see productivity improvements
Installation Steps
- 1.Install product management skill
- 2.Start with user story generation for known feature
- 3.Progress to competitive analysis: research 2-3 competitors
- 4.Use for roadmap prioritization: apply RICE/ICE scoring
- 5.Draft stakeholder communications and refine based on feedback
- 6.Build template library for recurring PM tasks
- 7.Share effective prompts with product team
Common Pitfalls
- ⚠Not validating competitive research—verify facts before sharing
- ⚠Accepting user stories without involving engineering team
- ⚠Over-relying on frameworks without qualitative judgment
- ⚠Not customizing outputs to company culture and communication style
- ⚠Skipping stakeholder validation of generated requirements
Best Practices▌
✓ Do
- +Validate research and competitive analysis with real data
- +Collaborate with engineering when generating technical requirements
- +Customize frameworks and templates to your company context
- +Use skill for first drafts, refine with stakeholder input
- +Document successful prompt patterns for PM tasks
- +Combine AI efficiency with human judgment and intuition
✗ Don't
- −Don't publish competitive analysis without fact-checking
- −Don't finalize user stories without engineering review
- −Don't make prioritization decisions solely on AI scoring
- −Don't skip customer validation of generated requirements
- −Don't ignore company-specific context and culture
💡 Pro Tips
- ★Provide context: company goals, constraints, customer feedback
- ★Ask for alternatives: 'Show 3 ways to prioritize this roadmap'
- ★Request stakeholder-specific formatting: 'Executive summary vs. engineering spec'
- ★Use skill for 70% generation + 30% customization to company needs
When to Use This▌
✓ Use When
Use for user story writing, competitive research, roadmap prioritization, stakeholder communication, and PRD drafting. Best for reducing repetitive documentation and research work.
✗ Avoid When
Avoid for strategic product vision (requires deep customer empathy), pricing decisions (needs market and financial expertise), or when face-to-face customer discovery is more valuable than speed.
Learning Path▌
- 1Basic: user stories, feature specs, status updates
- 2Intermediate: competitive analysis, prioritization frameworks, PRDs
- 3Advanced: product strategy, go-to-market planning, OKR setting
- 4Expert: product vision, market positioning, business model innovation
Discussion
Product Hunt–style comments (not star reviews)- No comments yet — start the thread.
general reviewsRatings
4.5★★★★★40 reviews- ★★★★★Pratham Ware· Dec 28, 2024
workflow fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.
- ★★★★★Daniel Abbas· Dec 28, 2024
workflow is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.
- ★★★★★Isabella Jackson· Dec 16, 2024
Useful defaults in workflow — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.
- ★★★★★Amina Li· Dec 12, 2024
We added workflow from the explainx registry; install was straightforward and the SKILL.md answered most questions upfront.
- ★★★★★Yash Thakker· Nov 19, 2024
Registry listing for workflow matched our evaluation — installs cleanly and behaves as described in the markdown.
- ★★★★★Kabir Sethi· Nov 19, 2024
Useful defaults in workflow — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.
- ★★★★★Naina Rahman· Nov 11, 2024
Solid pick for teams standardizing on skills: workflow is focused, and the summary matches what you get after install.
- ★★★★★Harper Reddy· Nov 7, 2024
workflow is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.
- ★★★★★Amina Robinson· Nov 3, 2024
workflow reduced setup friction for our internal harness; good balance of opinion and flexibility.
- ★★★★★Amina Wang· Oct 26, 2024
Keeps context tight: workflow is the kind of skill you can hand to a new teammate without a long onboarding doc.
showing 1-10 of 40
1 / 4