Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.agno.com/llms.txt

Use this file to discover all available pages before exploring further.

Code

cookbook/90_models/google/gemini_interactions/multi_turn.py
from agno.agent import Agent
from agno.db.sqlite import SqliteDb
from agno.models.google import GeminiInteractions

agent = Agent(
    model=GeminiInteractions(id="gemini-3-flash-preview"),
    add_history_to_context=True,
    db=SqliteDb(db_file="tmp/data.db"),
    markdown=True,
)

if __name__ == "__main__":
    # First turn - establishes the interaction
    agent.print_response("My name is Alice and I love hiking in the mountains.")

    # Second turn - references the previous interaction for context
    agent.print_response("What did I just tell you about myself?")

    # Third turn - continues the conversation chain
    agent.print_response(
        "Suggest a hiking destination based on what you know about me."
    )

Usage

1

Set up your virtual environment

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

Set your API key

export GOOGLE_API_KEY=xxx
3

Install dependencies

uv pip install -U "google-genai>=2.0" agno
4

Run Agent

python cookbook/90_models/google/gemini_interactions/multi_turn.py