Skip to content

Commit 95ed35a

Browse files
Initial commit
0 parents  commit 95ed35a

25 files changed

+858
-0
lines changed

.github/workflows/smoke.yml

Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
name: Smoke
2+
3+
on:
4+
push:
5+
branches: main
6+
pull_request:
7+
branches: main
8+
schedule:
9+
- cron: '0 0 * * *' # Run daily at midnight UTC
10+
11+
jobs:
12+
smoke:
13+
name: ${{ matrix.os }} / Node ${{ matrix.node }} / Python ${{ matrix.python }}
14+
runs-on: ${{ matrix.os }}
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
os: [ubuntu-latest, windows-latest, macos-latest]
19+
node: [20, 22]
20+
python: [3.11, 3.12]
21+
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v4
25+
26+
- name: Setup Node.js
27+
uses: actions/setup-node@v4
28+
with:
29+
node-version: ${{ matrix.node }}
30+
31+
- name: Setup Python
32+
uses: actions/setup-python@v4
33+
with:
34+
python-version: ${{ matrix.python }}
35+
36+
- name: Install Node.js dependencies (root)
37+
run: npm install
38+
39+
- name: Install Node.js dependencies (agent)
40+
run: |
41+
cd agent
42+
npm install
43+
44+
- name: Install Python dependencies (agent)
45+
run: |
46+
cd agent
47+
pip install -r requirements.txt
48+
49+
- name: Build frontend
50+
run: npm run build
51+
52+
- name: Test frontend startup (Linux/macOS)
53+
if: runner.os != 'Windows'
54+
run: |
55+
# Start the Next.js frontend in background
56+
npm start &
57+
FRONTEND_PID=$!
58+
59+
# Wait for frontend to start (max 30 seconds)
60+
timeout=30
61+
elapsed=0
62+
started=false
63+
64+
while [ $elapsed -lt $timeout ] && [ "$started" = false ]; do
65+
if curl -s http://localhost:3000 > /dev/null 2>&1; then
66+
started=true
67+
echo "✅ Frontend started successfully"
68+
else
69+
sleep 1
70+
elapsed=$((elapsed + 1))
71+
fi
72+
done
73+
74+
# Clean up background process
75+
kill $FRONTEND_PID 2>/dev/null || true
76+
77+
if [ "$started" = false ]; then
78+
echo "❌ Frontend failed to start within 30 seconds"
79+
exit 1
80+
fi
81+
shell: bash
82+
83+
- name: Test frontend startup (Windows)
84+
if: runner.os == 'Windows'
85+
run: |
86+
# Start the Next.js frontend in background
87+
npm start &
88+
89+
# Wait for frontend to start (max 30 seconds)
90+
$timeout = 30
91+
$elapsed = 0
92+
$started = $false
93+
94+
while ($elapsed -lt $timeout -and -not $started) {
95+
try {
96+
$response = Invoke-WebRequest -Uri "http://localhost:3000" -TimeoutSec 1 -ErrorAction SilentlyContinue
97+
if ($response.StatusCode -eq 200) {
98+
$started = $true
99+
Write-Host "✅ Frontend started successfully"
100+
}
101+
} catch {
102+
Start-Sleep -Seconds 1
103+
$elapsed++
104+
}
105+
}
106+
107+
if (-not $started) {
108+
Write-Host "❌ Frontend failed to start within 30 seconds"
109+
exit 1
110+
}
111+
shell: pwsh
112+
113+
- name: Run linting
114+
run: npm run lint
115+
116+
notify-slack:
117+
name: Notify Slack on Failure
118+
runs-on: ubuntu-latest
119+
needs: smoke
120+
if: |
121+
failure() &&
122+
github.event_name == 'schedule'
123+
steps:
124+
- name: Notify Slack
125+
uses: slackapi/slack-github-action@v2.1.0
126+
with:
127+
webhook: ${{ secrets.SLACK_WEBHOOK_URL }}
128+
webhook-type: incoming-webhook
129+
payload: |
130+
{
131+
"text": ":warning: *Smoke test failed for `with-langgraph-python` :warning:.*",
132+
"blocks": [
133+
{
134+
"type": "section",
135+
"text": {
136+
"type": "mrkdwn",
137+
"text": ":warning: *Smoke test failed for <https://github.com/copilotkit/with-langgraph-python|with-langgraph-python> :warning:*\n\n<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View run details>"
138+
}
139+
}
140+
]
141+
}

.gitignore

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
/.pnp
6+
.pnp.*
7+
.yarn/*
8+
!.yarn/patches
9+
!.yarn/plugins
10+
!.yarn/releases
11+
!.yarn/versions
12+
13+
# testing
14+
/coverage
15+
16+
# next.js
17+
/.next/
18+
/out/
19+
20+
# production
21+
/build
22+
23+
# misc
24+
.DS_Store
25+
*.pem
26+
27+
# debug
28+
npm-debug.log*
29+
yarn-debug.log*
30+
yarn-error.log*
31+
.pnpm-debug.log*
32+
33+
# env files (can opt-in for committing if needed)
34+
.env*
35+
36+
# vercel
37+
.vercel
38+
39+
# typescript
40+
*.tsbuildinfo
41+
next-env.d.ts
42+
43+
# lock files
44+
package-lock.json
45+
yarn.lock
46+
pnpm-lock.yaml
47+
bun.lockb
48+
49+
# LangGraph API
50+
.langgraph_api

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License
2+
3+
Copyright (c) Atai Barkai
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.

README.md

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
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+
```

agent/.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
venv/
2+
__pycache__/
3+
*.pyc
4+
.env
5+
.vercel
6+
7+
# python
8+
.venv/
9+
.langgraph_api/

0 commit comments

Comments
 (0)