100+ AI Agents, Agent Skills and RAG Apps - Free and Open Source.
Refactor investment agent implementation to use 'Agent' class instead of 'Assistant'
ksp20009e9a64f664e5
diff --git a/ai_agent_tutorials/ai_investment_agent/investment_agent.py b/ai_agent_tutorials/ai_investment_agent/investment_agent.pyindex acfef2cf..62315083 100644--- a/ai_agent_tutorials/ai_investment_agent/investment_agent.py+++ b/ai_agent_tutorials/ai_investment_agent/investment_agent.py@@ -1,6 +1,6 @@# Import the required librariesimport streamlit as st-from agno.agent import Assistant+from agno.agent import Agentfrom agno.models.openai import OpenAIChatfrom agno.tools.yfinance import YFinanceTools@@ -12,11 +12,12 @@ st.caption("This app allows you to compare the performance of two stocks and genopenai_api_key = st.text_input("OpenAI API Key", type="password")if openai_api_key:- # Create an instance of the Assistant- assistant = Assistant(+ # Create an instance of the Agent+ agent = Agent(llm=OpenAIChat(model="gpt-4o", api_key=openai_api_key),tools=[YFinanceTools(stock_price=True, analyst_recommendations=True, company_info=True, company_news=True)],show_tool_calls=True,+ markdown=True)# Input fields for the stocks to compare@@ -24,7 +25,7 @@ if openai_api_key:stock2 = st.text_input("Enter the second stock symbol")if stock1 and stock2:- # Get the response from the assistant+ # Get the response from the Agentquery = f"Compare {stock1} to {stock2}. Use every tool you have."- response = assistant.run(query, stream=False)+ response = agent.run(query, stream=False)st.write(response.content)\ No newline at end of file