Skip to content

Commit 114201e

Browse files
author
yashksaini-coder
committed
add agents.py for web and financial AI assistant functionality
1 parent 2748f90 commit 114201e

File tree

1 file changed

+66
-0
lines changed

1 file changed

+66
-0
lines changed

agents.py

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
import groq
2+
import os
3+
from dotenv import load_dotenv
4+
5+
# AI assistant imports
6+
from agno.agent import Agent
7+
from agno.models.groq import Groq
8+
from agno.tools.yfinance import YFinanceTools
9+
from agno.tools.duckduckgo import DuckDuckGoTools
10+
from agno.agent import Agent, RunResponse
11+
12+
load_dotenv(dotenv_path=".env")
13+
GROQ_API_KEY = os.getenv("api_key")
14+
15+
groq_client = groq.Client(api_key=GROQ_API_KEY)
16+
17+
if not GROQ_API_KEY:
18+
raise ValueError("Please provide a GROQ API key")
19+
20+
21+
web_search_agent = Agent(
22+
name="web_agent",
23+
role="search the web for information based on the user given input",
24+
model=Groq(id="llama-3.3-70b-specdec",api_key=GROQ_API_KEY),
25+
tools=[
26+
DuckDuckGoTools(search=True, news=True),
27+
28+
],
29+
instructions=[
30+
"You are a very professional web search AI agent",
31+
"your job is to search the web for information based on the user given input",
32+
"provide exact information to the user available on the web",
33+
],
34+
structured_outputs=False,
35+
markdown=True,
36+
)
37+
financial_agent = Agent(
38+
name="financial_agent",
39+
role="get financial information",
40+
model=Groq(id="llama-3.3-70b-specdec",api_key=GROQ_API_KEY),
41+
tools=[
42+
YFinanceTools(stock_price=True,
43+
analyst_recommendations=True,
44+
stock_fundamentals=True,
45+
company_info=True,
46+
technical_indicators=True,
47+
historical_prices=True,
48+
key_financial_ratios = True,
49+
income_statements = True,
50+
),
51+
],
52+
instructions=[
53+
"You are a very professional financial advisor AI agent",
54+
"your job is to provide financial information to users",
55+
"you can provide stock price, analyst recommendations, and stock fundamentals",
56+
"you can also provide information about companies, industries, and financial terms",
57+
],
58+
structured_outputs=False,
59+
markdown=True,
60+
)
61+
62+
multi_ai = Agent(
63+
team=[web_search_agent, financial_agent],
64+
model=Groq(id="llama-3.3-70b-specdec",api_key=GROQ_API_KEY),
65+
markdown=True,
66+
)

0 commit comments

Comments
 (0)