Copy
Ask AI
from agno.agent import Agent
from agno.models.google import Gemini
agent = Agent(
model=Gemini(id="gemini-2.0-flash"),
markdown=True,
)
agent.print_response("Explain the theory of relativity", stream=True)
Tool Use
Copy
Ask AI
from agno.agent import Agent
from agno.models.google import Gemini
from agno.tools.yfinance import YFinanceTools
agent = Agent(
model=Gemini(id="gemini-2.0-flash"),
tools=[YFinanceTools(stock_price=True)],
markdown=True,
)
agent.print_response("What's GOOGL's stock price?", stream=True)
Video Input
Copy
Ask AI
from agno.agent import Agent
from agno.media import Video
from agno.models.google import Gemini
agent = Agent(
model=Gemini(id="gemini-2.0-flash"),
markdown=True,
)
agent.print_response(
"Tell me about this video",
videos=[Video(url="https://www.youtube.com/watch?v=XinoY2LDdA0")],
)
Google Search
Copy
Ask AI
from agno.agent import Agent
from agno.models.google import Gemini
agent = Agent(
model=Gemini(id="gemini-2.0-flash", search=True),
markdown=True,
)
agent.print_response("What are the latest developments in AI this week?")
Structured Output
Copy
Ask AI
from pydantic import BaseModel, Field
from agno.agent import Agent
from agno.models.google import Gemini
class Recipe(BaseModel):
name: str = Field(..., description="Recipe name")
ingredients: list[str] = Field(..., description="List of ingredients")
instructions: list[str] = Field(..., description="Cooking instructions")
agent = Agent(
model=Gemini(id="gemini-2.0-flash"),
output_schema=Recipe,
)
agent.print_response("Give me a recipe for pasta carbonara")
Run Examples
Copy
Ask AI
export GOOGLE_API_KEY=xxx
# Clone and run
git clone https://github.com/agno-agi/agno.git
cd agno/cookbook/92_models/google/gemini
python basic.py
python tool_use.py
python video_input_youtube.py
python search.py