Skip to content

The agent that grows with you

fix(gemini): route google-alias fallback providers through GeminiNativeClient

Charles Jia745101e5f4e
diff --git a/agent/agent_runtime_helpers.py b/agent/agent_runtime_helpers.py
index 1d7e287c30b..b5483643d86 100644
--- a/agent/agent_runtime_helpers.py
+++ b/agent/agent_runtime_helpers.py
@@ -1705,7 +1705,10 @@ def create_openai_client(agent, client_kwargs: dict, *, reason: str, shared: boo
agent.provider, reason, shared, agent._client_log_context(),
)
return provider_client
- if agent.provider == "gemini":
+ # Aliases of the "gemini" profile (e.g. a "google" fallback_providers entry) must route
+ # through the native client too, else thinking_config gets sent unnested to the raw REST
+ # endpoint and Google 400s with "Unknown name 'thinking_config': Cannot find field." (#hermes-thinking-config-fallback)
+ if agent.provider in {"gemini", "google", "google-gemini", "google-ai-studio"}:
client = _gemini_native_client(agent, client_kwargs, httpx_verify, reason=reason, shared=shared)
if client is not None:
return client