页面简介
"use workflow" brings durability, reliability, and observability to async JavaScript. Build apps and AI Agents that can suspend, resume, and maintain state with ease.
正文摘录
Make any TypeScript Function Durableuse workflow brings durability, reliability, and observability to async JavaScript. Build apps and AI Agents that can suspend, resume, and maintain state with ease.For humansFor agents$npm install workflowReliability-as-codeMove from hand-rolled queues and custom retries to durable, resumable code with simple directives.With Workflow SDKWith Workflow SDKWithout Workflow SDKWithout Workflow SDKexport async function welcome(userId: string) { "use workflow"; const user = await getUser(userId); const { subject, body } = await generateEmail({ name: user.name, plan: user.plan }); const { status } = await sendEmail({ to: user.email, subject, body, }); return { status, subject, body }; }Queueing the getUser step...Effortless setupWith a simple declarative API to define and use your workflows.Creating a workflowimport { sleep } from "workflow"; import { createUser, sendWelcomeEmail, sendOneWeekCheckInEmail } from "./steps" export async function userSignup(email) { "use workflow"; // Create the user and send the welcome email const user = await createUser(email); await sendWelcomeEmail(email); // Pause for 7 days // without consuming any resources await sleep("7 days"); await sendOneWeekCheckInEmail(email); return { userId: user.id, status: "done" }; }Defining stepsimport { Resend } from 'resend'; import { FatalError } from 'workflow'; export async function sendWelcomeEmail(email) { "use step" const resend = new Resend('YOUR_API_KEY'); const resp = await resend.emails.send({ from: 'Acme <onboarding@resend.dev>', to: [email], subject: 'Welcome!', html: `Thanks for joining Acme.`, }); if (resp.error) { throw new FatalError(resp.error.message); } }; // Other steps...Universally CompatibleWorks with the frameworks you already use with more coming soon.Deep integration with AI SDKUse familiar AI SDK patterns, plus durability, observability, and retries so agents stay reliable in production.Durable agents by defaultHigh-performance streaming, persistence, and resumable runs work out of the box. No infrastructure setup required.Inspect every run end‑to‑endObservability is built into the SDK and works anywhere you run it. When using workflow on Vercel, observability is built into the Vercel dashboard with no configuration or storage.StatusRunningRun IDwrun_02456KXRDuration0msworkflow()925msfetchOrder()230msvalidate()155msenrichWithPricing()230mssaveOrder()155mssendEmail()155msRun anywhere, no lock‑inRun locally, self-host, or swap every component — Workflow SDK is fully portable. For zero-config, secure, and scalable workflows, deploy on Vercel.Workflows on VercelLearn about self-hostingexport async function welcome(userId: string) { "use workflow"; const user = await getUser(userId); const { subject, body } = await generateEmail({ name: user.name, plan: user.plan }); const { status } = await sendEmail({ to: user.email, subject, body, }); return { status, subject, body }; }Workflow SDK on VercelZero infrastructure management, atomic versioning, and out of the box observability. Vercel makes Workflows easy.Learn moreBuild anything withBuild reliable, long-running processes with automatic retries, state persistence, and observability built in.export async function aiAgentWorkflow(query: string) { "use workflow"; // Step 1: Generate initial response const response = await generateResponse(query); // Step 2: Research and validate const facts = await researchFacts(response); // Step 3: Refine with fact-checking const refined = await refineWithFacts(response, facts); return { response: refined, sources: facts }; }Get startedSee Workflow SDK in action with one of the example templates.All examplesStory Generator Slack BotA Slack bot that generates children's stories from collaborative input.Flight Booking AppUse Workflow to make AI agents more reliable and production-ready.Natural Language Image SearchA free, open-source template for building natural language image search.What builders say about Workflow SDKRResend@resendResend + @vercel Workflow SDKA match made in heavenMMichael Carter@michaelcaaarterWe just migrated to use workflow and it's beautiful. Production app here, VC backed and many real fortune 100 customers using our app daily… not sure why you wouldn't use workflow to move fast and focus on building a great experience.NNick Tikhonov@nick_tikhonovfully migrated to workflows - our use case are AI agents that execute over a multiple-day time frame, making multiple outbound voice calls and processing the resultsbefore: - scheduling service - queues - workers - cron jobsnow: - 5 functions in one file🤯RRyan Carson@ryancarsonWhat a time to be a content marketer.Sheesh this is mind-blowing.Built a complete end-to-end workflow with @ampcode using @WorkflowSDK and @vercel AI Gateway- Custom DurableAgent tools for research - Opus 4.5 for generation - Gemini 3 Pro for content verification- Nano Banana for image creationAEO locked in.AAle Vigano@ale__viganoDuring my time at @mercadopago we struggled a lot with concurrency issues handling millions of payments.Hard to believe that almost all the complexity I remember from back then is now solved with just a use workflowKKumar Abhirup@kumarethVercel's use workflow is game changing.Temporal existed for years, but AI Agents are what brought the critical demand for durable execution.NNikita | Scaling Postgres@nikitabaseuse workflow is beautifulYYash Solanki@YashSolanki_If you're building any agentic workflow, then you should definitely watch this.I feel like using workflow will become the go-to choice for your projects.Whether it's a side project or complex agentic flows, use workflow by @vercel just makes so much sense now.Love that the logs screen makes it easier to see what's going.SSree@eersningtonvercel has the vibe as apple during steve jobs eradurable workflows aren't anything new (and a massive headache to roll your own too), but vercel isn't afraid of doing things differently and reinvent them in a way that feels clean and effortlessthis is really exciting to meCreate your first workflow today.Get started