mcpField
W
workflow-devkit

workflow-devkit

github.com/johnlindquistDevelopment2642 installsUpdated 45w ago
Repository

About workflow-devkit

workflow-devkit is a development skill for building durable workflows with retries, persisted state, and observability. It covers orchestration patterns as well as AI workflows using DurableAgent.

Key features

  1. 01Durable workflow orchestration
  2. 02Retriable atomic steps
  3. 03Webhook callbacks
  4. 04Event-driven actors
  5. 05Streaming updates
  6. 06Durable AI workflows

Use cases

  1. 01Orchestrating long-running operations
  2. 02Retrying transient task failures
  3. 03Handling human callbacks
  4. 04Building event-driven processes

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/johnlindquist/claude --skill workflow-devkit

After installing, type/workflow-devkitin Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

ai-integration.md
api-reference.md
patterns.md
templates/
actor-workflow.ts
ai-agent-workflow.ts
api-routes.ts
basic-workflow.ts

Details

From the project README

Workflow DevKit

Build reliable, long-running processes with automatic retries, state persistence, and observability.

Quick Reference

PatternUse CaseKey API
WorkflowsOrchestrate durable operations"use workflow" directive
StepsAtomic, retriable units"use step" directive
WebhooksHuman-in-the-loop, callbackscreateWebhook()
ActorsEvent-driven state machinesdefineHook() + for await
StreamingReal-time frontend updatesgetWritable() / run.readable
AI AgentsDurable LLM workflowsDurableAgent + globalThis.fetch = fetch
AI GatewayMulti-provider model switching"provider/model" strings, @ai-sdk/gateway

Prerequisites

pnpm add workflow @workflow/ai ai @ai-sdk/gateway zod

Core Concepts

Workflows ("use workflow")
import { sleep } from "workflow";

export async function myWorkflow(input: string) {
  "use workflow";
  const result = await step1(input);
  await sleep("5s");
  return result;
}
Steps ("use step") - MUST be in SAME FILE as workflow
async function step1(input: string) {
  "use step";
  return await fetch(`/api/data?q=${input}`).then(r => r.json());
}
Error Types
import { FatalError, RetryableError } from "workflow";

// Auto-retried
throw new Error("Transient failure");

// No retry - stops workflow
throw new FatalError("Invalid credentials");

// Custom retry timing
throw new RetryableError("Rate limited", { retryAfter: "60s" });

Detailed Documentation

Imports Cheat Sheet

// Core workflow
import {
  sleep, fetch, FatalError, RetryableError,
  createWebhook, createHook, defineHook,
  getWritable, getWorkflowMetadata, getStepMetadata,
} from "workflow";

// API routes
import { start, getRun } from "workflow/api";

// AI integration
import { DurableAgent } from "@workflow/ai/agent";
import { generateText, generateObject } from "ai";
import { createUIMessageStreamResponse } from "ai";

Examples Directory

Reference implementations: ~/dev/workflow-examples/

ExamplePattern
nextjs/Basic user signup workflow
kitchen-sink/All patterns reference
actors/Event-driven actor pattern
ai-sdk-workflow-patterns/AI agent patterns
flight-booking-app/DurableAgent with tools
rag-agent/RAG with PostgreSQL + embeddings
birthday-card-generator/Webhooks + scheduling

Comments

Markdown supported