chore: import upstream snapshot with attribution
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
"""
|
||||
Example for serving you Agno agent as an AG-UI server
|
||||
"""
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
import dotenv
|
||||
from agno.os import AgentOS
|
||||
from agno.os.interfaces.agui import AGUI
|
||||
|
||||
from src.agent import agent
|
||||
|
||||
dotenv.load_dotenv(Path(__file__).resolve().parent.parent / ".env")
|
||||
dotenv.load_dotenv()
|
||||
|
||||
# Build AgentOS and extract the app for serving
|
||||
agent_os = AgentOS(agents=[agent], interfaces=[AGUI(agent=agent)])
|
||||
app = agent_os.get_app()
|
||||
|
||||
|
||||
@app.get("/health")
|
||||
async def health():
|
||||
return {"status": "ok"}
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
agent_os.serve(app="main:app", port=8000, reload=True)
|
||||
@@ -0,0 +1,15 @@
|
||||
[project]
|
||||
name = "investment-analyst-agent"
|
||||
version = "0.1.0"
|
||||
description = "An Agno Agent with Finance tools exposed in an AG-UI compatible way"
|
||||
requires-python = ">=3.12"
|
||||
dependencies = [
|
||||
"agno>=1.7.8",
|
||||
"openai>=1.88.0",
|
||||
"yfinance>=0.2.63",
|
||||
"fastapi>=0.115.13",
|
||||
"uvicorn>=0.34.3",
|
||||
"ag-ui-protocol>=0.1.8",
|
||||
"packaging>=25.0.0",
|
||||
"python-dotenv>=1.0.0",
|
||||
]
|
||||
@@ -0,0 +1,25 @@
|
||||
"""Example: Agno Agent with Finance tools
|
||||
|
||||
This example shows how to create an Agno Agent with tools (YFinanceTools) and expose it in an AG-UI compatible way.
|
||||
"""
|
||||
|
||||
from agno.agent.agent import Agent
|
||||
from agno.models.openai import OpenAIChat
|
||||
from agno.tools.yfinance import YFinanceTools
|
||||
|
||||
from .tools.backend import get_weather
|
||||
from .tools.frontend import add_proverb, set_theme_color
|
||||
|
||||
agent = Agent(
|
||||
model=OpenAIChat(id="gpt-4o"),
|
||||
tools=[
|
||||
# Example of backend tools, defined and handled in your agno agent
|
||||
YFinanceTools(),
|
||||
get_weather,
|
||||
# Example of frontend tools, handled in the frontend Next.js app
|
||||
add_proverb,
|
||||
set_theme_color,
|
||||
],
|
||||
description="You are an demonstrative agent for Agno and CopilotKit's integration.",
|
||||
instructions="Format your response using markdown and use tables to display data where possible.",
|
||||
)
|
||||
@@ -0,0 +1,15 @@
|
||||
from agno.tools import tool
|
||||
|
||||
|
||||
@tool
|
||||
def get_weather(location: str):
|
||||
"""
|
||||
Get the weather for the current location.
|
||||
|
||||
Args:
|
||||
location (str): The location to get the weather for.
|
||||
|
||||
Returns:
|
||||
str: The weather for the current location.
|
||||
"""
|
||||
return f"The weather in {location} is: 70 degrees and Sunny."
|
||||
@@ -0,0 +1,21 @@
|
||||
from agno.tools import tool
|
||||
|
||||
|
||||
@tool(external_execution=True)
|
||||
def set_theme_color(theme_color: str):
|
||||
"""
|
||||
Change the theme color of the chat.
|
||||
|
||||
Args:
|
||||
background: str: The background color to change to.
|
||||
"""
|
||||
|
||||
|
||||
@tool(external_execution=True)
|
||||
def add_proverb(proverb: str):
|
||||
"""
|
||||
Add a proverb to the chat.
|
||||
|
||||
Args:
|
||||
proverb: str: The proverb to add to the chat.
|
||||
"""
|
||||
Generated
+1109
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user