Skip to content

LLM Configuration#

AG2 Gemini Thinking Configuration: Enhanced Reasoning Control with ThinkingConfig

AG2 v0.10.3 introduces native support for Google Gemini's Thinking Configuration, enabling fine-grained control over how Gemini models approach complex reasoning tasks. With thinking_budget, thinking_level, and include_thoughts parameters, you can now customize the depth and transparency of your agent's reasoning process, making it ideal for complex problem-solving, research tasks, and scenarios where you need insight into the model's internal reasoning.

This article explores how to leverage Gemini Thinking Configuration in AG2 for enhanced reasoning capabilities, with practical examples for different use cases and model variants.

Google Gemini models support advanced reasoning features that allow them to "think" through problems before providing answers. This internal reasoning process can significantly improve performance on complex tasks, but until now, controlling this behavior in AG2 required custom configurations or workarounds.

AG2 v0.10.3's native ThinkingConfig support solves this by providing direct access to Gemini's thinking parameters through the standard LLMConfig interface, making it easy to:

  • Control the amount of reasoning tokens allocated to complex problems
  • Adjust thinking intensity for different task complexities
  • Reveal the model's internal reasoning process when needed
  • Optimize cost and performance based on your specific use case

Key Features:

  • thinking_budget: Control the exact number of tokens allocated for reasoning (Gemini 2.5 series)
  • thinking_level: Set thinking intensity levels - High, Medium, Low, or Minimal (Gemini 3 series)
  • include_thoughts: Choose whether to include thought summaries in responses for transparency
  • Model-Specific Support: Automatic handling of different parameter sets for Gemini 2.5 and Gemini 3 models
  • Seamless Integration: Configure through standard LLMConfig - no special setup required

Why This Matters:

Understanding and controlling how AI models reason is crucial for building trustworthy, efficient agent systems. Gemini's thinking configuration allows you to balance between thorough reasoning (better accuracy on complex tasks) and efficiency (faster responses, lower costs). AG2's integration makes this accessible without complex API wrangling.

When to Use Thinking Configuration:

Use Thinking Configuration when you need:

  • Complex Problem Solving: Tasks requiring multi-step reasoning, logic puzzles, or analytical thinking
  • Research and Analysis: Deep research tasks where thorough thinking improves quality
  • Debugging and Transparency: Understanding how your agent approaches problems
  • Cost Optimization: Fine-tuning reasoning depth based on task complexity
  • Performance Tuning: Balancing response quality against latency and token usage

Don't use thinking configuration for simple, straightforward tasks where the overhead isn't beneficial, or when you need minimal latency above all else.

Understanding Thinking Configuration

Gemini's Thinking Configuration consists of three main parameters that control different aspects of the model's reasoning process: