Skip to content

Commit 6ec8b7d

Browse files
committed
chore: add install script for agent
Signed-off-by: Tyler Slaton <tyler@copilotkit.ai>
1 parent 1ee1afb commit 6ec8b7d

File tree

4 files changed

+35
-18
lines changed

4 files changed

+35
-18
lines changed

README.md

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -32,27 +32,15 @@ yarn install
3232
bun install
3333
```
3434

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
35+
> **Note:** Installing the package dependencies will also install the agent's python dependencies via the `install:agent` script.
4236
43-
# Using yarn
44-
yarn install:agent
45-
46-
# Using bun
47-
bun run install:agent
48-
```
4937

50-
3. Set up your OpenAI API key:
38+
2. Set up your OpenAI API key:
5139
```bash
5240
echo 'OPENAI_API_KEY=your-openai-api-key-here' > agent/.env
5341
```
5442

55-
4. Start the development server:
43+
3. Start the development server:
5644
```bash
5745
# Using pnpm
5846
pnpm dev
@@ -113,6 +101,5 @@ If you see "I'm having trouble connecting to my tools", make sure:
113101
### Python Dependencies
114102
If you encounter Python import errors:
115103
```bash
116-
cd agent
117-
pip install -r requirements.txt
104+
npm install:agent
118105
```

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
"build": "next build",
1111
"start": "next start",
1212
"lint": "next lint",
13-
"install:agent": "cd agent && pip install -r requirements.txt"
13+
"install:agent": "sh ./scripts/setup-agent.sh || scripts/setup-agent.bat",
14+
"postinstall": "npm run install:agent"
1415
},
1516
"dependencies": {
1617
"@ag-ui/langgraph": "0.0.7",

scripts/setup-agent.bat

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
@echo off
2+
REM Navigate to the agent directory
3+
cd /d "%~dp0\..\agent" || exit /b 1
4+
5+
REM Create virtual environment if it doesn't exist
6+
if not exist ".venv" (
7+
python -m venv .venv
8+
)
9+
10+
REM Activate the virtual environment
11+
call .venv\Scripts\activate.bat
12+
13+
REM Install requirements using pip
14+
pip install -r requirements.txt

scripts/setup-agent.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
3+
# Navigate to the agent directory
4+
cd "$(dirname "$0")/../agent" || exit 1
5+
6+
# Create virtual environment if it doesn't exist
7+
if [ ! -d ".venv" ]; then
8+
python3 -m venv .venv || python -m venv .venv
9+
fi
10+
11+
# Activate the virtual environment
12+
source .venv/bin/activate
13+
14+
# Install requirements using pip3 or pip
15+
(pip3 install -r requirements.txt || pip install -r requirements.txt)

0 commit comments

Comments
 (0)