|
| 1 | +# CopilotKit <> LangGraph Starter |
| 2 | + |
| 3 | +This is a starter template for building AI agents using [LangGraph](https://www.langchain.com/langgraph) and [CopilotKit](https://copilotkit.ai). It provides a modern Next.js application with an integrated LangGraph agent to be built on top of. |
| 4 | + |
| 5 | +## Prerequisites |
| 6 | + |
| 7 | +- Node.js 18+ |
| 8 | +- Python 3.8+ |
| 9 | +- Any of the following package managers: |
| 10 | + - [pnpm](https://pnpm.io/installation) (recommended) |
| 11 | + - npm |
| 12 | + - [yarn](https://classic.yarnpkg.com/lang/en/docs/install/#mac-stable) |
| 13 | + - [bun](https://bun.sh/) |
| 14 | +- OpenAI API Key (for the LangGraph agent) |
| 15 | + |
| 16 | +> **Note:** This repository ignores lock files (package-lock.json, yarn.lock, pnpm-lock.yaml, bun.lockb) to avoid conflicts between different package managers. Each developer should generate their own lock file using their preferred package manager. After that, make sure to delete it from the .gitignore. |
| 17 | +
|
| 18 | +## Getting Started |
| 19 | + |
| 20 | +1. Install dependencies using your preferred package manager: |
| 21 | +```bash |
| 22 | +# Using pnpm (recommended) |
| 23 | +pnpm install |
| 24 | + |
| 25 | +# Using npm |
| 26 | +npm install |
| 27 | + |
| 28 | +# Using yarn |
| 29 | +yarn install |
| 30 | + |
| 31 | +# Using bun |
| 32 | +bun install |
| 33 | +``` |
| 34 | + |
| 35 | +2. Install Python dependencies for the LangGraph agent: |
| 36 | +```bash |
| 37 | +# Using pnpm |
| 38 | +pnpm install:agent |
| 39 | + |
| 40 | +# Using npm |
| 41 | +npm run install:agent |
| 42 | + |
| 43 | +# Using yarn |
| 44 | +yarn install:agent |
| 45 | + |
| 46 | +# Using bun |
| 47 | +bun run install:agent |
| 48 | +``` |
| 49 | + |
| 50 | +3. Set up your OpenAI API key: |
| 51 | +```bash |
| 52 | +echo 'OPENAI_API_KEY=your-openai-api-key-here' > agent/.env |
| 53 | +``` |
| 54 | + |
| 55 | +4. Start the development server: |
| 56 | +```bash |
| 57 | +# Using pnpm |
| 58 | +pnpm dev |
| 59 | + |
| 60 | +# Using npm |
| 61 | +npm run dev |
| 62 | + |
| 63 | +# Using yarn |
| 64 | +yarn dev |
| 65 | + |
| 66 | +# Using bun |
| 67 | +bun run dev |
| 68 | +``` |
| 69 | + |
| 70 | +This will start both the UI and agent servers concurrently. |
| 71 | + |
| 72 | +## Available Scripts |
| 73 | +The following scripts can also be run using your preferred package manager: |
| 74 | +- `dev` - Starts both UI and agent servers in development mode |
| 75 | +- `dev:debug` - Starts development servers with debug logging enabled |
| 76 | +- `dev:ui` - Starts only the Next.js UI server |
| 77 | +- `dev:agent` - Starts only the LangGraph agent server |
| 78 | +- `build` - Builds the Next.js application for production |
| 79 | +- `start` - Starts the production server |
| 80 | +- `lint` - Runs ESLint for code linting |
| 81 | +- `install:agent` - Installs Python dependencies for the agent |
| 82 | + |
| 83 | +## Documentation |
| 84 | + |
| 85 | +The main UI component is in `src/app/page.tsx`. You can: |
| 86 | +- Modify the theme colors and styling |
| 87 | +- Add new frontend actions |
| 88 | +- Customize the CopilotKit sidebar appearance |
| 89 | + |
| 90 | +## 📚 Documentation |
| 91 | + |
| 92 | +- [LangGraph Documentation](https://langchain-ai.github.io/langgraph/) - Learn more about LangGraph and its features |
| 93 | +- [CopilotKit Documentation](https://docs.copilotkit.ai) - Explore CopilotKit's capabilities |
| 94 | +- [Next.js Documentation](https://nextjs.org/docs) - Learn about Next.js features and API |
| 95 | +- [YFinance Documentation](https://pypi.org/project/yfinance/) - Financial data tools |
| 96 | + |
| 97 | +## Contributing |
| 98 | + |
| 99 | +Feel free to submit issues and enhancement requests! This starter is designed to be easily extensible. |
| 100 | + |
| 101 | +## License |
| 102 | + |
| 103 | +This project is licensed under the MIT License - see the LICENSE file for details. |
| 104 | + |
| 105 | +## Troubleshooting |
| 106 | + |
| 107 | +### Agent Connection Issues |
| 108 | +If you see "I'm having trouble connecting to my tools", make sure: |
| 109 | +1. The LangGraph agent is running on port 8000 |
| 110 | +2. Your OpenAI API key is set correctly |
| 111 | +3. Both servers started successfully |
| 112 | + |
| 113 | +### Python Dependencies |
| 114 | +If you encounter Python import errors: |
| 115 | +```bash |
| 116 | +cd agent |
| 117 | +pip install -r requirements.txt |
| 118 | +``` |
0 commit comments