All hardcoded Google API keys have been removed from the codebase for security best practices.
- app.py: Removed hardcoded key, added validation
- app_multiagent.py: Removed hardcoded key, added validation
Both files now:
- Require
GOOGLE_API_KEYenvironment variable - Show clear error message if key is missing
- Include instructions for setting the key
- gradio_app.py: Removed hardcoded key
- web-chat/server.py: Removed hardcoded key
- day1a_first_agent.py: Removed hardcoded key
- day1b_multi_agent.py: Removed hardcoded key
- DEPLOY_QUICKSTART.md: Replaced with placeholder
- HF_CLI_DEPLOY.md: Replaced with placeholder
- GRADIO_DEPLOYMENT.md: Replaced with placeholder
- CLAUDE.md: Replaced with placeholder
- deploy_to_hf.sh: Replaced with placeholder
- sample-agent/.env: Replaced with placeholder
- .claude/settings.local.json: Updated permission pattern
Your deployed apps on Hugging Face will continue to work because you've already set GOOGLE_API_KEY as a secret in the Space settings. No changes needed!
Set the environment variable before running:
export GOOGLE_API_KEY="your-actual-google-api-key"
export GOOGLE_GENAI_USE_VERTEXAI="FALSE"
# Then run your app
python3 app.py
# or
python3 app_multiagent.pyThe workflow already uses secrets.GOOGLE_API_KEY, so it will continue to work automatically.
✅ Both apps successfully import and initialize with environment variable set ✅ Both apps fail with clear error message when environment variable is missing ✅ No hardcoded API keys remain in the codebase ✅ All functionality preserved
- Security: API key not exposed in version control
- Flexibility: Different keys for different environments
- Best Practice: Standard environment variable pattern
- Clear Errors: Users see helpful message if key is missing
If you haven't already, make sure to set the GitHub secrets:
- Go to your repository → Settings → Secrets and variables → Actions
- Add
GOOGLE_API_KEYwith your actual key - Add
HUGGINGFACE_TOKENfor deployments (if not already set)
Your apps are now more secure and follow industry best practices! 🎉