A guardrail constrains or guides an AI system to reduce unsafe, unauthorized, or unreliable outcomes. As agents produce more code per unit of human attention, more output can escape review; increased autonomy does not make that output inherently more trustworthy. section 5.0
The control must move with the work. A developer can supervise autocomplete directly, but autonomous agent workflows need guardrails in hooks, policies, sandboxes, and CI gates. Agents that can call external tools also raise questions about security, authentication, logging, and governance. section 5.0 section 3.3.4
Constrain a deployment prompt
For a Cloud Run deployment, instruct the AI to use Artifact Registry instead of the deprecated Container Registry and Secret Manager rather than passing API keys as plain environment variables. The prompt steers generation away from outdated infrastructure and credentials exposed in logs or shell history. A prompt is guidance, not a substitute for inspecting the generated deployment. section 6.4.4
Listing 6.23 Deploy application to Cloud Run
gcloud run deploy sql-generator-service \ --image europe-west1-docker.pkg.dev/aqueous-flames-478114-b5/[YOUR_REPO]/sql-generator-service \ --platform managed \ --region europe-west1 \ #A --allow-unauthenticated \ --set-env-vars=AI_PROVIDER=gemini \ --set-secrets=GOOGLE_AI_API_KEY=gemini-api-key:latest #B
The deployment command distinguishes an ordinary configuration environment variable from an API key supplied through a secret binding. section 6.4.4
State the data-size constraint
When requesting a cache for a dictionary, specify its expected size. A dictionary under 10 MB made an eager, unbounded in-memory cache viable in the example; a much larger dataset could require a different design. Supplying the constraint reduces reliance on an unstated assumption, even when it does not change the generated code. section 7.4.2






















