### Clone Repository and Install Dependencies Source: https://github.com/vercel/workflow-examples/blob/main/rag-agent/README.md Use this command to clone the example repository and install the necessary project dependencies. ```bash git clone https://github.com/vercel/workflow-examples cd workflow-examples/rag-agent pnpm install ``` -------------------------------- ### Run Development Server with npm, pnpm, or bun Source: https://github.com/vercel/workflow-examples/blob/main/actors/README.md Start the local development server to test the actor example. Access the application via http://localhost:3000 in your browser. ```bash npm run dev # or pnpm dev # or bun dev ``` -------------------------------- ### Start Development Server (Bash) Source: https://github.com/vercel/workflow-examples/blob/main/tanstack-start/README.md Start the local development server for the TanStack Start project. ```bash pnpm dev ``` -------------------------------- ### Clone Nuxt Workflow Example and Install Dependencies Source: https://github.com/vercel/workflow-examples/blob/main/nuxt/README.md Clone the Nuxt workflow example repository and install project dependencies using pnpm. ```bash git clone https://github.com/vercel/workflow-examples cd workflow-examples/nuxt pnpm install ``` -------------------------------- ### Install Dependencies Source: https://github.com/vercel/workflow-examples/blob/main/ffmpeg-processing/README.md Clone the repository and install project dependencies using pnpm. ```bash git clone https://github.com/vercel/workflow-examples cd workflow-examples/ffmpeg-processing pnpm install ``` -------------------------------- ### Start Development Server Source: https://github.com/vercel/workflow-examples/blob/main/nitro/README.md Run this command to start the Nitro development server locally. ```bash pnpm dev ``` -------------------------------- ### Clone and Install Dependencies Source: https://github.com/vercel/workflow-examples/blob/main/postgres/README.md Clone the repository and install project dependencies using bun. ```bash git clone https://github.com/vercel/workflow-examples cd workflow-examples/postgres bun install ``` -------------------------------- ### Start Development Server with Bun Source: https://github.com/vercel/workflow-examples/blob/main/custom-adapter/README.md Starts the development server using the Bun runtime. The server will be accessible at http://localhost:3152. ```bash bun run dev ``` -------------------------------- ### Install Dependencies with pnpm Source: https://github.com/vercel/workflow-examples/blob/main/sveltekit/README.md Clone the repository and install project dependencies using pnpm. ```bash git clone https://github.com/vercel/workflow-examples cd workflow-examples/sveltekit pnpm install ``` -------------------------------- ### API Request Example Source: https://github.com/vercel/workflow-examples/blob/main/ffmpeg-processing/README.md Example of how to use curl to send an audio file to the /convert endpoint for compression. ```bash curl -X POST -F "file=@podcast.wav;type=audio/wav" -H "Expect:" http://localhost:3000/convert --output podcast.m4a ``` -------------------------------- ### Clone and Install Dependencies with PNPM Source: https://github.com/vercel/workflow-examples/blob/main/astro/README.md Clone the repository and install project dependencies using PNPM. Ensure you have PNPM installed globally. ```bash git clone https://github.com/vercel/workflow-examples cd workflow-examples/astro pnpm install ``` -------------------------------- ### Clone and Install Dependencies Source: https://github.com/vercel/workflow-examples/blob/main/flight-booking-app/README.md Clone the repository and install project dependencies using pnpm. ```bash git clone https://github.com/vercel/workflow-examples cd workflow-examples/flight-booking-app pnpm install ``` -------------------------------- ### Start Workflow Programmatically Source: https://github.com/vercel/workflow-examples/blob/main/custom-adapter/README.md Demonstrates how to start a workflow function programmatically using the 'start' API from the 'workflow/api' module. Requires importing the workflow function and its arguments. ```typescript import { start } from "workflow/api"; import { handleUserSignup } from "./workflows/user-signup.js"; const run = await start(handleUserSignup, [email]); console.log(run.runId); ``` -------------------------------- ### Install Dependencies with pnpm Source: https://github.com/vercel/workflow-examples/blob/main/vite/README.md Use this command to install project dependencies using pnpm. Ensure pnpm is installed globally. ```bash git clone https://github.com/vercel/workflow-examples cd workflow-examples/vite pnpm install ``` -------------------------------- ### Start Development Server Source: https://github.com/vercel/workflow-examples/blob/main/postgres/README.md Initiate the Next.js development server. The `instrumentation.ts` file is used to start the Postgres world worker upon server boot. ```bash bun dev ``` -------------------------------- ### Install Dependencies with pnpm Source: https://github.com/vercel/workflow-examples/blob/main/nitro/README.md Use this command to clone the repository and install project dependencies using pnpm. ```bash git clone https://github.com/vercel/workflow-examples cd workflow-examples/nitro pnpm install ``` -------------------------------- ### Install Dependencies with Bun Source: https://github.com/vercel/workflow-examples/blob/main/custom-adapter/README.md Installs project dependencies using the Bun package manager. ```bash bun install ``` -------------------------------- ### Install Dependencies with pnpm Source: https://github.com/vercel/workflow-examples/blob/main/nextjs/README.md Use this command to clone the repository and install project dependencies using pnpm. ```bash git clone https://github.com/vercel/workflow-examples cd workflow-examples/nextjs pnpm install ``` -------------------------------- ### Clone Repository and Install Dependencies Source: https://github.com/vercel/workflow-examples/blob/main/ai-sdk-workflow-patterns/README.md Clone the project repository and install the necessary Node.js dependencies using pnpm. ```bash git clone https://github.com/vercel/workflow-examples cd workflow-examples/ai-sdk-workflow-patterns pnpm install ``` -------------------------------- ### Clone and Install Hono Project Source: https://github.com/vercel/workflow-examples/blob/main/hono/README.md Clone the repository and install project dependencies using pnpm. ```bash git clone https://github.com/vercel/workflow-examples cd workflow-examples/hono pnpm install ``` -------------------------------- ### Run Database Migration Source: https://github.com/vercel/workflow-examples/blob/main/postgres/README.md Execute the database setup command to create or update Workflow tables. Run this command again after upgrading `@workflow/world-postgres` to keep the database schema synchronized. ```bash bun run migrate ``` -------------------------------- ### Install Dependencies with npm, pnpm, or bun Source: https://github.com/vercel/workflow-examples/blob/main/actors/README.md Install project dependencies using your preferred package manager. This step is required before running the development server. ```bash npm install # or pnpm install # or bun install ``` -------------------------------- ### Bun Server with WebSockets and Routes Source: https://github.com/vercel/workflow-examples/blob/main/custom-adapter/CLAUDE.md Example of a Bun server handling HTTP requests, including dynamic routes and WebSocket connections. Enable hot module replacement and console logging for development. ```typescript import index from "./index.html" Bun.serve({ routes: { "/": index, "/api/users/:id": { GET: (req) => { return new Response(JSON.stringify({ id: req.params.id })); }, }, }, // optional websocket support websocket: { open: (ws) => { ws.send("Hello, world!"); }, message: (ws, message) => { ws.send(message); }, close: (ws) => { // handle close } }, development: { hmr: true, console: true, } }) ``` -------------------------------- ### Start New Actor Source: https://github.com/vercel/workflow-examples/blob/main/actors/README.md Initiates a new actor instance with specified initial state. ```APIDOC ## POST /api/actor ### Description Starts a new actor instance. ### Method POST ### Endpoint /api/actor ### Request Body - **initialState** (object) - Required - The initial state for the actor. - **count** (number) - The initial count value. - **lastUpdated** (string) - The timestamp of the last update. - **history** (array) - An array to log event history. ### Request Example ```json { "initialState": { "count": 0, "lastUpdated": "2024-01-01T00:00:00.000Z", "history": [] } } ``` ### Response #### Success Response (200) - **success** (boolean) - Indicates if the actor started successfully. - **actorId** (string) - The unique identifier for the newly created actor. - **message** (string) - A confirmation message. #### Response Example ```json { "success": true, "actorId": "run_abc123...", "message": "Actor started successfully" } ``` ``` -------------------------------- ### Trigger User Signup Workflow Source: https://github.com/vercel/workflow-examples/blob/main/custom-adapter/README.md Initiates the user signup workflow by making a GET request to the local server. Expects a JSON response containing the workflow run ID. ```bash curl http://localhost:3152 ``` -------------------------------- ### Install Dependencies - Birthday Card Generator Source: https://github.com/vercel/workflow-examples/blob/main/birthday-card-generator/README.md Installs project dependencies using pnpm. It's recommended to use pnpm for this project. ```bash pnpm install ``` -------------------------------- ### Start New Actor Instance Response Body Source: https://github.com/vercel/workflow-examples/blob/main/actors/README.md JSON response upon successfully starting a new actor instance. Provides a success status, actor ID, and a confirmation message. ```json { "success": true, "actorId": "run_abc123...", "message": "Actor started successfully" } ``` -------------------------------- ### Bun Test Example Source: https://github.com/vercel/workflow-examples/blob/main/custom-adapter/CLAUDE.md A basic test case using Bun's built-in testing framework. Ensure tests are in files ending with .test.ts or .spec.ts. ```typescript import { test, expect } from "bun:test"; test("hello world", () => { expect(1).toBe(1); }); ``` -------------------------------- ### Start New Actor Instance Request Body Source: https://github.com/vercel/workflow-examples/blob/main/actors/README.md JSON payload for initiating a new actor instance. Includes the initial state for the actor. ```json { "initialState": { "count": 0, "lastUpdated": "2024-01-01T00:00:00.000Z", "history": [] } } ``` -------------------------------- ### Clone Repository - Birthday Card Generator Source: https://github.com/vercel/workflow-examples/blob/main/birthday-card-generator/README.md Use this command to clone the project repository locally. Ensure you have Git installed. ```bash git clone https://github.com/vercel/workflow-examples.git cd workflow-examples/birthday-card-generator ``` -------------------------------- ### Get Actor State Source: https://github.com/vercel/workflow-examples/blob/main/actors/README.md Retrieves the current state of a specific actor instance. ```APIDOC ## GET /api/actor/[actorId]/state ### Description Gets the current state of an actor (placeholder implementation). ### Method GET ### Endpoint /api/actor/[actorId]/state ### Parameters #### Path Parameters - **actorId** (string) - Required - The ID of the actor whose state to retrieve. ### Response #### Success Response (200) - **state** (object) - The current state of the actor. - **count** (number) - The current count value. - **lastUpdated** (string) - The timestamp of the last update. - **history** (array) - An array of past events. #### Response Example ```json { "state": { "count": 10, "lastUpdated": "2024-01-01T10:30:00.000Z", "history": [ {"type": "increment", "amount": 5, "timestamp": "2024-01-01T10:00:00.000Z"}, {"type": "increment", "amount": 5, "timestamp": "2024-01-01T10:30:00.000Z"} ] } } ``` ``` -------------------------------- ### Create and Configure .env.local Source: https://github.com/vercel/workflow-examples/blob/main/flight-booking-app/README.md Create a .env.local file and add your Vercel AI Gateway API key. ```bash touch .env.local AI_GATEWAY_API_KEY=your_api_key_here ``` -------------------------------- ### Configure Environment Variables Source: https://github.com/vercel/workflow-examples/blob/main/rag-agent/README.md Add your Vercel AI Gateway API key and PostgreSQL database URL to the .env.local file. ```bash AI_GATEWAY_API_KEY=your_api_key_here DATABASE_URL=your_database_url_here ``` -------------------------------- ### Create Database Schema Source: https://github.com/vercel/workflow-examples/blob/main/flight-booking-app/README.md Execute the command to set up the database schema for the PostgreSQL World. ```bash pnpm exec workflow-postgres-setup ``` -------------------------------- ### Run Database Migrations Source: https://github.com/vercel/workflow-examples/blob/main/rag-agent/README.md Execute this command to apply database migrations for the project. ```bash pnpm db:migrate ``` -------------------------------- ### Create .env.local File Source: https://github.com/vercel/workflow-examples/blob/main/ai-sdk-workflow-patterns/README.md Create a local environment file to store sensitive credentials like API keys. ```bash touch .env.local ``` -------------------------------- ### HTML Import with React Frontend Source: https://github.com/vercel/workflow-examples/blob/main/custom-adapter/CLAUDE.md Demonstrates importing an HTML file that includes a React component and CSS. Bun automatically transpiles and bundles these assets. ```html