Skip to content

Commit 0446f88

Browse files
committed
feat: add CI, bump deps, and add better UI
Signed-off-by: Tyler Slaton <tyler@copilotkit.ai>
1 parent 8808419 commit 0446f88

File tree

14 files changed

+413
-67
lines changed

14 files changed

+413
-67
lines changed

.github/workflows/smoke.yml

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
name: Smoke
2+
3+
on:
4+
push:
5+
branches: main
6+
pull_request:
7+
branches: main
8+
schedule:
9+
- cron: '0 0 */2 * *' # Run every other day 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, 3.13]
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 dependencies
37+
run: npm install
38+
39+
- name: Build frontend
40+
run: npm run build
41+
42+
- name: Test frontend startup (Linux/macOS)
43+
if: runner.os != 'Windows'
44+
run: |
45+
# Start the Next.js frontend in background
46+
npm start &
47+
FRONTEND_PID=$!
48+
49+
# Wait for frontend to start (max 30 seconds)
50+
timeout=30
51+
elapsed=0
52+
started=false
53+
54+
while [ $elapsed -lt $timeout ] && [ "$started" = false ]; do
55+
if curl -s http://localhost:3000 > /dev/null 2>&1; then
56+
started=true
57+
echo "✅ Frontend started successfully"
58+
else
59+
sleep 1
60+
elapsed=$((elapsed + 1))
61+
fi
62+
done
63+
64+
# Clean up background process
65+
kill $FRONTEND_PID 2>/dev/null || true
66+
67+
if [ "$started" = false ]; then
68+
echo "❌ Frontend failed to start within 30 seconds"
69+
exit 1
70+
fi
71+
shell: bash
72+
73+
- name: Test frontend startup (Windows)
74+
if: runner.os == 'Windows'
75+
run: |
76+
# Start the Next.js frontend in background
77+
npm start &
78+
79+
# Wait for frontend to start (max 30 seconds)
80+
$timeout = 30
81+
$elapsed = 0
82+
$started = $false
83+
84+
while ($elapsed -lt $timeout -and -not $started) {
85+
try {
86+
$response = Invoke-WebRequest -Uri "http://localhost:3000" -TimeoutSec 1 -ErrorAction SilentlyContinue
87+
if ($response.StatusCode -eq 200) {
88+
$started = $true
89+
Write-Host "✅ Frontend started successfully"
90+
}
91+
} catch {
92+
Start-Sleep -Seconds 1
93+
$elapsed++
94+
}
95+
}
96+
97+
if (-not $started) {
98+
Write-Host "❌ Frontend failed to start within 30 seconds"
99+
exit 1
100+
}
101+
shell: pwsh
102+
103+
- name: Run linting
104+
run: npm run lint
105+
106+
notify-slack:
107+
name: Notify Slack on Failure
108+
runs-on: ubuntu-latest
109+
needs: smoke
110+
if: |
111+
failure() &&
112+
github.event_name == 'schedule'
113+
steps:
114+
- name: Notify Slack
115+
uses: slackapi/slack-github-action@v2.1.0
116+
with:
117+
webhook: ${{ secrets.SLACK_WEBHOOK_URL }}
118+
webhook-type: incoming-webhook
119+
payload: |
120+
{
121+
"text": ":warning: *Smoke test failed for `with-agno` :warning:.*",
122+
"blocks": [
123+
{
124+
"type": "section",
125+
"text": {
126+
"type": "mrkdwn",
127+
"text": ":warning: *Smoke test failed for <https://github.com/copilotkit/with-agno|with-agno> :warning:*\n\n<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View run details>"
128+
}
129+
}
130+
]
131+
}

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,5 @@ bun.lockb
5050

5151
# python
5252
agent/venv/
53-
agent/__pycache__/
53+
agent/__pycache__/
54+
.venv/

README.md

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

35-
2. Install Python dependencies for the Agno 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
35+
> **Note:** Installing the package dependencies will also install the agent's python dependencies via the `install:agent` script.
4536
46-
# Using bun
47-
bun run install:agent
37+
2. Set up your OpenAI API key:
38+
```bash
39+
export OPENAI_API_KEY="your-openai-api-key-here"
4840
```
4941

