Gemini 3 Pro

Use Gemini 3.1 Pro Preview with web search and SQLite chat history.

gemini_3_pro.py
"""
Async example using Gemini with tool calls.
"""

import asyncio

from agno.agent import Agent
from agno.db.sqlite.sqlite import SqliteDb
from agno.models.google import Gemini
from agno.tools.websearch import WebSearchTools

# ---------------------------------------------------------------------------
# Create Agent
# ---------------------------------------------------------------------------

agent = Agent(
    model=Gemini(id="gemini-3.1-pro-preview"),
    db=SqliteDb(db_file="tmp/data.db"),
    tools=[WebSearchTools()],
    markdown=True,
    add_history_to_context=True,
)

asyncio.run(agent.aprint_response("Whats the current news in France?", stream=True))

# Non-streaming response
asyncio.run(
    agent.aprint_response(
        "Write a 2 sentence story the biggest news highlight in our conversation."
    )
)

# ---------------------------------------------------------------------------
# Run Agent
# ---------------------------------------------------------------------------

if __name__ == "__main__":
    pass

Run the Example

Set up your virtual environment

uv venv --python 3.12
source .venv/bin/activate

Install dependencies

uv pip install -U agno ddgs google-genai sqlalchemy

Export your Google API key

export GOOGLE_API_KEY="your_google_api_key_here"

Run the example

Save the code above as gemini_3_pro.py, then run:

python gemini_3_pro.py

Full source: cookbook/90_models/google/gemini/gemini_3_pro.py