|
| 1 | +# KaibanJS React Playground |
| 2 | + |
| 3 | +This playground demonstrates various KaibanJS features including workflow-driven agents, LLM integrations, and team collaboration patterns. |
| 4 | + |
| 5 | +## Features |
| 6 | + |
| 7 | +- **Workflow-Driven Agents**: Demonstrates structured workflow execution |
| 8 | +- **Multi-SDK Integration**: Combines LangChain and Vercel AI SDK |
| 9 | +- **Team Collaboration**: Shows how different agent types work together |
| 10 | +- **Storybook Integration**: Interactive examples and documentation |
| 11 | + |
| 12 | +## Environment Variables |
| 13 | + |
| 14 | +Create a `.env` file in the root directory with the following variables: |
| 15 | + |
| 16 | +```bash |
| 17 | +# OpenAI API Key for LangChain and AI SDK |
| 18 | +VITE_OPENAI_API_KEY=your_openai_api_key_here |
| 19 | + |
| 20 | +# Anthropic API Key for ReactChampionAgent |
| 21 | +VITE_ANTHROPIC_API_KEY=your_anthropic_api_key_here |
| 22 | + |
| 23 | +# Tavily API Key for web search |
| 24 | +VITE_TAVILY_API_KEY=your_tavily_api_key_here |
| 25 | +``` |
| 26 | + |
| 27 | +## Getting Started |
| 28 | + |
| 29 | +1. **Build the workflow package first** (required for local development): |
| 30 | + |
| 31 | + ```bash |
| 32 | + cd ../../packages/workflow |
| 33 | + npm install |
| 34 | + npm run build |
| 35 | + cd ../../playground/react |
| 36 | + ``` |
| 37 | + |
| 38 | + > **Important**: The workflow package must be built before running the playground because it uses a local file reference (`file:../../packages/workflow`) in its dependencies. This ensures the latest workflow code is available to the playground. |
| 39 | +
|
| 40 | +2. Install dependencies: |
| 41 | + |
| 42 | + ```bash |
| 43 | + npm install |
| 44 | + ``` |
| 45 | + |
| 46 | +3. Set up environment variables (see above) |
| 47 | + |
| 48 | +4. Start the development server: |
| 49 | + |
| 50 | + ```bash |
| 51 | + npm run dev |
| 52 | + ``` |
| 53 | + |
| 54 | +5. Start Storybook for interactive examples: |
| 55 | + ```bash |
| 56 | + npm run storybook |
| 57 | + ``` |
| 58 | + |
| 59 | +## Available Stories |
| 60 | + |
| 61 | +- **Basic Workflow**: Simple mathematical workflow |
| 62 | +- **Complex Workflow**: Advanced patterns with conditional logic |
| 63 | +- **Suspension Workflow**: Workflow with pause/resume capabilities |
| 64 | +- **Mixed Team**: WorkflowDrivenAgent + ReactChampionAgent collaboration |
| 65 | +- **LangChain + AI SDK Workflow**: Multi-SDK integration example |
| 66 | +- **LangChain Only Workflow**: Pure LangChain implementation |
| 67 | +- **AI SDK Only Workflow**: Pure Vercel AI SDK implementation with web search tool |
| 68 | + |
| 69 | +## Troubleshooting |
| 70 | + |
| 71 | +### Common Issues |
| 72 | + |
| 73 | +1. **"Module not found" errors**: Make sure you've built the workflow package first (step 1 above) |
| 74 | + |
| 75 | +2. **"crypto.randomUUID is not a function"**: This is a browser compatibility issue. The workflow package includes a polyfill, but you may need to clear your browser cache or restart the dev server. |
| 76 | + |
| 77 | +3. **API Key errors**: Ensure all required environment variables are set in your `.env` file |
| 78 | + |
| 79 | +4. **Tool calling errors**: Make sure you have the latest version of the AI SDK packages installed |
| 80 | + |
| 81 | +### Rebuilding After Changes |
| 82 | + |
| 83 | +If you make changes to the workflow package, you'll need to rebuild it: |
| 84 | + |
| 85 | +```bash |
| 86 | +cd ../../packages/workflow |
| 87 | +npm run build |
| 88 | +cd ../../playground/react |
| 89 | +# Restart your dev server or Storybook |
| 90 | +``` |
0 commit comments