Imagine writing a function that can stop mid-execution and resume hours, days, or even weeks later without losing its place or any of its variables. No checkpoints. No state machines. No external storage. Just a function that time-travels.
Vercel Workflow is a fully managed implementation of the open source Workflow Development Kit (WDK), a TypeScript framework for building apps and AI Agents that can resume, suspend, and maintain state with ease.
With Vercel Workflow, a function can suspend itself until a desired state (e.g. a webhook event arriving), then pick up exactly where it left off with full state and stack continuity.
Here's an example of what this kind of function might look like:
We'll get into how this works in the guide below.
Let’s dive into a Slack bot that invites users to write a story together with AI.
When a user runs /storytime in Slack, the bot begins a collaborative story in a thread. Users add messages one at a time, and the AI continues the story after each contribution. When the story reaches a natural ending, the bot generates an image based on the full story.


The key is that the workflow powering this bot pauses after each message and resumes when a new one arrives, using a workflow hook. This allows the function to maintain the entire story state over time without a database or any manual state management.
Now let's go through the code.
- User types
/storytime→ Workflow starts, creates hook with unique token - AI generates introduction → Posts to Slack
- Function pauses → Waits at
for awaitloop for user messages - User adds to story → Slack webhook receives event
- Webhook resumes workflow → Uses token to find paused workflow
- AI continues story → Processes with full conversation history
- Repeat until complete → Each message resumes the workflow
- Generate final image → Workflow completes naturally
The messages array grows with each interaction, the AI always has full context, and you never think about databases or state management. This complete message history can then be used to generate the final image.

The key insight is that webhooks don't just receive events, they resume paused workflows with perfect state preservation.
Workflows are stateful functions that can pause and resume:
Steps are reliable, retryable operations within workflows:
Hooks let you pass data from external events and resume workflow execution:
- Define what an event looks like
2. Create a listener in your workflow
3. Resume the hook when events arrive
The token is the key. It's given to the hook with the corresponding token which identifies the correct workflow to resume and run.
In addition to hooks, a mechanism to orchestrate workflow pausing includes using a timer.
In traditional serverless development, functions are stateless by design. To maintain continuity, you have to scatter state across databases, message queues, and more. With workflows, your functions are stateful. They listen. They pause. They resume. They remember.
Before: "How do I coordinate these distributed systems?"
After: "What should happen when the user does X?"
Before: "Where do I store this state? How do I handle failures?"
After: "This variable holds the state. It just works."
Vercel Workflows let's you write simple functions that just work, even for complex stateful processes.
You can now build sophisticated applications by focusing on what should happen, not how to coordinate infrastructure.
The Storytime bot shows how complex, interactive systems become simple when you have the right abstractions.
Try it yourself by deploying the complete Storytime Slack bot example to see workflows in action.