-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfinancial_agent.py
More file actions
57 lines (49 loc) · 1.78 KB
/
financial_agent.py
File metadata and controls
57 lines (49 loc) · 1.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# import openai
import os
from agno.agent import Agent
from agno.models.groq import Groq
from agno.tools.duckduckgo import DuckDuckGoTools
from agno.tools.yfinance import YFinanceTools
from dotenv import load_dotenv
load_dotenv()
os.environ["GROQ_API_KEY"] = os.getenv("GROQ_API_KEY")
## Web Search Agent - Handles market research
web_search_agent = Agent(
name="Web Search Agent",
role="Search the web for the information",
model=Groq(id="llama-3.1-8b-instant"),
tools=[DuckDuckGoTools()], # Internet search capability
instructions=["Always include sources"],
show_tool_calls=True,
markdown=True,
)
## Finance Agent - Handles financial data
finance_agent = Agent(
name="Finance AI Agent",
model=Groq(id="gemma2-9b-it"),
tools=[
YFinanceTools( # Yahoo Finance integration
stock_price=True, # Real-time prices
analyst_recommendations=True, # Professional recommendations
stock_fundamentals=True, # Company metrics
company_news=True, # Latest company news
),
],
instructions="Use tables to display the data",
show_tool_calls=True,
markdown=True,
)
## Multi-Agent Team - Coordinates everything
multi_ai_agent = Agent(
team=[web_search_agent, finance_agent], # Combines both agents
model=Groq(id="gemma2-9b-it"),
instructions=["Always include sources", "Use table to display the data"],
show_tool_calls=True,
markdown=True,
)
multi_ai_agent.print_response(
"Summarize the analyst recommendation and share the stock price, and market sentiment for AAPL",
)
# multi_ai_agent.print_response(
# "Analyze companies like Tesla, NVDA, Apple and suggest which to buy for long term"
# )