|
| 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 | +> **Note:** Installing the package dependencies will also install the agent's python dependencies via the `install:agent` script. |
| 36 | +
|
| 37 | + |
| 38 | +2. Set up your OpenAI API key: |
| 39 | +```bash |
| 40 | +echo 'OPENAI_API_KEY=your-openai-api-key-here' > agent/.env |
| 41 | +``` |
| 42 | + |
| 43 | +3. Start the development server: |
| 44 | +```bash |
| 45 | +# Using pnpm |
| 46 | +pnpm dev |
| 47 | + |
| 48 | +# Using npm |
| 49 | +npm run dev |
| 50 | + |
| 51 | +# Using yarn |
| 52 | +yarn dev |
| 53 | + |
| 54 | +# Using bun |
| 55 | +bun run dev |
| 56 | +``` |
| 57 | + |
| 58 | +This will start both the UI and agent servers concurrently. |
| 59 | + |
| 60 | +## Available Scripts |
| 61 | +The following scripts can also be run using your preferred package manager: |
| 62 | +- `dev` - Starts both UI and agent servers in development mode |
| 63 | +- `dev:debug` - Starts development servers with debug logging enabled |
| 64 | +- `dev:ui` - Starts only the Next.js UI server |
| 65 | +- `dev:agent` - Starts only the LangGraph agent server |
| 66 | +- `build` - Builds the Next.js application for production |
| 67 | +- `start` - Starts the production server |
| 68 | +- `lint` - Runs ESLint for code linting |
| 69 | +- `install:agent` - Installs Python dependencies for the agent |
| 70 | + |
| 71 | +## Documentation |
| 72 | + |
| 73 | +The main UI component is in `src/app/page.tsx`. You can: |
| 74 | +- Modify the theme colors and styling |
| 75 | +- Add new frontend actions |
| 76 | +- Customize the CopilotKit sidebar appearance |
| 77 | + |
| 78 | +## 📚 Documentation |
| 79 | + |
| 80 | +- [LangGraph Documentation](https://langchain-ai.github.io/langgraph/) - Learn more about LangGraph and its features |
| 81 | +- [CopilotKit Documentation](https://docs.copilotkit.ai) - Explore CopilotKit's capabilities |
| 82 | +- [Next.js Documentation](https://nextjs.org/docs) - Learn about Next.js features and API |
| 83 | +- [YFinance Documentation](https://pypi.org/project/yfinance/) - Financial data tools |
| 84 | + |
| 85 | +## Contributing |
| 86 | + |
| 87 | +Feel free to submit issues and enhancement requests! This starter is designed to be easily extensible. |
| 88 | + |
| 89 | +## License |
| 90 | + |
| 91 | +This project is licensed under the MIT License - see the LICENSE file for details. |
| 92 | + |
| 93 | +## Troubleshooting |
| 94 | + |
| 95 | +### Agent Connection Issues |
| 96 | +If you see "I'm having trouble connecting to my tools", make sure: |
| 97 | +1. The LangGraph agent is running on port 8000 |
| 98 | +2. Your OpenAI API key is set correctly |
| 99 | +3. Both servers started successfully |
| 100 | + |
| 101 | +### Python Dependencies |
| 102 | +If you encounter Python import errors: |
| 103 | +```bash |
| 104 | +npm install:agent |
| 105 | +``` |
0 commit comments