|
1 | 1 | # Enhanced GCP Security Agent - Cursor Rules |
| 2 | +# ALWAYS USE VERTEX AI AND CLOUD RUN FOR ALL OPERATIONS |
| 3 | + |
| 4 | +## Google Cloud Platform Architecture Requirements |
| 5 | + |
| 6 | +### Vertex AI Integration |
| 7 | +- **ALWAYS use Vertex AI for all LLM operations** - Never use Google AI API directly |
| 8 | +- Use Application Default Credentials (ADC) for authentication to Vertex AI |
| 9 | +- Set GOOGLE_CLOUD_PROJECT and GOOGLE_CLOUD_LOCATION environment variables |
| 10 | +- Use `gemini-2.0-flash-exp` model through Vertex AI endpoints |
| 11 | +- All ADK agents MUST be configured to use Vertex AI backend |
| 12 | +- Never pass api_key parameter to Agent constructor - use ADC only |
| 13 | + |
| 14 | +### Cloud Run Deployment Strategy |
| 15 | +- **Target Cloud Run for all deployment scenarios** |
| 16 | +- Configure containerized applications with proper health checks |
| 17 | +- Use Cloud Run service-to-service authentication |
| 18 | +- Implement proper resource limits and scaling policies |
| 19 | +- Configure VPC connector for secure communication |
| 20 | +- Use Cloud Run jobs for batch processing tasks |
| 21 | + |
| 22 | +### Authentication and Authorization |
| 23 | +- **MANDATORY: Use Application Default Credentials (ADC) everywhere** |
| 24 | +- Configure service accounts with least privilege access |
| 25 | +- Use Cloud IAM roles for fine-grained permissions |
| 26 | +- Implement proper OIDC token validation for service-to-service calls |
| 27 | +- Never hardcode API keys or credentials in code |
2 | 28 |
|
3 | 29 | ## Core Development Principles |
4 | 30 |
|
|
64 | 90 | - Handle timeout scenarios gracefully |
65 | 91 | - Display meaningful error messages to users |
66 | 92 |
|
| 93 | +### Google Cloud Services Integration |
| 94 | +- **Use Vertex AI for all LLM/Agent operations** - set model='gemini-2.0-flash-exp' |
| 95 | +- Use Cloud Run for hosting both frontend (Streamlit) and backend (FastAPI) |
| 96 | +- Use Cloud Storage for file uploads and data persistence |
| 97 | +- Use Cloud Trace for OpenTelemetry distributed tracing |
| 98 | +- Use Cloud Logging for application logs and monitoring |
| 99 | +- Use Cloud IAM for service authentication and authorization |
| 100 | +- Use Cloud Secret Manager for sensitive configuration data |
| 101 | + |
| 102 | +### Container and Deployment Configuration |
| 103 | +- Create Dockerfile for both frontend and backend services |
| 104 | +- Use multi-stage builds for optimized container images |
| 105 | +- Configure Cloud Run services with proper CPU/memory limits |
| 106 | +- Set up proper environment variable management |
| 107 | +- Implement graceful shutdown handling |
| 108 | +- Configure liveness and readiness probes |
| 109 | + |
67 | 110 | ## Code Quality Standards |
68 | 111 |
|
69 | 112 | ### Error Handling |
|
0 commit comments