Vercel Workflow SDK

repository·main·Indexed 24 days ago

https://github.com/vercel/workflow

A set of packages for defining and executing workflows, including @workflow/core for the runtime, @workflow/nest for NestJS integration, and @workflow/ai for AI SDK compatibility (supporting v5 and v6). It includes a builder system using esbuild and SWC to transform workflow directives like "use workflow" and "use step" into deployable bundles.

Tokens
262.8K
Snippets
520
Records
1.1K
Agent score
79%

What's inside vercel-workflow

  1. Overview of Workflow SDK configuration areas

    main

    Configuration for the Workflow SDK is divided into several specialized areas depending on your integration needs:

    • Framework options: Build-time and dev-server settings for specific frameworks like Next.js, Nitro, NestJS, Astro, SvelteKit, and Rollup.
    • Worlds: Configuration for the execution environment, including WORKFLOW_TARGET_WORLD, Local World, Postgres World, and Vercel World.
    • Runtime tuning: Performance and behavior settings such as replay budgets, inline execution, queue delivery limits, compression, tracing, and advanced runtime escape hatches.
    • Build and diagnostics: Controls for public manifests, HMR logs, and source-map settings.
    • CLI and web UI: Settings for observability tools like workflow inspect, workflow web, workflow health, and observability environment overrides.
  2. What is @workflow/world-local?

    main
    @workflow/world-local is a filesystem-based workflow backend designed for local development and testing. It stores workflow data as JSON files on disk and utilizes in-memory queuing. It is designed to automatically detect the development server port for queue transport and is used by default when running next dev or next start.
  3. Overview of @workflow/world-vercel

    main
    @workflow/world-vercel is the production workflow backend designed for Vercel platform deployments. It integrates with Vercel's infrastructure for storage, queuing, and authentication, handling workflow persistence and scaling. In Vercel deployments, authentication and API endpoints are configured automatically.
  4. Browse Workflow SDK API Reference by package

    main

    The Workflow SDK provides a variety of specialized packages for different environments and use cases. You can find detailed API references for the following categories:

    Core & Runtime

    • Workflow Globals: Deterministic APIs, Web Platform APIs, and environment variables available inside workflow functions.
    • workflow: Core primitives including steps, context management, streaming, webhooks, and error handling.
    • workflow/api: Runtime functions from the workflow/api package.
    • workflow/runtime: Functions for resolving the World instance and the low-level World SDK.

    Framework Integrations

    • workflow/next: Next.js integration for automatic bundling and runtime support.
    • workflow/nitro: Nitro module for bundling and runtime support.
    • workflow/nuxt: Nuxt module for bundling and runtime support.
    • workflow/sveltekit: SvelteKit Vite plugin for bundling and runtime support.
    • workflow/astro: Astro integration for bundling and runtime support.
    • workflow/vite: Standalone Vite plugin for bundling and runtime support.
    • workflow/nest: NestJS module for bundling and runtime support.

    Utilities & Specialized Tooling

    • workflow/observability: Utilities for hydrating step I/O, parsing display names, and decrypting workflow data.
    • workflow/errors: Semantic error types for handling workflow storage backend failures.
    • @workflow/serde: Serialization symbols for custom class serialization in workflows.
    • @workflow/ai: Helpers for integrating AI SDK for building AI-powered workflows.
    • @workflow/vitest: Vitest plugin and test helpers for in-process integration testing of workflows.
  5. Browse the Workflow SDK API Reference by package

    main

    The Workflow SDK is organized into several specialized packages. Use the following package categories to find the specific functions and primitives you need for your implementation:

    • Workflow Globals: Deterministic APIs, Web Platform APIs, and environment variables available inside workflow functions.
    • workflow: Core primitives including steps, context management, streaming, webhooks, and error handling.
    • workflow/api: Runtime functions from the workflow/api package.
    • workflow/runtime: Low-level World SDK functions for resolving the World instance, storage, and analytics queries.
    • workflow/observability: Utilities for hydrating step I/O, parsing display names, and decrypting workflow data.
    • Framework Integrations:
      • @workflow/next: Next.js integration for automatic bundling and runtime support.
      • @workflow/nitro: Nitro module for bundling and runtime support.
      • @workflow/nuxt: Nuxt module for bundling and runtime support.
      • @workflow/sveltekit: SvelteKit Vite plugin for bundling and runtime support.
      • @workflow/astro: Astro integration for bundling and runtime support.
      • @workflow/vite: Standalone Vite plugin for bundling and runtime support.
      • @workflow/nest: NestJS module for bundling and runtime support.
    • Specialized Utilities:
      • @workflow/errors: Semantic error types for workflow storage backend failures.
      • @workflow/serde: Serialization symbols for custom class serialization.
      • @workflow/ai: Helpers for integrating AI SDK for AI-powered workflows.
      • @workflow/vitest: Vitest plugin and test helpers for in-process integration testing.
  6. Use @workflow/nuxt with Nuxt

    main

    The @workflow/nuxt package is a Nuxt module designed for use with the Workflow SDK.

    One key feature of this module is its seamless support for monorepo workspace package imports. You do not need to provide extra workflow configuration for monorepo setups because @workflow/nuxt automatically utilizes Nitro's detected workspaceDir to resolve workspace packages.