workflow

Creates durable, resumable workflows using Vercel's Workflow SDK with steps, hooks, and streaming.

Updated Aug 21, 2025
One-click install
npx skills add https://github.com/Adithiya-S/AI-Study-Companion --skill workflow-adithiya-s
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: workflow
Source: https://github.com/Adithiya-S/AI-Study-Companion/tree/main/.agents/skills/workflow/upstream
Command: npx skills add https://github.com/Adithiya-S/AI-Study-Companion --skill workflow-adithiya-s

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Long-running, multi-step operations in web applications break when servers restart, requests time out, or external events arrive late. This Skill guides you in building durable workflows with Vercel's Workflow SDK that survive restarts, retry on failure, pause for external events, and coordinate multi-step orchestration over time. ## Core Features & Use Cases - Durable Orchestration: Use the "use workflow" and "use step" directives to split orchestration from Node.js-capable step functions with automatic retry and persisted results. - Hooks, Webhooks & Sleep: Pause workflows with createHook/createWebhook for external events, resume them from API routes, and schedule delays with sleep(). - AI Agents & Streaming: Build stateful agents with DurableAgent, stream output via getWritable() with namespaced streams, and inspect runs through the World SDK and CLI tooling. - Use Case: Imagine an approval pipeline that fetches user data, calls an LLM, waits up to a day for a manager's approval webhook, and then publishes a document. This Skill shows how to implement it so every step survives deploys and retries safely. ## Quick Start Ask the AI to create a durable workflow using the Workflow SDK that fetches data in a step, waits for an approval hook, and then completes.

Frequently Asked Questions about workflow

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create a durable workflow with the Vercel Workflow SDK?

Define an async function with "use workflow" as its first line for orchestration, and put Node.js-dependent logic in separate functions marked "use step". Launch it from an API route with start() from "workflow/api".

How do I pause a workflow until an external event happens?

Use createHook() inside the workflow with a deterministic token; the workflow suspends until resumeHook(token, data) is called from an API route. Hooks are async-iterable, so for await...of receives multiple events.

Why can't I use fetch or setTimeout inside a workflow function?

Workflow functions run in a sandboxed VM without Node.js APIs. Import fetch from "workflow" and assign it to globalThis, replace setTimeout with sleep(), and move fs or crypto usage into "use step" functions.

Can I run AI agents inside a durable workflow?

Yes. DurableAgent from @workflow/ai/agent maintains agent state across interruptions and handles the sandbox fetch setup automatically. Tool execute functions needing Node.js access should be marked "use step".

How do I test workflows that use sleep or hooks?

Use the @workflow/vitest plugin for integration tests: start the workflow, use waitForHook or waitForSleep to reach pause points, then resume with resumeHook or wakeUp. Plain steps can be unit-tested directly without the plugin.

What data types can be passed between workflow steps?

Only serializable values cross step boundaries: primitives, plain objects, arrays, Date, Map, Set, streams, Request/Response, and similar built-ins. Class instances require the @workflow/serde protocol with static serialize and deserialize methods.