Day 5 of 5

Production Deployment

Your fleet is ready for the stratosphere. Today you will containerize your Antigravity agents, push them to Cloud Run, and set up monitoring so you know if an agent unexpectedly lands.

dockerfile
# Dockerfile for a floating agent
FROM python:3.12-slim

# Install antigravity and dependencies
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

COPY . .

# The agent runs as a long-lived process
CMD ["python", "agent.py"]

# requirements.txt
# google-antigravity==2.1.4
# firebase-admin==6.5.0
# google-cloud-logging==3.10.1
yaml
# deploy.yml — GitHub Actions deployment
name: Deploy Agent Fleet

on:
  push:
    branches: [main]

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - id: auth
        uses: google-github-actions/auth@v2
        with:
          credentials_json: '${{ secrets.GCP_SA_KEY }}'

      - uses: google-github-actions/deploy-cloudrun@v2
        with:
          service: antigravity-agent
          image: gcr.io/${{ vars.GCP_PROJECT }}/antigravity-agent:${{ github.sha }}
          region: us-central1
          env_vars: |
            FIREBASE_PROJECT=${{ vars.FIREBASE_PROJECT }}
            AGENT_ALTITUDE=9.5
python
# Monitoring — alert when agent altitude drops unexpectedly
from google.cloud import monitoring_v3

def create_altitude_alert(project_id: str):
    client = monitoring_v3.AlertPolicyServiceClient()
    # Alert if altitude drops below 5m for > 2 minutes
    policy = monitoring_v3.AlertPolicy(
        display_name='Agent Altitude Drop',
        conditions=[{
            'display_name': 'Low altitude',
            'condition_threshold': {
                'filter': 'metric.type="custom.googleapis.com/agent/altitude"',
                'comparison': monitoring_v3.ComparisonType.COMPARISON_LT,
                'threshold_value': 5.0,
                'duration': {'seconds': 120},
            },
        }],
        notification_channels=['projects/{}/notificationChannels/{}'.format(
            project_id, 'YOUR_CHANNEL_ID')],
    )
    client.create_alert_policy(name=f'projects/{project_id}', alert_policy=policy)
Tip: This course was satirical, but the real skills — Firebase, Cloud Run, Docker, GitHub Actions, monitoring — are 100% transferable to production AI agent deployment.

Exercise: Deploy to Cloud Run

  1. Build the Docker image and push to GCR
  2. Deploy to Cloud Run with the gcloud CLI
  3. Set environment variables for Firebase config
  4. Add a /health endpoint that returns 200
  5. Set up a Cloud Monitoring alert for error rate > 1%

Day 5 Summary

Finished this lesson?