File tree Expand file tree Collapse file tree 8 files changed +248
-13
lines changed
app/[integrationId]/feature/tool_based_generative_ui
integrations/agno/examples Expand file tree Collapse file tree 8 files changed +248
-13
lines changed Original file line number Diff line number Diff line change @@ -145,6 +145,9 @@ export const agentsIntegrations: AgentIntegrationConfig[] = [
145145 agentic_chat : new AgnoAgent ( {
146146 url : "http://localhost:8000/agui" ,
147147 } ) ,
148+ tool_based_generative_ui : new AgnoAgent ( {
149+ url : "http://localhost:8000/agui" ,
150+ } ) ,
148151 } ;
149152 } ,
150153 } ,
Original file line number Diff line number Diff line change 11"use client" ;
2- import { CopilotKit , useCopilotAction } from "@copilotkit/react-core" ;
2+ import { CopilotKit , useCopilotAction , useCopilotChat } from "@copilotkit/react-core" ;
33import { CopilotKitCSSProperties , CopilotSidebar } from "@copilotkit/react-ui" ;
44import { useState } from "react" ;
55import "@copilotkit/react-ui/styles.css" ;
@@ -22,21 +22,29 @@ export default function ToolBasedGenerativeUI({ params }: ToolBasedGenerativeUIP
2222 // agent lock to the relevant agent
2323 agent = "tool_based_generative_ui"
2424 >
25- < div className = "min-h-full w-full flex items-center justify-center" >
26- < Haiku />
27- < CopilotSidebar
28- defaultOpen = { true }
29- labels = { {
30- title : "Haiku Generator" ,
31- initial : "I'm a haiku generator 👋. How can I help you?" ,
32- } }
33- clickOutsideToClose = { false }
34- />
35- </ div >
25+ < Chat />
3626 </ CopilotKit >
3727 ) ;
3828}
3929
30+ function Chat ( ) {
31+ const { visibleMessages } = useCopilotChat ( ) ;
32+ console . log ( "VISIBLE MESSAGES" , visibleMessages ) ;
33+ return (
34+ < div className = "min-h-full w-full flex items-center justify-center" >
35+ < Haiku />
36+ < CopilotSidebar
37+ defaultOpen = { true }
38+ labels = { {
39+ title : "Haiku Generator" ,
40+ initial : "I'm a haiku generator 👋. How can I help you?" ,
41+ } }
42+ clickOutsideToClose = { false }
43+ />
44+ </ div >
45+ ) ;
46+ }
47+
4048function Haiku ( ) {
4149 const [ haiku , setHaiku ] = useState < {
4250 japanese : string [ ] ;
Original file line number Diff line number Diff line change @@ -65,7 +65,7 @@ export const menuIntegrations: MenuIntegrationConfig[] = [
6565 {
6666 id : "agno" ,
6767 name : "Agno" ,
68- features : [ "agentic_chat" ] ,
68+ features : [ "agentic_chat" , "tool_based_generative_ui" ] ,
6969 } ,
7070 {
7171 id : "llama-index" ,
Original file line number Diff line number Diff line change 1+ # Byte-compiled / optimized / DLL files
2+ __pycache__ /
3+ * .py [cod ]
4+ * $py.class
5+
6+ # C extensions
7+ * .so
8+
9+ # Distribution / packaging
10+ .Python
11+ build /
12+ develop-eggs /
13+ dist /
14+ downloads /
15+ eggs /
16+ .eggs /
17+ lib /
18+ lib64 /
19+ parts /
20+ sdist /
21+ var /
22+ wheels /
23+ pip-wheel-metadata /
24+ share /python-wheels /
25+ * .egg-info /
26+ .installed.cfg
27+ * .egg
28+ MANIFEST
29+
30+ # PyInstaller
31+ # Usually these files are written by a python script from a template
32+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
33+ * .manifest
34+ * .spec
35+
36+ # Installer logs
37+ pip-log.txt
38+ pip-delete-this-directory.txt
39+
40+ # Unit test / coverage reports
41+ htmlcov /
42+ .tox /
43+ .nox /
44+ .coverage
45+ .coverage. *
46+ .cache
47+ nosetests.xml
48+ coverage.xml
49+ * .cover
50+ * .py,cover
51+ .hypothesis /
52+ .pytest_cache /
53+
54+ # Translations
55+ * .mo
56+ * .pot
57+
58+ # Django stuff:
59+ * .log
60+ local_settings.py
61+ db.sqlite3
62+ db.sqlite3-journal
63+
64+ # Flask stuff:
65+ instance /
66+ .webassets-cache
67+
68+ # Scrapy stuff:
69+ .scrapy
70+
71+ # Sphinx documentation
72+ docs /_build /
73+
74+ # PyBuilder
75+ target /
76+
77+ # Jupyter Notebook
78+ .ipynb_checkpoints
79+
80+ # IPython
81+ profile_default /
82+ ipython_config.py
83+
84+ # pyenv
85+ .python-version
86+
87+ # pipenv
88+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
89+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
90+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
91+ # install all needed dependencies.
92+ # Pipfile.lock
93+
94+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow
95+ __pypackages__ /
96+
97+ # Celery stuff
98+ celerybeat-schedule
99+ celerybeat.pid
100+
101+ # SageMath parsed files
102+ * .sage.py
103+
104+ # Environments
105+ .env
106+ .venv
107+ env /
108+ venv /
109+ ENV /
110+ env.bak /
111+ venv.bak /
112+
113+ # Spyder project settings
114+ .spyderproject
115+ .spyproject
116+
117+ # Rope project settings
118+ .ropeproject
119+
120+ # mkdocs documentation
121+ /site
122+
123+ # mypy
124+ .mypy_cache /
125+ .dmypy.json
126+ dmypy.json
127+
128+ # Pyre type checker
129+ .pyre /
130+
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
Original file line number Diff line number Diff line change 1+ """
2+ Example: Agno Agent
3+ """
4+
5+ from typing import List
6+
7+ from agno .agent .agent import Agent
8+ from agno .app .agui .app import AGUIApp
9+ from agno .models .openai import OpenAIChat
10+ from agno .tools import tool
11+
12+
13+ @tool (
14+ )
15+ def generate_haiku (english : List [str ], japanese : List [str ]) -> str : # pylint: disable=unused-argument
16+ """
17+ Generate a haiku in Japanese and its English translation.
18+
19+ Args:
20+ english: List[str]: An array of three lines of the haiku in English
21+ japanese: List[str]: An array of three lines of the haiku in Japanese
22+
23+ Returns:
24+ str: A string containing the haiku in Japanese and its English translation
25+ """
26+ print (english , japanese , flush = True )
27+ return "Haiku generated"
28+
29+ agent = Agent (
30+ model = OpenAIChat (id = "gpt-4o" ),
31+ tools = [generate_haiku ],
32+ description = "You are a helpful assistant that can help with tasks and answer questions." ,
33+ )
34+
35+ agui_app = AGUIApp (
36+ agent = agent ,
37+ name = "Agno Agent" ,
38+ app_id = "agno_agent" ,
39+ description = "An helpful assistant." ,
40+ )
41+
42+ app = agui_app .get_app ()
43+
44+ def main ():
45+ """
46+ Serve the AG-UI app.
47+ """
48+ agui_app .serve (app = "examples:app" , port = 8000 , reload = True )
49+
50+ if __name__ == "__main__" :
51+ main ()
Original file line number Diff line number Diff line change 1+ [tool .poetry ]
2+ name = " examples"
3+ version = " 0.1.0"
4+ description = " "
5+ authors = [
" Markus Ecker <[email protected] >" ]
6+ readme = " README.md"
7+
8+ [tool .poetry .dependencies ]
9+ python = " ^3.12"
10+ agno = " ^1.7.4"
11+ openai = " ^1.97.0"
12+ ag-ui-protocol = " ^0.1.8"
13+ fastapi = " ^0.116.1"
14+ uvicorn = " ^0.35.0"
15+
16+
17+ [build-system ]
18+ requires = [" poetry-core" ]
19+ build-backend = " poetry.core.masonry.api"
20+
21+ [tool .poetry .scripts ]
22+ dev = " examples:main"
You can’t perform that action at this time.
0 commit comments