I updated the initialization block in agent.py to catch DefaultCredentialsError and fall back
to Google AI Studio:
try:
_, project_id = google.auth.default()
os.environ["GOOGLE_CLOUD_PROJECT"] = project_id or ""
os.environ["GOOGLE_CLOUD_LOCATION"] = "global"
os.environ["GOOGLE_GENAI_USE_VERTEXAI"] = "True"
except DefaultCredentialsError:
# Use Google AI Studio (expects GEMINI_API_KEY or GOOGLE_API_KEY environment variables)
os.environ["GOOGLE_GENAI_USE_VERTEXAI"] = "False"
Because GOOGLE_GENAI_USE_VERTEXAI is set to "False" , the google-adk framework uses Google AI
Studio endpoints and authenticates successfully using the GEMINI_API_KEY present in your shell
environment.
I updated the initialization block in agent.py to catch DefaultCredentialsError and fall back
to Google AI Studio:
Because GOOGLE_GENAI_USE_VERTEXAI is set to "False" , the google-adk framework uses Google AI
Studio endpoints and authenticates successfully using the GEMINI_API_KEY present in your shell
environment.