# 🚀 Technical Guide: Deployment & CI/CD Sovereign Gates
## The "Production Readiness" Standard (v1.4.7 Stable)

Deploying a "Well-Architected" agent requires orchestration across two primary Google Cloud environments. The Cockpit automates this through the `make deploy-prod` command.

---

## ⚙️ The Engine (Cloud Run)
The Python backend (FastAPI) is deployed as a serverless service.
- **Scaling**: scale-to-zero enabled.
- **Regions**: `us-central1` recommended for proximity to Vertex AI.
- **Best Practice**: Enable **Startup CPU Boost** to reduce cold-start latency (TTR).

## 🧠 Agent Engine (Vertex AI)
Recommended for agents that require deep integration with the Google Cloud agentic ecosystem.
- **Why**: Managed runtime, built-in tracing, and **Context Caching** support.

## ☸️ Enterprise Engine (GKE)
Recommended for high-intensity or specialized isolation workloads.
- **Why**: Full control over networking and GPU resources.

---

## 🏗️ Production Readiness Audit Sequence
`make deploy-prod` executes the following high-fidelity benchmarking pipeline before you push to the cloud:

### Stage 1: v1.4.7 Deep System Audit
Runs `make audit-deep`.
- **RAG Fidelity SME**: Validates citation accuracy and grounding logic.
- **Red Team Principal**: Full adversarial probing for multilingual jailbreaks.
- **Economic Architect**: Token density and model-tier optimization pivots.

### Stage 2: Stress & Saturation
Executes `make load-test`.
- Measures RPS, P99 latency, and TTFT under pressure.
- Proves reasoning stability during infrastructure saturation.

### Stage 3: Resiliency Verification
- Verifies `@retry` logic and `timeout` guards are active across all volatile calls.
- Ensures **Sovereign Gate** compliance (Audit Score > 90).

---

## 📊 Infrastructure Decision Matrix

| Feature | Agent Engine | Cloud Run | GKE |
| :--- | :--- | :--- | :--- |
| **Orchestration** | Managed (ADK) | Custom (FastAPI) | Custom (K8s) |
| **Scaling** | Automatic | Scale-to-Zero | Dynamic / GPU |
| **Observability** | Vertex AI Traces | Cloud Logging | Prometheus / Istio |
| **Best Case** | Fast Prototyping | Standard Web Agents | High-Perf Enterprise |

---

## 🛡️ v1.3: Deep System Audit
For production-gate promotion, move from "Safe-Build" to "Deep Audit":
```bash
make audit-deep
```
- Full Adversarial Red-Teaming.
- Iterative Quality Hill Climbing.
- Precision Load Testing (`make load-test`).

---

## 🔑 Secret Management
Never commit `.env` files. Use **Google Cloud Secret Manager** and map them as environment variables in Cloud Run.

---
*Generated by the AgentOps Cockpit. Global Operations Division (v1.4.7 Stable).*
