Skip to content

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

Description

@suchith83

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.pyAgent.__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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions