Deep Research Visualization (Interactions)

With visualization="auto" the agent can generate charts and graphs to support its findings. The capability is enabled by the config, but the agent only produces visuals when the prompt explicitly asks for them.

Generated images come back in the response steps (and as image deltas when streaming). Kern parses them into the response's images.

Code

1from kern.agent import Agent
2from kern.models.google import GeminiInteractions
3
4agent = Agent(
5 model=GeminiInteractions(
6 agent="deep-research-preview-04-2026",
7 thinking_summaries="auto",
8 visualization="auto",
9 ),
10 markdown=True,
11)
12
13if __name__ == "__main__":
14 agent.print_response(
15 "Analyze global semiconductor market trends. Include graphics showing "
16 "market share changes over time."
17 )

Usage

Set up your virtual environment

1uv venv --python 3.12
2source .venv/bin/activate
1uv venv --python 3.12
2.venv\Scripts\activate

Set your API key

1export GOOGLE_API_KEY=xxx

Install dependencies

1uv pip install -U "google-genai>=2.0" kern-ai

Run Agent

1python cookbook/90_models/google/gemini_interactions/deep_research_visualization.py