Skip to content

Commit 56e70ba

Browse files
authored
Initial commit
0 parents  commit 56e70ba

23 files changed

+814
-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/[email protected]
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: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
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+
```

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)