> ## Documentation Index
> Fetch the complete documentation index at: https://agno-v2.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Multi-turn Conversation (Interactions)

> Persist previous_interaction_id across turns with a database so GeminiInteractions keeps context server-side.

The Interactions API keeps conversation history server-side. After the first turn, the model sends only the new message and references the prior turn via `previous_interaction_id`. Multi-turn needs a database so the interaction ID from each response is persisted and read back on the next turn.

## Code

```python multi_turn.py theme={null}
from agno.agent import Agent
from agno.db.sqlite import SqliteDb
from agno.models.google import GeminiInteractions

agent = Agent(
    model=GeminiInteractions(id="gemini-3.5-flash"),
    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

<Snippet file="create-venv-step.mdx" />

**1. Set your API key**

```bash theme={null}
export GOOGLE_API_KEY=xxx
```

**2. Install dependencies**

```bash theme={null}
uv pip install -U "google-genai>=2.0" sqlalchemy agno
```

**3. Run Agent**

Save the code above as `multi_turn.py`, then run:

```bash theme={null}
python multi_turn.py
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.