Agentflow icon indicating copy to clipboard operation
Agentflow copied to clipboard

Agent fallback model path drops use_vertex_ai, causing 401 UNAUTHENTICATED on Gemini Vertex setups

Open suchith83 opened this issue 6 months ago • 0 comments

Issue

When Agent is constructed with use_vertex_ai=True and a fallback_models list, fallback model calls fail with 401 UNAUTHENTICATED. The flag is dropped on (a) the auto-detect client-construction branch in Agent.__init__, and (b) the fallback client construction in execution.py, so the fallback client hits Gemini's public-API endpoint (API-key auth) instead of Vertex (OAuth2/ADC).

Primary model works; only fallbacks fail — making it look like an intermittent Gemini outage rather than an auth wiring bug.

Relevant files

  • agentflow/core/graph/agent.py — Agent.__init__, around lines 247–285. The else branch calls self._create_client(self.provider, base_url) without use_vertex_ai.
  • agentflow/core/graph/agent_internal/execution.py — fallback construction at ~line 311 calls self._create_client(provider, base_url) without self.use_vertex_ai.

Fix is to forward use_vertex_ai in both call sites (default False keeps non-Vertex users unaffected). Happy to send a PR.

suchith83 avatar May 30 '26 09:05 suchith83