File size: 1,052 Bytes
9318644
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8959567
9318644
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
from agno.agent import Agent
from agno.models.groq import Groq
from agno.tools.duckduckgo import DuckDuckGoTools
import os
import groq
from dotenv import load_dotenv

load_dotenv()
groq.api_key = os.getenv("GROQ_API_KEY")

class WebSearchAgent:
    def __init__(self):
        self.agent = Agent(
            name="Web Search Agent",
            role="Search the web for financial news and information",
            model=Groq(id="deepseek-r1-distill-llama-70b"),
            tools=[DuckDuckGoTools()],
            instructions=["Always include sources"],
            markdown=True,
        )

    def search_financial_news(self, query):
        response = self.agent.print_response(
            f"Search for the latest financial news about {query}", 
            stream=False
        )
        return response
        
    def search_company_information(self, company_name):
        response = self.agent.print_response(
            f"Find detailed information about {company_name} company", 
            stream=False
        )
        return response