I wanted to suggest a quick bug-fix in Day 3, Unit 3 (Agent Skills) in step #6 of the Getting Started with Antigravity Skills Codelab ("The Developer Toolkit").
The Issue
If a student follows the instructions to use a standard GEMINI_API_KEY (export GEMINI_API_KEY="YOUR_KEY") instead of Google Cloud/Vertex AI, running agents-cli run crashes with a cryptic HTTP 500: Internal Server Error.
This happens because the current boilerplate code calls google.auth.default() unconditionally. If local Application Default Credentials (ADC) are missing, it throws an unhandled DefaultCredentialsError, crashing the local server before it ever checks the environment for the GEMINI_API_KEY.
Suggested Fix
Wrapping the initialization in a try/except block allows a graceful fallback for students using standard API keys:
####### Fix Start
from google.auth.exceptions import DefaultCredentialsError
try:
_, project_id = google.auth.default()
os.environ["GOOGLE_CLOUD_PROJECT"] = project_id
os.environ["GOOGLE_CLOUD_LOCATION"] = "global"
os.environ["GOOGLE_GENAI_USE_VERTEXAI"] = "True"
except DefaultCredentialsError:
if "GEMINI_API_KEY" in os.environ:
os.environ["GOOGLE_GENAI_USE_VERTEXAI"] = "False"
else:
# Prevents server crash on boot, allows proper error handling later
os.environ["GOOGLE_CLOUD_PROJECT"] = "placeholder-project"
####### Fix End
Best regards,
Liam
I wanted to suggest a quick bug-fix in Day 3, Unit 3 (Agent Skills) in step #6 of the Getting Started with Antigravity Skills Codelab ("The Developer Toolkit").
The Issue
If a student follows the instructions to use a standard GEMINI_API_KEY (export GEMINI_API_KEY="YOUR_KEY") instead of Google Cloud/Vertex AI, running agents-cli run crashes with a cryptic HTTP 500: Internal Server Error.
This happens because the current boilerplate code calls google.auth.default() unconditionally. If local Application Default Credentials (ADC) are missing, it throws an unhandled DefaultCredentialsError, crashing the local server before it ever checks the environment for the GEMINI_API_KEY.
Suggested Fix
Wrapping the initialization in a try/except block allows a graceful fallback for students using standard API keys:
Best regards,
Liam