chore: import upstream snapshot with attribution
This commit is contained in:
@@ -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.
|
||||
"""
|
||||
Reference in New Issue
Block a user