50-
3. Set up your OpenAI API key:
42+
or create a `.env` file.
43+
5144
```bash
52-
export OPENAI_API_KEY="your-openai-api-key-here"
45+
echo "OPENAI_API_KEY=your-openai-api-key-here" > agent/.env
5346
```
5447

55-
4. Start the development server:
48+
3. Start the development server:
5649
```bash
5750
# Using pnpm
5851
pnpm dev

agent/agent.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,23 @@
33
This example shows how to create an Agno Agent with tools (YFinanceTools) and expose it in an AG-UI compatible way.
44
"""
55

6+
import dotenv
67
from agno.agent.agent import Agent
78
from agno.app.agui.app import AGUIApp
89
from agno.models.openai import OpenAIChat
910
from agno.tools.yfinance import YFinanceTools
11+
from frontend_tools import add_proverb, set_theme_color
12+
13+
dotenv.load_dotenv()
1014

1115
agent = Agent(
1216
model=OpenAIChat(id="gpt-4o"),
1317
tools=[
14-
YFinanceTools(
15-
stock_price=True, analyst_recommendations=True, stock_fundamentals=True
16-
)
18+
# Example of a backend tool, defined and handled in your agno agent
19+
YFinanceTools(stock_price=True, historical_prices=True),
20+
# Example of frontend tools, handled in the frontend Next.js app
21+
add_proverb,
22+
set_theme_color,
1723
],
1824
description="You are an investment analyst that researches stock prices, analyst recommendations, and stock fundamentals.",
1925
instructions="Format your response using markdown and use tables to display data where possible.",

agent/frontend_tools.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
from agno.tools import tool
2+
3+
@tool(external_execution=True)
4+
def set_theme_color(theme_color: str) -> str: # pylint: disable=unused-argument
5+
"""
6+
Change the theme color of the chat.
7+
8+
Args:
9+
background: str: The background color to change to.
10+
"""
11+
12+
@tool(external_execution=True)
13+
def add_proverb(proverb: str) -> str: # pylint: disable=unused-argument
14+
"""
15+
Add a proverb to the chat.
16+
17+
Args:
18+
proverb: str: The proverb to add to the chat.
19+
"""

agent/requirements.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
agno>=1.6.3
1+
agno>=1.7.8
22
openai>=1.88.0
33
yfinance>=0.2.63
44
fastapi>=0.115.13
55
uvicorn>=0.34.3
6-
ag-ui-protocol>=0.1.5
6+
ag-ui-protocol>=0.1.8
7+
packaging>=25.0.0

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
"private": true,
55
"scripts": {
66
"dev": "concurrently \"npm run dev:ui\" \"npm run dev:agent\" --names ui,agent --prefix-colors blue,green --kill-others",
7-
"dev:debug": "LOG_LEVEL=debug npm run dev",
8-
"dev:agent": "cd agent && python agent.py",
9-
"dev:ui": "next dev --turbopack",
7+
"dev:agent": "./scripts/run-agent.sh || scripts\\run-agent.bat",
8+
"dev:ui": "next dev",
109
"build": "next build",
1110
"start": "next start",
1211
"lint": "next lint",
13-
"install:agent": "cd agent && pip install -r requirements.txt"
12+
"install:agent": "./scripts/setup-agent.sh || scripts\\setup-agent.bat",
13+
"postinstall": "npm run install:agent"
1414
},
1515
"dependencies": {
1616
"@ai-sdk/openai": "^1.3.22",

scripts/run-agent.bat

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
@echo off
2+
REM Navigate to the agent directory
3+
cd /d %~dp0\..\agent
4+
5+
REM Activate the virtual environment
6+
call .venv\Scripts\activate.bat
7+
8+
REM Run the agent
9+
.venv\Scripts\python.exe agent.py

scripts/run-agent.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
3+
# Navigate to the agent directory
4+
cd "$(dirname "$0")/../agent" || exit 1
5+
6+
# Activate the virtual environment
7+
source .venv/bin/activate
8+
9+
# Run the agent
10+
.venv/bin/python agent.py

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

0 commit comments

Comments
 (0)