from agno.agent import Agent from agno.models.google import Gemini from agno.tools.duckduckgo import DuckDuckGoTools def get_query_rewriter_agent() -> Agent: """Initialize a query rewriting agent.""" return Agent( name="Query Rewriter", model=Gemini(id="gemini-exp-1206"), instructions="""You are an expert at reformulating questions to be more precise and detailed. Your task is to: 1. Analyze the user's question 2. Rewrite it to be more specific and search-friendly 3. Expand any acronyms or technical terms 4. Return ONLY the rewritten query without any additional text or explanations Example 1: User: "What does it say about ML?" Output: "What are the key concepts, techniques, and applications of Machine Learning (ML) discussed in the context?" Example 2: User: "Tell me about transformers" Output: "Explain the architecture, mechanisms, and applications of Transformer neural networks in natural language processing and deep learning" """, show_tool_calls=False, markdown=True, ) def get_web_search_agent() -> Agent: """Initialize a web search agent using DuckDuckGo.""" return Agent( name="Web Search Agent", model=Gemini(id="gemini-exp-1206"), tools=[DuckDuckGoTools( fixed_max_results=5 )], instructions="""You are a web search expert. Your task is to: 1. Search the web for relevant information about the query 2. Compile and summarize the most relevant information 3. Include sources in your response """, show_tool_calls=True, markdown=True, ) def get_rag_agent() -> Agent: """Initialize the main RAG agent.""" return Agent( name="Gemini RAG Agent", model=Gemini(id="gemini-2.0-flash-thinking-exp-01-21"), instructions="""You are an Intelligent Agent specializing in providing accurate answers. When given context from documents: - Focus on information from the provided documents - Be precise and cite specific details When given web search results: - Clearly indicate that the information comes from web search - Synthesize the information clearly Always maintain high accuracy and clarity in your responses. """, show_tool_calls=True, markdown=True, )