Vercel Workflow
Configure Vercel Workflow and run durable workflows on Vercel.
Vercel Workflow fits Vercel-hosted apps that want a managed workflow engine without changing the ViteHub file structure. ViteHub starts discovered workflows through Vercel and keeps the same runWorkflow() and getWorkflowRun() API.
Install the SDK
Terminal
pnpm add https://pkg.pr.new/nuxt-hub/agent/@vitehub/workflow@main workflow
Configure Vercel
nuxt.config.ts
export default defineNuxtConfig({
modules: ['@vitehub/workflow/nuxt'],
})
Vercel hosting picks the workflow provider automatically. Use workflow.workflow only when you need to inject a provider-native workflow definition instead of the discovered default.
Start a workflow
server/api/workflow/publish.post.ts
import { runWorkflow } from '@vitehub/workflow'
export default defineEventHandler(async () => {
const run = await runWorkflow('publish-draft', {
title: 'Ship weekly digest',
})
return {
runId: run.id,
status: await run.status(),
}
})
ViteHub forwards the discovered workflow definition, your payload, and any definition-level start options to Vercel's start() call.
What changes on Vercel
| Concern | Behavior |
|---|---|
| Run lookup | getWorkflowRun(id) resolves the configured Vercel workflow API and calls getRun(id). |
| Shared run methods | Every run supports id, status(), and stop(). |
| Vercel-only methods | Vercel runs expose result() under run.vercel, and run.status() also tries to resolve the provider result when possible. |
Choose Vercel when the rest of the app already deploys on Vercel and you want workflow runs to follow the same platform model.