Skip to content

Commit 43c9dcf

Browse files
committed
refactor: simplify code, upgrade to agent os, upgrade deps
Signed-off-by: Tyler Slaton <tyler@copilotkit.ai>
1 parent 5685bd2 commit 43c9dcf

23 files changed

+1594
-298
lines changed

.github/workflows/smoke.yml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ name: Smoke
22

33
on:
44
push:
5-
branches: main
5+
branches: [main]
66
pull_request:
7-
branches: main
7+
branches: [main]
88
schedule:
9-
- cron: '0 0 */2 * *' # Run every other day at midnight UTC
9+
- cron: "0 0 */2 * *" # Run every other day at midnight UTC
1010

1111
jobs:
1212
smoke:
@@ -45,12 +45,12 @@ jobs:
4545
# Start the Next.js frontend in background
4646
npm start &
4747
FRONTEND_PID=$!
48-
48+
4949
# Wait for frontend to start (max 30 seconds)
5050
timeout=30
5151
elapsed=0
5252
started=false
53-
53+
5454
while [ $elapsed -lt $timeout ] && [ "$started" = false ]; do
5555
if curl -s http://localhost:3000 > /dev/null 2>&1; then
5656
started=true
@@ -60,10 +60,10 @@ jobs:
6060
elapsed=$((elapsed + 1))
6161
fi
6262
done
63-
63+
6464
# Clean up background process
6565
kill $FRONTEND_PID 2>/dev/null || true
66-
66+
6767
if [ "$started" = false ]; then
6868
echo "❌ Frontend failed to start within 30 seconds"
6969
exit 1
@@ -75,12 +75,12 @@ jobs:
7575
run: |
7676
# Start the Next.js frontend in background
7777
npm start &
78-
78+
7979
# Wait for frontend to start (max 30 seconds)
8080
$timeout = 30
8181
$elapsed = 0
8282
$started = $false
83-
83+
8484
while ($elapsed -lt $timeout -and -not $started) {
8585
try {
8686
$response = Invoke-WebRequest -Uri "http://localhost:3000" -TimeoutSec 1 -ErrorAction SilentlyContinue
@@ -93,7 +93,7 @@ jobs:
9393
$elapsed++
9494
}
9595
}
96-
96+
9797
if (-not $started) {
9898
Write-Host "❌ Frontend failed to start within 30 seconds"
9999
exit 1
@@ -108,7 +108,7 @@ jobs:
108108
runs-on: ubuntu-latest
109109
needs: smoke
110110
if: |
111-
failure() &&
111+
failure() &&
112112
github.event_name == 'schedule'
113113
steps:
114114
- name: Notify Slack
@@ -128,4 +128,4 @@ jobs:
128128
}
129129
}
130130
]
131-
}
131+
}

.gitignore

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

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

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ This is a starter template for building AI agents using [Agno](https://agno.com)
44

55
## Prerequisites
66

7-
- Node.js 18+
8-
- Python 3.8+
7+
- Node.js 20+
8+
- Python 3.12+
99
- OpenAI API Key (for the Agno agent)
1010
- Any of the following package managers:
1111
- pnpm (recommended)
@@ -73,14 +73,14 @@ The following scripts can also be run using your preferred package manager:
7373
- `lint` - Runs ESLint for code linting
7474
- `install:agent` - Installs Python dependencies for the agent
7575

76-
## Documentation
76+
## 📚 Documentation
7777

7878
The main UI component is in `src/app/page.tsx`. You can:
7979
- Modify the theme colors and styling
8080
- Add new frontend actions
8181
- Customize the CopilotKit sidebar appearance
8282

83-
## 📚 Documentation
83+
Otherwise, check out the documentation relevant to your task:
8484

8585
- [Agno Documentation](https://docs.agno.com/introduction) - Learn more about Agno and its features
8686
- [CopilotKit Documentation](https://docs.copilotkit.ai) - Explore CopilotKit's capabilities
@@ -107,5 +107,5 @@ If you see "I'm having trouble connecting to my tools", make sure:
107107
If you encounter Python import errors:
108108
```bash
109109
cd agent
110-
pip install -r requirements.txt
111-
```
110+
uv sync
111+
```

agent/agent.py

Lines changed: 0 additions & 38 deletions
This file was deleted.

agent/frontend_tools.py

Lines changed: 0 additions & 19 deletions
This file was deleted.

agent/main.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
"""
2+
Example for serving you Agno agent as an AG-UI server
3+
"""
4+
5+
import dotenv
6+
from agno.os import AgentOS
7+
from agno.os.interfaces.agui import AGUI
8+
9+
from src.agent import agent
10+
11+
dotenv.load_dotenv()
12+
13+
# Build AgentOS and extract the app for serving
14+
agent_os = AgentOS(agents=[agent], interfaces=[AGUI(agent=agent)])
15+
app = agent_os.get_app()
16+
17+
if __name__ == "__main__":
18+
agent_os.serve(app="main:app", port=8000, reload=True)

agent/pyproject.toml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
[project]
2+
name = "investment-analyst-agent"
3+
version = "0.1.0"
4+
description = "An Agno Agent with Finance tools exposed in an AG-UI compatible way"
5+
requires-python = ">=3.12"
6+
dependencies = [
7+
"agno>=1.7.8",
8+
"openai>=1.88.0",
9+
"yfinance>=0.2.63",
10+
"fastapi>=0.115.13",
11+
"uvicorn>=0.34.3",
12+
"ag-ui-protocol>=0.1.8",
13+
"packaging>=25.0.0",
14+
"python-dotenv>=1.0.0",
15+
]

agent/requirements.txt

Lines changed: 0 additions & 7 deletions
This file was deleted.

agent/src/agent.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
"""Example: Agno Agent with Finance tools
2+
3+
This example shows how to create an Agno Agent with tools (YFinanceTools) and expose it in an AG-UI compatible way.
4+
"""
5+
6+
from agno.agent.agent import Agent
7+
from agno.models.openai import OpenAIChat
8+
from agno.tools.yfinance import YFinanceTools
9+
10+
from .tools.backend import get_weather
11+
from .tools.frontend import add_proverb, set_theme_color
12+
13+
agent = Agent(
14+
model=OpenAIChat(id="gpt-4o"),
15+
tools=[
16+
# Example of backend tools, defined and handled in your agno agent
17+
YFinanceTools(),
18+
get_weather,
19+
# Example of frontend tools, handled in the frontend Next.js app
20+
add_proverb,
21+
set_theme_color,
22+
],
23+
description="You are an demonstrative agent for Agno and CopilotKit's integration.",
24+
instructions="Format your response using markdown and use tables to display data where possible.",
25+
)

agent/src/tools/backend.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
from agno.tools import tool
2+
3+
4+
@tool
5+
def get_weather(location: str):
6+
"""
7+
Get the weather for the current location.
8+
9+
Args:
10+
location (str): The location to get the weather for.
11+
12+
Returns:
13+
str: The weather for the current location.
14+
"""
15+
return f"The weather in {location} is: 70 degrees and Sunny."

0 commit comments

Comments
 (0)