Skip to content

Commit e1cbaf2

Browse files
committed
Combine agno examples
1 parent 4cc9377 commit e1cbaf2

File tree

12 files changed

+1161
-82
lines changed

12 files changed

+1161
-82
lines changed

typescript-sdk/apps/dojo/scripts/prep-dojo-everything.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ const serverStarterAllFeatures = {
4545

4646
// Agno
4747
const agno = {
48-
command: 'uv venv --allow-existing && uv pip install -r requirements.txt',
48+
command: 'uv sync',
4949
name: 'Agno',
5050
cwd: path.join(integrationsRoot, 'agno/examples'),
5151
}

typescript-sdk/apps/dojo/scripts/run-dojo-everything.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ const serverStarterAllFeatures = {
4545

4646
// Agno
4747
const agno = {
48-
command: 'uv run agent.py',
48+
command: 'uv run dev',
4949
name: 'Agno',
5050
cwd: path.join(integrationsRoot, 'agno/examples'),
5151
env: {PORT: 8002},

typescript-sdk/apps/dojo/src/agents.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,10 +174,10 @@ export const agentsIntegrations: AgentIntegrationConfig[] = [
174174
agents: async () => {
175175
return {
176176
agentic_chat: new AgnoAgent({
177-
url: `${envVars.agnoUrl}/agui`,
177+
url: `${envVars.agnoUrl}/agentic_chat/agui`,
178178
}),
179179
tool_based_generative_ui: new AgnoAgent({
180-
url: "http://localhost:8000/agui",
180+
url: `${envVars.agnoUrl}/tool_based_generative_ui/agui`,
181181
}),
182182
};
183183
},

typescript-sdk/integrations/agno/examples/.gitignore

Lines changed: 79 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Byte-compiled / optimized / DLL files
22
__pycache__/
3-
*.py[cod]
3+
*.py[codz]
44
*$py.class
55

66
# C extensions
@@ -20,9 +20,8 @@ parts/
2020
sdist/
2121
var/
2222
wheels/
23-
pip-wheel-metadata/
2423
share/python-wheels/
25-
*.egg-info/
24+
*.egg-info
2625
.installed.cfg
2726
*.egg
2827
MANIFEST
@@ -47,9 +46,10 @@ htmlcov/
4746
nosetests.xml
4847
coverage.xml
4948
*.cover
50-
*.py,cover
49+
*.py.cover
5150
.hypothesis/
5251
.pytest_cache/
52+
cover/
5353

5454
# Translations
5555
*.mo
@@ -72,6 +72,7 @@ instance/
7272
docs/_build/
7373

7474
# PyBuilder
75+
.pybuilder/
7576
target/
7677

7778
# Jupyter Notebook
@@ -82,7 +83,9 @@ profile_default/
8283
ipython_config.py
8384

8485
# pyenv
85-
.python-version
86+
# For a library or package, you might want to ignore these files since the code is
87+
# intended to run in multiple environments; otherwise, check them in:
88+
# .python-version
8689

8790
# pipenv
8891
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
@@ -91,7 +94,37 @@ ipython_config.py
9194
# install all needed dependencies.
9295
#Pipfile.lock
9396

94-
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
97+
# UV
98+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
99+
# This is especially recommended for binary packages to ensure reproducibility, and is more
100+
# commonly ignored for libraries.
101+
#uv.lock
102+
103+
# poetry
104+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
105+
# This is especially recommended for binary packages to ensure reproducibility, and is more
106+
# commonly ignored for libraries.
107+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
108+
#poetry.lock
109+
#poetry.toml
110+
111+
# pdm
112+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
113+
# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
114+
# https://pdm-project.org/en/latest/usage/project/#working-with-version-control
115+
#pdm.lock
116+
#pdm.toml
117+
.pdm-python
118+
.pdm-build/
119+
120+
# pixi
121+
# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
122+
#pixi.lock
123+
# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
124+
# in the .venv directory. It is recommended not to include this directory in version control.
125+
.pixi
126+
127+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
95128
__pypackages__/
96129

97130
# Celery stuff
@@ -103,6 +136,7 @@ celerybeat.pid
103136

104137
# Environments
105138
.env
139+
.envrc
106140
.venv
107141
env/
108142
venv/
@@ -128,27 +162,42 @@ dmypy.json
128162
# Pyre type checker
129163
.pyre/
130164

131-
# IDEs
132-
.vscode/
133-
.idea/
134-
*.swp
135-
*.swo
136-
*~
137-
138-
# OS generated files
139-
.DS_Store
140-
.DS_Store?
141-
._*
142-
.Spotlight-V100
143-
.Trashes
144-
ehthumbs.db
145-
Thumbs.db
146-
147-
# Poetry
148-
poetry.lock
149-
150-
# UV
151-
uv.lock
152-
153-
# LangGraph API
154-
.langgraph_api
165+
# pytype static type analyzer
166+
.pytype/
167+
168+
# Cython debug symbols
169+
cython_debug/
170+
171+
# PyCharm
172+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
173+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
174+
# and can be added to the global gitignore or merged into this file. For a more nuclear
175+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
176+
#.idea/
177+
178+
# Abstra
179+
# Abstra is an AI-powered process automation framework.
180+
# Ignore directories containing user credentials, local state, and settings.
181+
# Learn more at https://abstra.io/docs
182+
.abstra/
183+
184+
# Visual Studio Code
185+
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
186+
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
187+
# and can be added to the global gitignore or merged into this file. However, if you prefer,
188+
# you could uncomment the following to ignore the entire vscode folder
189+
# .vscode/
190+
191+
# Ruff stuff:
192+
.ruff_cache/
193+
194+
# PyPI configuration file
195+
.pypirc
196+
197+
# Marimo
198+
marimo/_static/
199+
marimo/_lsp/
200+
__marimo__/
201+
202+
# Streamlit
203+
.streamlit/secrets.toml
Lines changed: 53 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,55 @@
1-
Extracted from with-agno
1+
# Agno Finance Agent
22

3-
To install deps
4-
pip install -r requirements.txt
3+
An Agno Agent with Finance tools for AG-UI that researches stock prices, analyst recommendations, and stock fundamentals.
54

6-
to run
7-
python agent.py
5+
## Setup
6+
7+
This project uses [uv](https://github.com/astral-sh/uv) for dependency management.
8+
9+
### Prerequisites
10+
11+
1. Install uv: `pip install uv`
12+
2. Set your OpenAI API key: `export OPENAI_API_KEY="your-api-key"`
13+
14+
### Installation
15+
16+
```bash
17+
# Install dependencies
18+
uv sync
19+
20+
# Activate the virtual environment
21+
uv shell
22+
```
23+
24+
### Running the Agent
25+
26+
```bash
27+
# Run the agent
28+
uv run python agent.py
29+
```
30+
31+
The agent will be available at `http://localhost:9001` (or the port specified by the `PORT` environment variable).
32+
33+
## Development
34+
35+
```bash
36+
# Install development dependencies
37+
uv sync --extra dev
38+
39+
# Run tests
40+
uv run pytest
41+
42+
# Format code
43+
uv run black .
44+
uv run isort .
45+
46+
# Lint code
47+
uv run flake8 .
48+
```
49+
50+
## Features
51+
52+
- Stock price lookup
53+
- Analyst recommendations
54+
- Stock fundamentals analysis
55+
- AG-UI compatible interface
Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,25 @@
1-
[tool.poetry]
2-
name = "examples"
3-
version = "0.1.0"
4-
description = ""
5-
authors = ["Markus Ecker <[email protected]>"]
6-
readme = "README.md"
1+
tool.uv.package = true
72

8-
[tool.poetry.dependencies]
9-
python = "^3.12"
10-
agno = "^1.7.7"
11-
openai = "^1.97.0"
12-
ag-ui-protocol = "^0.1.8"
13-
fastapi = "^0.116.1"
14-
uvicorn = "^0.35.0"
3+
[project]
4+
name = "server"
5+
version = "0.1.0"
6+
description = "Example usage of the AG-UI adapter for Agno"
7+
license = "MIT"
158

9+
readme = "README.md"
10+
requires-python = ">=3.12"
11+
dependencies = [
12+
"agno>=1.7.7",
13+
"openai>=1.99.1",
14+
"yfinance>=0.2.63",
15+
"fastapi>=0.116.1",
16+
"uvicorn>=0.35.0",
17+
"ag-ui-protocol>=0.1.8",
18+
]
19+
authors = [
20+
{name = "AG-UI Team"}
21+
]
1622

17-
[build-system]
18-
requires = ["poetry-core"]
19-
build-backend = "poetry.core.masonry.api"
2023

21-
[tool.poetry.scripts]
22-
dev = "examples:main"
24+
[project.scripts]
25+
dev = "server:main"
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
"""Example usage of the AG-UI adapter for Agno.
2+
3+
This provides a FastAPI application that demonstrates how to use the
4+
Agno agent with the AG-UI protocol. It includes examples for
5+
AG-UI dojo features:
6+
- Agentic Chat (Investment Analyst with Finance tools)
7+
"""
8+
9+
from __future__ import annotations
10+
11+
from fastapi import FastAPI
12+
import uvicorn
13+
import os
14+
15+
from .api import (
16+
agentic_chat_app,
17+
tool_based_generative_ui_app,
18+
)
19+
20+
app = FastAPI(title='Agno AG-UI server')
21+
app.mount('/agentic_chat', agentic_chat_app, 'Agentic Chat')
22+
app.mount('/tool_based_generative_ui', tool_based_generative_ui_app, 'Tool-based Generative UI')
23+
24+
def main():
25+
"""Main function to start the FastAPI server."""
26+
port = int(os.getenv("PORT", "9001"))
27+
uvicorn.run(app, host="0.0.0.0", port=port)
28+
29+
if __name__ == "__main__":
30+
main()
31+
32+
__all__ = ["main"]
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
"""Example API for a AG-UI compatible Agno Agent UI."""
2+
3+
from __future__ import annotations
4+
5+
from .agentic_chat import app as agentic_chat_app
6+
from .tool_based_generative_ui import app as tool_based_generative_ui_app
7+
8+
__all__ = [
9+
'agentic_chat_app',
10+
'tool_based_generative_ui_app',
11+
]

typescript-sdk/integrations/agno/examples/agent.py renamed to typescript-sdk/integrations/agno/examples/server/api/agentic_chat.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
33
This example shows how to create an Agno Agent with tools (YFinanceTools) and expose it in an AG-UI compatible way.
44
"""
5-
import os
6-
75
from agno.agent.agent import Agent
86
from agno.app.agui.app import AGUIApp
97
from agno.models.openai import OpenAIChat
@@ -23,13 +21,8 @@
2321
agui_app = AGUIApp(
2422
agent=agent,
2523
name="Investment Analyst",
26-
app_id="investment_analyst",
24+
app_id="agentic_chat",
2725
description="An investment analyst that researches stock prices, analyst recommendations, and stock fundamentals.",
2826
)
2927

30-
app = agui_app.get_app()
31-
32-
if __name__ == "__main__":
33-
port = int(os.getenv("PORT", "9001"))
34-
35-
agui_app.serve(app="agent:app", host="0.0.0.0", port=port, reload=True)
28+
app = agui_app.get_app()

0 commit comments

Comments
 (0)