Google Gemini provides three powerful internal tools that are natively supported by the model without requiring external implementations. These tools can be used directly through PraisonAI’s tool system.
from praisonaiagents import Agent# Agent with Google Searchsearch_agent = Agent( instructions="Research assistant with web search", llm="gemini/gemini-2.0-flash", tools=[{"googleSearch": {}}])response = search_agent.start("What's the latest news about AI?")
Use Google Search for real-time information retrieval:
Copy
from praisonaiagents import Agentsearch_agent = Agent( instructions="You are a research assistant with web search capabilities", llm="gemini/gemini-2.0-flash", tools=[{"googleSearch": {}}])response = search_agent.start("What are the latest developments in quantum computing?")print(response)
from praisonaiagents import Agenturl_agent = Agent( instructions="You are a content analyzer that can read and summarize web pages", llm="gemini/gemini-2.0-flash", tools=[{"urlContext": {}}])response = url_agent.start("Summarize this article: https://example.com/article")print(response)
Execute Python code for calculations and data analysis:
Copy
from praisonaiagents import Agentcode_agent = Agent( instructions="You are a data analyst that can execute Python code", llm="gemini/gemini-2.0-flash", tools=[{"codeExecution": {}}])response = code_agent.start("Calculate the compound interest for $10,000 at 5% annual rate for 10 years")print(response)
Use multiple internal tools together for complex tasks:
Copy
from praisonaiagents import Agentresearch_agent = Agent( instructions="""You are an advanced research assistant that can: 1. Search the web for information 2. Analyze content from specific URLs 3. Execute Python code for data analysis""", llm="gemini/gemini-2.0-flash", tools=[ {"googleSearch": {}}, {"urlContext": {}}, {"codeExecution": {}} ])# Complex research taskresponse = research_agent.start("""Research the current stock price of Apple (AAPL), find recent news about the company, and calculate its P/E ratio if the EPS is $6.15""")print(response)
Create a multi-agent system where different agents use different internal tools:
Copy
from praisonaiagents import Agent, Task, PraisonAIAgents# Research agent with Google Searchresearcher = Agent( name="Researcher", role="Web Research Specialist", goal="Find accurate and up-to-date information", instructions="Search for comprehensive information on topics", llm="gemini/gemini-2.0-flash", tools=[{"googleSearch": {}}])# Analyst agent with Code Executionanalyst = Agent( name="Analyst", role="Data Analyst", goal="Analyze data and perform calculations", instructions="Perform data analysis and calculations", llm="gemini/gemini-2.0-flash", tools=[{"codeExecution": {}}])# Content agent with URL Contextcontent_analyzer = Agent( name="ContentAnalyzer", role="Content Analysis Specialist", goal="Extract and summarize content from URLs", instructions="Analyze and summarize web content", llm="gemini/gemini-2.0-flash", tools=[{"urlContext": {}}])# Define tasksresearch_task = Task( description="Search for information about renewable energy trends in 2024", expected_output="List of key trends with sources", agent=researcher)analysis_task = Task( description="Calculate the growth rate of solar energy adoption based on the research", expected_output="Growth rate calculation with visualization", agent=analyst)content_task = Task( description="Analyze this article: https://example.com/renewable-energy-report", expected_output="Summary of key points from the article", agent=content_analyzer)# Create and run the multi-agent systemagents = PraisonAIAgents( agents=[researcher, analyst, content_analyzer], tasks=[research_task, analysis_task, content_task], process="sequential")agents.start()