everything-gemini 2.0.0 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,57 @@
1
+ #!/usr/bin/env bash
2
+ # Everything Gemini Budget Guard: Hard Spend & Token Cap Gate
3
+ # Intercepts tool execution to prevent runaway API spend in recursive Harness² loops.
4
+ # Reads protojson hook payload from stdin, evaluates spend against ceiling, outputs JSON on stdout.
5
+
6
+ set -eo pipefail
7
+
8
+ PAYLOAD=$(cat)
9
+
10
+ OUTPUT=$(node -e "
11
+ const fs = require('fs');
12
+ const path = require('path');
13
+
14
+ const maxUsdEnv = process.env.MAX_USD_BUDGET || process.env.BUDGET_CAP_USD;
15
+ const stateFile = process.env.BUDGET_STATE_FILE || path.join(process.cwd(), '.budget_state.json');
16
+
17
+ let state = { totalSpentUsd: 0.0, totalInvocations: 0, lastCheck: new Date().toISOString() };
18
+ if (fs.existsSync(stateFile)) {
19
+ try {
20
+ state = JSON.parse(fs.readFileSync(stateFile, 'utf8'));
21
+ } catch (_) {}
22
+ }
23
+
24
+ let costDelta = 0.005; // Base default estimation per tool step (~1500 tokens Gemini 1.5/2.0)
25
+ try {
26
+ const p = JSON.parse(process.argv[1] || '{}');
27
+ if (p.tokens) {
28
+ const promptTokens = p.tokens.prompt || 0;
29
+ const completionTokens = p.tokens.completion || 0;
30
+ // Gemini Flash pricing: $0.075 / 1M prompt, $0.30 / 1M completion
31
+ costDelta = (promptTokens * 0.000000075) + (completionTokens * 0.00000030);
32
+ }
33
+ } catch (_) {}
34
+
35
+ state.totalSpentUsd = parseFloat((state.totalSpentUsd + costDelta).toFixed(5));
36
+ state.totalInvocations += 1;
37
+ state.lastCheck = new Date().toISOString();
38
+
39
+ try {
40
+ fs.writeFileSync(stateFile, JSON.stringify(state, null, 2), 'utf8');
41
+ } catch (_) {}
42
+
43
+ if (maxUsdEnv) {
44
+ const maxCap = parseFloat(maxUsdEnv);
45
+ if (!isNaN(maxCap) && state.totalSpentUsd >= maxCap) {
46
+ console.log(JSON.stringify({
47
+ decision: 'deny',
48
+ reason: \`[Budget Guard] Hard spend limit reached: $\${state.totalSpentUsd.toFixed(3)} >= $\${maxCap.toFixed(2)}. Halting recursive harness execution to prevent credit exhaustion.\`
49
+ }));
50
+ process.exit(0);
51
+ }
52
+ }
53
+
54
+ console.log(JSON.stringify({ decision: 'allow' }));
55
+ " "$PAYLOAD")
56
+
57
+ echo "$OUTPUT"
@@ -0,0 +1,16 @@
1
+ {
2
+ "human-gate": {
3
+ "PreToolUse": [
4
+ {
5
+ "matcher": "run_command|write_to_file|replace_file_content|multi_replace_file_content",
6
+ "hooks": [
7
+ {
8
+ "type": "command",
9
+ "command": "bash ./scripts/human-gate.sh",
10
+ "timeout": 15
11
+ }
12
+ ]
13
+ }
14
+ ]
15
+ }
16
+ }
@@ -0,0 +1,67 @@
1
+ #!/usr/bin/env bash
2
+ # HumanGate: Event-Driven Human-in-the-Loop Interceptor
3
+ # Intercepts speculative mutations to agent harness surfaces (.agents/, rules/, hooks/)
4
+ # and destructive administrative actions, ensuring human oversight before persistence.
5
+
6
+ set -eo pipefail
7
+
8
+ PAYLOAD=$(cat)
9
+
10
+ CHECK_RESULT=$(node -e "
11
+ try {
12
+ const p = JSON.parse(process.argv[1]);
13
+ const tool = p.toolCall?.name || '';
14
+ const args = p.toolCall?.args || {};
15
+
16
+ // 1. Inspect file writes and mutations to core agent governance files
17
+ const targetFile = args.TargetFile || args.path || args.file || '';
18
+ const sensitivePaths = [
19
+ 'rules/common/GEMINI.md',
20
+ 'rules/common/AGENTS.md',
21
+ '.agents/rules',
22
+ 'hooks/',
23
+ 'harness.yaml',
24
+ 'harness.json'
25
+ ];
26
+
27
+ for (const s of sensitivePaths) {
28
+ if (targetFile.includes(s)) {
29
+ console.log(JSON.stringify({
30
+ decision: 'ask',
31
+ reason: '[HumanGate] Structural modification to agent harness surface (' + s + ') requires explicit engineer confirmation.'
32
+ }));
33
+ process.exit(0);
34
+ }
35
+ }
36
+
37
+ // 2. Inspect command-line actions for high-risk operations
38
+ const cmd = args.CommandLine || '';
39
+ const highRiskCmds = [
40
+ 'gcloud projects delete',
41
+ 'bq rm',
42
+ 'terraform apply',
43
+ 'kubectl apply',
44
+ 'git push origin main',
45
+ 'git push --force'
46
+ ];
47
+
48
+ for (const r of highRiskCmds) {
49
+ if (cmd.includes(r)) {
50
+ console.log(JSON.stringify({
51
+ decision: 'ask',
52
+ reason: '[HumanGate] High-impact command execution (' + r + ') requires explicit interactive confirmation.'
53
+ }));
54
+ process.exit(0);
55
+ }
56
+ }
57
+
58
+ // Safe to proceed
59
+ console.log(JSON.stringify({ decision: 'allow' }));
60
+ } catch (err) {
61
+ // Graceful fallback to allow if payload parsing fails
62
+ console.log(JSON.stringify({ decision: 'allow' }));
63
+ }
64
+ " "$PAYLOAD")
65
+
66
+ echo "$CHECK_RESULT"
67
+ exit 0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "everything-gemini",
3
- "version": "2.0.0",
3
+ "version": "2.2.0",
4
4
  "description": "Everything Gemini (everything-gemini) - The Ultimate Agent Harness, Multi-Agent Orchestrator & Performance Suite for Gemini & Google Antigravity",
5
5
  "main": "bin/everything-gemini",
6
6
  "bin": {
@@ -0,0 +1,26 @@
1
+ #!/usr/bin/env bash
2
+ # Everything Gemini Harness² Rollback Tool
3
+ # Restores the workspace state from an ephemeral snapshot when a candidate probe fails.
4
+
5
+ set -eo pipefail
6
+
7
+ SNAPSHOT_DIR="${1:-.harness_snapshot}"
8
+
9
+ if [ ! -d "$SNAPSHOT_DIR" ]; then
10
+ echo "{\"status\": \"error\", \"message\": \"No snapshot directory found at $SNAPSHOT_DIR\"}"
11
+ exit 0
12
+ fi
13
+
14
+ # 1. If patch file exists, restore
15
+ if [ -f "$SNAPSHOT_DIR/worktree.patch" ] && git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
16
+ # Revert changes made during probe
17
+ git checkout . 2>/dev/null || true
18
+ if [ -s "$SNAPSHOT_DIR/worktree.patch" ]; then
19
+ git apply "$SNAPSHOT_DIR/worktree.patch" 2>/dev/null || true
20
+ fi
21
+ fi
22
+
23
+ # Clean up snapshot directory
24
+ rm -rf "$SNAPSHOT_DIR"
25
+
26
+ echo "{\"status\": \"rollback_complete\", \"snapshotDir\": \"$SNAPSHOT_DIR\"}"
@@ -0,0 +1,30 @@
1
+ #!/usr/bin/env bash
2
+ # Everything Gemini Harness² Snapshot Tool
3
+ # Takes an ephemeral state snapshot of the workspace before running candidate probes.
4
+
5
+ set -eo pipefail
6
+
7
+ SNAPSHOT_DIR="${1:-.harness_snapshot}"
8
+ mkdir -p "$SNAPSHOT_DIR"
9
+
10
+ TIMESTAMP=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
11
+
12
+ # 1. Git-based diff snapshot if in git worktree
13
+ if git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
14
+ git diff HEAD > "$SNAPSHOT_DIR/worktree.patch" 2>/dev/null || true
15
+ git status --porcelain > "$SNAPSHOT_DIR/status.txt" 2>/dev/null || true
16
+ GIT_HEAD=$(git rev-parse HEAD 2>/dev/null || echo "unknown")
17
+ else
18
+ GIT_HEAD="non-git"
19
+ fi
20
+
21
+ cat <<EOF > "$SNAPSHOT_DIR/snapshot_manifest.json"
22
+ {
23
+ "timestamp": "$TIMESTAMP",
24
+ "gitHead": "$GIT_HEAD",
25
+ "snapshotDir": "$SNAPSHOT_DIR",
26
+ "status": "active"
27
+ }
28
+ EOF
29
+
30
+ echo "{\"status\": \"snapshot_created\", \"timestamp\": \"$TIMESTAMP\", \"snapshotDir\": \"$SNAPSHOT_DIR\"}"
@@ -149,7 +149,7 @@ if [ -f "$REPO_ROOT/tests/cli.test.js" ]; then
149
149
  echo " ❌ ERROR: CLI test suite failed."
150
150
  ERRORS=$((ERRORS + 1))
151
151
  else
152
- echo " ✔ CLI test suite passed (31 assertions)"
152
+ echo " ✔ CLI test suite passed (33 assertions)"
153
153
  fi
154
154
  fi
155
155
 
@@ -0,0 +1,205 @@
1
+ ---
2
+ name: bigquery-vector-search
3
+ description: Implements Google BigQuery native vector search, VECTOR_SEARCH SQL statements, ML.GENERATE_TEXT_EMBEDDING, IVF indexing, and BigLake hybrid semantic RAG.
4
+ ---
5
+
6
+ # BigQuery Vector Search & Semantic Analytics
7
+
8
+ Architects, indexes, and queries large-scale vector embeddings directly inside Google BigQuery using native `VECTOR_SEARCH` syntax, Inverted File (IVF) vector indexes, and `ML.GENERATE_TEXT_EMBEDDING` with Gemini models.
9
+
10
+ ---
11
+
12
+ ## 1. Architecture: BigQuery In-Database Vector Analytics
13
+
14
+ ```
15
+ ┌─────────────────────────────────────────────────────────────────────────────┐
16
+ │ Google Cloud BigQuery │
17
+ │ │
18
+ │ ┌────────────────────┐ ┌──────────────────┐ ┌─────────────────┐ │
19
+ │ │ Structured Records │ │ Unstructured │ │ BigLake Object │ │
20
+ │ │ (SQL Tables) │ │ Text & Metadata │ │ Tables (GCS) │ │
21
+ │ └─────────┬──────────┘ └────────┬─────────┘ └────────┬────────┘ │
22
+ │ │ │ │ │
23
+ │ └──────────────────┬───────┴─────────────────────────┘ │
24
+ │ │ │
25
+ │ ▼ │
26
+ │ ┌───────────────────────────────────────────────┐ │
27
+ │ │ ML.GENERATE_TEXT_EMBEDDING (Vertex AI Gemini) │ │
28
+ │ │ 768-dim embeddings stored as ARRAY<FLOAT64> │ │
29
+ │ └───────────────────────┬───────────────────────┘ │
30
+ │ │ │
31
+ │ ▼ │
32
+ │ ┌───────────────────────────────────────────────┐ │
33
+ │ │ IVF Vector Index (Inverted File Partitioning) │ │
34
+ │ │ Distance: COSINE / EUCLIDEAN / DOT_PRODUCT │ │
35
+ │ └───────────────────────┬───────────────────────┘ │
36
+ │ │ │
37
+ │ ▼ │
38
+ │ ┌───────────────────────────────────────────────┐ │
39
+ │ │ VECTOR_SEARCH + Post-Filter SQL Join │ │
40
+ │ │ Sub-second Top-K nearest neighbor retrieval │ │
41
+ │ └───────────────────────────────────────────────┘ │
42
+ └─────────────────────────────────────────────────────────────────────────────┘
43
+ ```
44
+
45
+ ---
46
+
47
+ ## 2. IVF Vector Indexing
48
+
49
+ BigQuery supports Inverted File Flat (IVF) indexes to partition vector space into Voronoi cells, accelerating approximate nearest neighbor (ANN) retrieval across billions of rows.
50
+
51
+ ```sql
52
+ -- 1. Create native vector index on embedding column
53
+ CREATE VECTOR INDEX IF NOT EXISTS knowledge_vector_idx
54
+ ON `my_project.agent_knowledge.document_chunks`(embedding)
55
+ STORING(chunk_id, doc_id, section_title)
56
+ OPTIONS(
57
+ index_type = 'IVF',
58
+ distance_type = 'COSINE',
59
+ ivf_options = '{"num_lists": 1000}'
60
+ );
61
+ ```
62
+
63
+ - **`num_lists`**: The number of Voronoi partitions (rule of thumb: $\sqrt{N}$ where $N$ is row count).
64
+ - **`distance_type`**: `COSINE` (recommended for normalized embeddings), `EUCLIDEAN`, or `DOT_PRODUCT`.
65
+ - **`STORING`**: Co-locates frequently queried payload attributes in the vector index leaf nodes, eliminating secondary table lookups.
66
+
67
+ ---
68
+
69
+ ## 3. In-Database Embeddings Generation with Gemini
70
+
71
+ Connect BigQuery directly to Vertex AI Gemini text-embedding models:
72
+
73
+ ```sql
74
+ -- 1. Create connection to Vertex AI Remote Model
75
+ CREATE OR REPLACE MODEL `my_project.agent_knowledge.gemini_embedding_model`
76
+ REMOTE WITH CONNECTION `projects/my_project/locations/us-central1/connections/vertex-ai-conn`
77
+ OPTIONS(
78
+ endpoint = 'text-embedding-004'
79
+ );
80
+
81
+ -- 2. Batch generate embeddings for newly inserted document chunks
82
+ INSERT INTO `my_project.agent_knowledge.document_chunks` (chunk_id, doc_id, content, embedding)
83
+ SELECT
84
+ ml_generate_embedding_result.chunk_id,
85
+ ml_generate_embedding_result.doc_id,
86
+ ml_generate_embedding_result.content,
87
+ ml_generate_embedding_result.text_embedding AS embedding
88
+ FROM ML.GENERATE_TEXT_EMBEDDING(
89
+ MODEL `my_project.agent_knowledge.gemini_embedding_model`,
90
+ (
91
+ SELECT chunk_id, doc_id, content
92
+ FROM `my_project.agent_knowledge.raw_chunks`
93
+ WHERE processed_at IS NULL
94
+ ),
95
+ STRUCT(
96
+ 'RETRIEVAL_DOCUMENT' AS task_type,
97
+ 768 AS output_dimensionality
98
+ )
99
+ ) AS ml_generate_embedding_result;
100
+ ```
101
+
102
+ ---
103
+
104
+ ## 4. Native `VECTOR_SEARCH` Execution
105
+
106
+ Query embeddings directly with sub-second latency and zero external vector database infrastructure:
107
+
108
+ ```sql
109
+ -- Top-10 semantic search with structured tenant/date pre-filtering
110
+ SELECT
111
+ base.chunk_id,
112
+ base.doc_id,
113
+ base.content,
114
+ distance
115
+ FROM VECTOR_SEARCH(
116
+ TABLE `my_project.agent_knowledge.document_chunks`,
117
+ 'embedding',
118
+ (
119
+ -- Embed user query dynamically using Gemini
120
+ SELECT text_embedding AS query_vector
121
+ FROM ML.GENERATE_TEXT_EMBEDDING(
122
+ MODEL `my_project.agent_knowledge.gemini_embedding_model`,
123
+ (SELECT 'What are the spend limit policies for autonomous subagents?' AS content),
124
+ STRUCT('RETRIEVAL_QUERY' AS task_type, 768 AS output_dimensionality)
125
+ )
126
+ ),
127
+ top_k => 10,
128
+ distance_type => 'COSINE',
129
+ options => '{"fraction_lists_to_search": 0.05}'
130
+ );
131
+ ```
132
+
133
+ - **`fraction_lists_to_search`**: Controls recall vs. latency tradeoff (0.01 to 0.20). Higher values increase recall at slightly higher compute cost.
134
+
135
+ ---
136
+
137
+ ## 5. Hybrid Search (Lexical BM25 + Semantic Vector)
138
+
139
+ Combine BigQuery native search indexes (`SEARCH`) with `VECTOR_SEARCH` using Reciprocal Rank Fusion (RRF):
140
+
141
+ ```sql
142
+ WITH vector_matches AS (
143
+ SELECT
144
+ base.chunk_id,
145
+ base.content,
146
+ ROW_NUMBER() OVER (ORDER BY distance ASC) AS vector_rank
147
+ FROM VECTOR_SEARCH(
148
+ TABLE `my_project.agent_knowledge.document_chunks`,
149
+ 'embedding',
150
+ (SELECT text_embedding FROM ML.GENERATE_TEXT_EMBEDDING(
151
+ MODEL `my_project.agent_knowledge.gemini_embedding_model`,
152
+ (SELECT 'subagent spend guardrails' AS content),
153
+ STRUCT('RETRIEVAL_QUERY' AS task_type)
154
+ )),
155
+ top_k => 50,
156
+ distance_type => 'COSINE'
157
+ )
158
+ ),
159
+ keyword_matches AS (
160
+ SELECT
161
+ chunk_id,
162
+ content,
163
+ ROW_NUMBER() OVER () AS keyword_rank
164
+ FROM `my_project.agent_knowledge.document_chunks`
165
+ WHERE SEARCH(content, 'guardrail spend budget ceiling')
166
+ LIMIT 50
167
+ )
168
+ SELECT
169
+ COALESCE(v.chunk_id, k.chunk_id) AS chunk_id,
170
+ COALESCE(v.content, k.content) AS content,
171
+ (
172
+ COALESCE(1.0 / (60 + v.vector_rank), 0.0) +
173
+ COALESCE(1.0 / (60 + k.keyword_rank), 0.0)
174
+ ) AS rrf_score
175
+ FROM vector_matches v
176
+ FULL OUTER JOIN keyword_matches k ON v.chunk_id = k.chunk_id
177
+ ORDER BY rrf_score DESC
178
+ LIMIT 10;
179
+ ```
180
+
181
+ ---
182
+
183
+ ## 6. Enterprise Best Practices & Anti-Patterns
184
+
185
+ | Category | Recommended Pattern | Anti-Pattern |
186
+ | :--- | :--- | :--- |
187
+ | **Index Choice** | Use IVF with `num_lists` scaled to $\sqrt{N}$ for $N > 100,000$ rows | Querying `ARRAY<FLOAT64>` with brute-force `COSINE_DISTANCE()` |
188
+ | **Payload Storage** | Store lightweight metadata with `STORING(...)` inside index | Joining 10 high-cardinality tables after vector search |
189
+ | **Embedding Types** | Specify `RETRIEVAL_DOCUMENT` during indexing, `RETRIEVAL_QUERY` during search | Using default task types causing asymmetric vector drift |
190
+ | **Partitioning** | Partition and cluster base table on tenant ID or ingestion date | Single unpartitioned table forcing full-table vector scans |
191
+
192
+ ---
193
+
194
+ ## 7. CLI Runbook (`bq` CLI)
195
+
196
+ ```bash
197
+ # 1. Create BigQuery dataset for vector embeddings
198
+ bq mk --dataset --location=us-central1 my_project:agent_knowledge
199
+
200
+ # 2. Check vector index status and coverage
201
+ bq show --format=prettyjson my_project:agent_knowledge.document_chunks | jq '.vectorSearchStatistics'
202
+
203
+ # 3. Dry-run vector query to estimate bytes scanned
204
+ bq query --use_legacy_sql=false --dry_run < vector_query.sql
205
+ ```
@@ -0,0 +1,167 @@
1
+ ---
2
+ name: cloud-run-agents
3
+ description: Packages, deploys, and scales autonomous Antigravity and Gemini agents on Google Cloud Run services and Cloud Run Jobs with Eventarc triggers and GPU scheduling.
4
+ ---
5
+
6
+ # Cloud Run Autonomous Agents
7
+
8
+ Packages, containerizes, and deploys autonomous Google Antigravity & Gemini agents on Google Cloud Run. Covers HTTP agent services, batch-oriented Cloud Run Jobs for recursive Harness² probing, Eventarc event triggers, and NVIDIA L4 GPU acceleration.
9
+
10
+ ---
11
+
12
+ ## 1. Architecture: Cloud Run Agent Execution Models
13
+
14
+ ```
15
+ Google Cloud Run
16
+ ┌─────────────────────────────────────────────────────────────────────────────┐
17
+ │ 1. CLOUD RUN SERVICE (Interactive / Webhook Agents) │
18
+ │ • Real-time Gemini Live WebSocket / HTTP streaming │
19
+ │ • Automatic scale-to-zero when idle │
20
+ │ • Up to 60-minute request timeout with WebSockets enabled │
21
+ ├─────────────────────────────────────────────────────────────────────────────┤
22
+ │ 2. CLOUD RUN JOBS (Batch / Recursive Probing Agents) │
23
+ │ • Long-running Harness² Propose-Probe-Compose workflows (up to 24 hours) │
24
+ │ • Parallel array task execution for multi-candidate testing │
25
+ │ • Zero HTTP gateway overhead; triggered via Cloud Scheduler / Workflows │
26
+ ├─────────────────────────────────────────────────────────────────────────────┤
27
+ │ 3. CLOUD RUN WITH GPU (NVIDIA L4 / T4) │
28
+ │ • Co-locates agent logic with local verification models (vLLM / Triton) │
29
+ │ • Direct hardware acceleration for code analysis & AST parsing │
30
+ └─────────────────────────────────────────────────────────────────────────────┘
31
+ ```
32
+
33
+ ---
34
+
35
+ ## 2. Agent Container Specification (Dockerfile)
36
+
37
+ Production multi-stage Dockerfile bundling the agent runtime, Node CLI, and Python SDK:
38
+
39
+ ```dockerfile
40
+ # syntax=docker/dockerfile:1
41
+ FROM python:3.11-slim AS base
42
+
43
+ ENV PYTHONUNBUFFERED=1 \
44
+ DEBIAN_FRONTEND=noninteractive \
45
+ PORT=8080
46
+
47
+ WORKDIR /app
48
+
49
+ # Install system dependencies & Node.js for CLI tools
50
+ RUN apt-get update && apt-get install -y --no-install-recommends \
51
+ curl \
52
+ git \
53
+ ca-certificates \
54
+ && curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
55
+ && apt-get install -y nodejs \
56
+ && rm -rf /var/lib/apt/lists/*
57
+
58
+ # Install everything-gemini CLI globally
59
+ RUN npm install -g everything-gemini
60
+
61
+ # Copy Python requirements & install
62
+ COPY requirements.txt .
63
+ RUN pip install --no-cache-dir -r requirements.txt
64
+
65
+ # Copy agent definitions and source code
66
+ COPY . .
67
+
68
+ # Run as non-root user for enterprise container security
69
+ RUN useradd -m -u 10001 agentuser && chown -R agentuser:agentuser /app
70
+ USER 10001
71
+
72
+ EXPOSE 8080
73
+ ENTRYPOINT ["uvicorn", "server:app", "--host", "0.0.0.0", "--port", "8080"]
74
+ ```
75
+
76
+ ---
77
+
78
+ ## 3. Cloud Run Service Deployment (`gcloud`)
79
+
80
+ Deploy an interactive agent service with Workload Identity and automated secret injection:
81
+
82
+ ```bash
83
+ gcloud run deploy antigravity-agent-service \
84
+ --image="gcr.io/my_project/antigravity-agent:v2.2.0" \
85
+ --region="us-central1" \
86
+ --platform="managed" \
87
+ --service-account="agent-runner@my_project.iam.gserviceaccount.com" \
88
+ --cpu=4 \
89
+ --memory=8Gi \
90
+ --concurrency=10 \
91
+ --timeout=3600 \
92
+ --min-instances=0 \
93
+ --max-instances=20 \
94
+ --set-env-vars="GEMINI_MODEL=gemini-2.0-flash,MAX_USD_BUDGET=15.00" \
95
+ --set-secrets="GEMINI_API_KEY=gemini-api-key:latest" \
96
+ --vpc-egress=private-ranges-only \
97
+ --ingress=internal-and-cloud-load-balancing
98
+ ```
99
+
100
+ ---
101
+
102
+ ## 4. Cloud Run Jobs for Harness² Recursive Probing
103
+
104
+ When running test-time recursive optimization (Propose-Probe-Compose) that exceeds standard HTTP request limits, package the run into a Cloud Run Job:
105
+
106
+ ```bash
107
+ # 1. Create Cloud Run Job with 3 parallel task instances
108
+ gcloud run jobs create harness2-probe-runner \
109
+ --image="gcr.io/my_project/harness2-runner:v2.2.0" \
110
+ --region="us-central1" \
111
+ --tasks=3 \
112
+ --max-retries=1 \
113
+ --task-timeout=7200s \
114
+ --cpu=8 \
115
+ --memory=16Gi \
116
+ --command="everything-gemini" \
117
+ --args="harness2,run,--bench,local,--max-usd,25,--snapshot,--json"
118
+
119
+ # 2. Trigger asynchronous execution of the probe job
120
+ gcloud run jobs execute harness2-probe-runner --region="us-central1" --wait
121
+ ```
122
+
123
+ ---
124
+
125
+ ## 5. Eventarc Trigger Binding (Event-Driven Agent Workflow)
126
+
127
+ Automatically invoke agents whenever new code repositories or error traces land in Cloud Storage:
128
+
129
+ ```bash
130
+ gcloud eventarc triggers create trace-ingestion-trigger \
131
+ --location="us-central1" \
132
+ --destination-run-service="antigravity-agent-service" \
133
+ --destination-run-region="us-central1" \
134
+ --destination-run-path="/webhooks/trace-ingest" \
135
+ --event-filters="type=google.cloud.storage.object.v1.finalized" \
136
+ --event-filters="bucket=production-failure-traces" \
137
+ --service-account="eventarc-invoker@my_project.iam.gserviceaccount.com"
138
+ ```
139
+
140
+ ---
141
+
142
+ ## 6. NVIDIA L4 GPU Configuration
143
+
144
+ Accelerate on-container verification models or local embedding calculations:
145
+
146
+ ```bash
147
+ gcloud beta run deploy local-verifier-agent \
148
+ --image="gcr.io/my_project/verifier-agent-l4:latest" \
149
+ --region="us-central1" \
150
+ --cpu=8 \
151
+ --memory=32Gi \
152
+ --gpu=1 \
153
+ --gpu-type=nvidia-l4 \
154
+ --no-cpu-throttling \
155
+ --timeout=1800
156
+ ```
157
+
158
+ ---
159
+
160
+ ## 7. Enterprise Production Checklist
161
+
162
+ | Category | Requirement | Verification Method |
163
+ | :--- | :--- | :--- |
164
+ | **IAM Security** | Dedicated service account with least-privilege Vertex AI roles | `roles/aiplatform.user` only; no Owner/Editor permissions |
165
+ | **Secret Management** | Mount API keys directly from Google Secret Manager | Use `--set-secrets`; never bake keys into Docker layers |
166
+ | **Budget Enforcement** | Enforce `--set-env-vars="MAX_USD_BUDGET=..."` bound to `budget-guard` | Verification in PreToolUse hook |
167
+ | **Graceful Shutdown** | Handle `SIGTERM` within 10s to flush ephemeral logs to Cloud Storage | Python `signal.signal(signal.SIGTERM, handler)` |