google-genai > 1.10.0
agent_with_thinking_budget.py
Run the Example
1
Set up your virtual environment
2
Install dependencies
3
Export your Google API key
4
Migrate the Gemini thinking configuration
Replace
Gemini(id="gemini-2.5-pro", thinking_budget=1280, include_thoughts=True) with Gemini(id="gemini-3.1-pro-preview", thinking_level="low", include_thoughts=True) in the saved file.5
Run the example
Save the code above as
agent_with_thinking_budget.py, then run: