Agentflow
Agentflow copied to clipboard
Agent fallback model path drops use_vertex_ai, causing 401 UNAUTHENTICATED on Gemini Vertex setups
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. Theelsebranch callsself._create_client(self.provider, base_url)withoutuse_vertex_ai.agentflow/core/graph/agent_internal/execution.py— fallback construction at ~line 311 callsself._create_client(provider, base_url)withoutself.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.