Skip to content
Dashboard

How Mux shipped durable workflows with @mux/ai SDK

Director of Self Service, Mux

Link to headingThe problem with AI video pipelines

Link to headingWhy Workflow DevKit was the right fit

Link to headingHow it works in practice

import { getSummaryAndTags, getModerationScores } from '@mux/ai/workflows';
export async function processVideo(assetId: string) {
"use workflow";
const summaryResp = await getSummaryAndTags(assetId);
// ✅ Step succeeds. The summaryResp is persisted.
const moderationResp = await getModerationScores(assetId, {
thresholds: { sexual: 0.7, violence: 0.8 }
});
// ❌ Step fails. Workflow is suspended.
// ✅ Replay happens and picks back up right here
// without re-doing the getSummaryAndTags work above.
// ✅ Step succeeds. The moderationResp is persisted.
// With Workflow DevKit, you can nest your own "use workflow"
// and "use step" functions inside a larger "use workflow"
const emailResp = await emailUser(assetId);
// ✅ The nested workflow succeeds. Each step
// inside your emailUser workflow is treated as an
// isolated step.
return { summaryResp, moderationResp, emailResp };
}

Link to headingDeploy anywhere, scale on Vercel

Link to headingWhat you can build

Link to headingGetting started

Link to headingWhat's next

Link to headingResources