How Mux shipped durable video workflows with their @mux/ai SDK
By Steven Van ·
Mux's open-source @mux/ai SDK uses Vercel's Workflow DevKit so failed steps like content moderation resume instead of restarting.
Mux built @mux/ai, an open-source SDK for adding AI features to Mux's video infrastructure, and used Vercel's Workflow DevKit to make its workflows durable. A typical video AI pipeline chains several steps, fetching metadata and transcripts, running content moderation, generating summaries, chapters and translated subtitles, and a failure partway through previously meant either restarting from scratch or writing custom state management to resume.
With Workflow DevKit, functions in the SDK use "use workflow" and "use step" directives. In a standard Node environment those directives are no-ops, so @mux/ai works as a normal package with no dependency on Workflow DevKit. In a Workflow DevKit environment, they add automatic retries, state persistence and observability: if a step like content moderation fails, the workflow suspends, then resumes from that step on replay without repeating earlier work such as summary and tag generation.
Workflow state is stored in a "World": JSON files on disk for local development, or managed automatically when deployed to Vercel, which also provisions an observability dashboard for traces, logs and time-travel debugging. Self-hosting with Postgres or Redis is also supported.
@mux/ai ships with prebuilt, model-agnostic workflows (usable with OpenAI, Anthropic or Gemini) for summaries and tags, chapter generation, content moderation, translation and dubbing, and embeddings. It's open source under Apache 2.0. Read the full writeup on Vercel's blog.
