Deep Research Multi-turn (Interactions)
Continue a Deep Research interaction across turns. Each response carries an interaction_id; the next turn references it via previous_interaction_id so only the new user message is sent on the wire. The server already has the prior research and its citations.
Persisting the interaction ID requires a database. The assistant message stores it under provider_data, and the next turn reads it back.
Code
1from kern.agent import Agent2from kern.db.sqlite import SqliteDb3from kern.models.google import GeminiInteractions45agent = Agent(6 model=GeminiInteractions(7 agent="deep-research-preview-04-2026",8 thinking_summaries="auto",9 ),10 add_history_to_context=True,11 db=SqliteDb(db_file="tmp/data.db"),12 markdown=True,13)1415if __name__ == "__main__":16 agent.print_response(17 "Research the current state of solid-state battery commercialization "18 "and summarize the leading approaches."19 )2021 agent.print_response(22 "Dive deeper into the sulfide-electrolyte approach: who the leading "23 "labs and companies are, and what their reported milestones look like."24 )2526 agent.print_response(27 "Based on everything we've covered, which approach has the clearest "28 "path to mass-market EV deployment in the next five years?"29 )Usage
Set up your virtual environment
1uv venv --python 3.122source .venv/bin/activate1uv venv --python 3.122.venv\Scripts\activateSet your API key
1export GOOGLE_API_KEY=xxxInstall dependencies
1uv pip install -U "google-genai>=2.0" kern-aiRun Agent
1python cookbook/90_models/google/gemini_interactions/deep_research_multi_turn.py