Agent with Tools (Interactions)
Code
1import asyncio23from kern.agent import Agent4from kern.models.google import GeminiInteractions5from kern.tools.websearch import WebSearchTools67agent = Agent(8 model=GeminiInteractions(id="gemini-3-flash-preview"),9 tools=[WebSearchTools()],10 markdown=True,11)1213if __name__ == "__main__":14 agent.print_response("Whats happening in France?")1516 agent.print_response("Whats happening in France?", stream=True)1718 asyncio.run(agent.aprint_response("Whats happening in France?", stream=True))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/tool_use.py