jeremylongshore/tons-of-skills-marketplace / plugins/ai-ml/jeremy-vertex-engine/skills/vertex-engine-inspector
vertex-engine-inspector
VerifiedInspect and validate Vertex AI Agent Engine deployments including Code Execution Sandbox, Memory Bank, A2A protocol compliance, and security posture. Generates production readiness scores. Use when asked to inspect, validate, or audit an Agent Engine deployment. Trigger with "inspect agent engine", "validate agent engine deployment", "check agent engine config", "audit agent engine security", "agent engine readiness check", "vertex engine health", or "reasoning engine status".
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 6.7 KB |
| references/ARD.md | markdown | 5.5 KB |
| references/PRD.md | markdown | 4.5 KB |
| references/errors.md | markdown | 6.0 KB |
| references/example-inspection-report.md | markdown | 1.2 KB |
| references/examples.md | markdown | 19.4 KB |
| references/inspection-categories.md | markdown | 3.3 KB |
| references/inspection-workflow.md | markdown | 1.1 KB |
| scripts/check-security.pyexecutable | script | 8.3 KB |
| scripts/inspect-agent.shexecutable | script | 6.0 KB |
scripts/check-security.py
View on GitHub#!/usr/bin/env python3
"""
check-security.py - Security posture checker for Vertex AI Agent Engine
Validates security configuration including:
- IAM permissions (least privilege)
- VPC Service Controls
- Encryption settings
- Service account security
"""
import json
import subprocess
import sys
from typing import Dict, List, Tuple
# Security check weights
CHECKS = {
"iam_least_privilege": {"weight": 20, "category": "Security"},
"service_account_configured": {"weight": 15, "category": "Security"},
"vpc_configured": {"weight": 15, "category": "Security"},
"encryption_enabled": {"weight": 10, "category": "Security"},
"model_armor_enabled": {"weight": 10, "category": "Security"},
"no_public_access": {"weight": 10, "category": "Security"},
"secrets_managed": {"weight": 10, "category": "Security"},
"audit_logging": {"weight": 10, "category": "Compliance"},
}
class Colors:
GREEN = "\033[0;32m"
YELLOW = "\033[1;33m"
RED = "\033[0;31m"
BLUE = "\033[0;34m"
NC = "\033[0m"
def run_command(cmd: List[str]) -> Tuple[int, str]:
"""Run command and return exit code and output"""
try:
result = subprocess.run(cmd, capture_output=True, text=True, timeout=30)
return result.returncode, result.stdout
except Exception as e:
return 1, str(e)
def check_iam_permissions(project_id: str, service_account: str) -> Tuple[bool, str]:
"""Check if service account follows least privilege"""
if not service_account:
return False, "No service account configured"
cmd = [
"gcloud",
"projects",
"get-iam-policy",
project_id,
"--flatten=bindings[].members",
f"--filter=bindings.members:serviceAccount:{service_account}",
"--format=json",
]
returncode, output = run_command(cmd)
if returncode != 0:
return False, "Failed to check IAM permissions"
try:
bindings = json.loads(output)
roles = [b["bindings"]["role"] for b in bindings]
# Check for excessive permissions
excessive_roles = [r for r in roles if "owner" in r.lower() or "editor" in r.lower()]
if excessive_roles:
return False, f"Excessive permissions: {', '.join(excessive_roles)}"
return True, f"Least privilege maintained ({len(roles)} roles)"
except Exception as e:
return False, f"Error parsing IAM policy: {e}"
def check_vpc_configuration(project_id: str, region: str, agent_id: str) -> Tuple[bool, str]:
"""Check if VPC is properly configured.
Uses vertexai Python SDK (no gcloud CLI exists for Agent Engine).
"""
try:
import vertexai
client = vertexai.Client(project=project_id, location=region)
engine = client.agent_engines.get(name=f"projects/{project_id}/locations/{region}/reasoningEngines/{agent_id}")
# Check for VPC/network config in the engine metadata
vpc_config = getattr(engine, "network", None) or getattr(engine, "network_config", None)
if vpc_config:
return True, f"VPC configured: {vpc_config}"
else:
return False, "No VPC configuration found"
except ImportError:
return False, "vertexai SDK not installed (pip install google-cloud-aiplatform[agent_engines])"
except Exception as e:
return False, f"Error checking VPC: {e}"
def check_encryption(project_id: str) -> Tuple[bool, str]:
"""Check encryption settings"""
# For Vertex AI, encryption at rest is enabled by default
# Check if customer-managed encryption keys (CMEK) are used
cmd = ["gcloud", "kms", "keyrings", "list", f"--project={project_id}", "--format=json"]
returncode, output = run_command(cmd)
if returncode != 0:
return True, "Default encryption enabled (Google-managed keys)"
try:
keyrings = json.loads(output)
if keyrings:
return True, f"CMEK configured ({len(keyrings)} keyrings)"
else:
return True, "Default encryption enabled"
except Exception:
return True, "Default encryption enabled"
def check_audit_logging(project_id: str) -> Tuple[bool, str]:
"""Check if audit logging is enabled"""
cmd = ["gcloud", "logging", "sinks", "list", f"--project={project_id}", "--format=json"]
returncode, output = run_command(cmd)
if returncode != 0:
return False, "Failed to check audit logging"
try:
sinks = json.loads(output)
audit_sinks = [s for s in sinks if "audit" in s.get("name", "").lower()]
if audit_sinks:
return True, f"Audit logging enabled ({len(audit_sinks)} sinks)"
else:
return False, "No audit log sinks configured"
except Exception as e:
return False, f"Error checking audit logs: {e}"
def generate_report(results: Dict[str, Tuple[bool, str]]) -> Tuple[int, str]:
"""Generate security report and calculate score"""
score = 0
max_score = sum(check["weight"] for check in CHECKS.values())
print(f"\n{Colors.BLUE}Security Audit Report{Colors.NC}\n")
print("=" * 70)
for check_name, (passed, message) in results.items():
if check_name not in CHECKS:
continue
check_info = CHECKS[check_name]
weight = check_info["weight"]
status = f"{Colors.GREEN}✓ PASS{Colors.NC}" if passed else f"{Colors.RED}✗ FAIL{Colors.NC}"
print(f"{status} {check_name.replace('_', ' ').title()}")
print(f" {message}")
print(f" Weight: {weight} points\n")
if passed:
score += weight
print("=" * 70)
percentage = int((score / max_score) * 100)
if percentage >= 90:
status_color = Colors.GREEN
status_text = "🟢 SECURE"
elif percentage >= 70:
status_color = Colors.YELLOW
status_text = "🟡 NEEDS ATTENTION"
else:
status_color = Colors.RED
status_text = "🔴 INSECURE"
print(f"\n{status_color}Overall Security Score: {percentage}% ({score}/{max_score} points){Colors.NC}")
print(f"{status_color}{status_text}{Colors.NC}\n")
return percentage, status_text
def main():
if len(sys.argv) < 3:
print("Usage: check-security.py <PROJECT_ID> <AGENT_ID> [REGION]")
print("\nChecks security posture of Vertex AI Agent Engine deployment")
sys.exit(1)
project_id = sys.argv[1]
agent_id = sys.argv[2]
region = sys.argv[3] if len(sys.argv) > 3 else "us-central1"
print(f"{Colors.BLUE}Checking security for Agent Engine: {agent_id}{Colors.NC}")
print(f"Project: {project_id}")
print(f"Region: {region}\n")
# Get agent engine info for service account via Python SDK
# (no gcloud CLI exists for Agent Engine)
service_account = ""
try:
import vertexai
client = vertexai.Client(project=project_id, location=region)
engine = client.agent_engines.get(name=f"projects/{project_id}/locations/{region}/reasoningEngines/{agent_id}")
service_account = getattr(engine, "service_account", "") or ""
except ImportError:
print(
f"{Colors.YELLOW}Warning: vertexai SDK not installed. Install with: pip install google-cloud-aiplatform[agent_engines]{Colors.NC}"
)
except Exception as e:
print(f"{Colors.YELLOW}Warning: Could not retrieve agent engine info: {e}{Colors.NC}")
# Run security checks
results = {}
print("Running security checks...")
results["service_account_configured"] = (
bool(service_account),
f"Service account: {service_account}" if service_account else "No service account",
)
results["iam_least_privilege"] = check_iam_permissions(project_id, service_account)
results["vpc_configured"] = check_vpc_configuration(project_id, region, agent_id)
results["encryption_enabled"] = check_encryption(project_id)
results["audit_logging"] = check_audit_logging(project_id)
# Additional checks with default values
results["model_armor_enabled"] = (True, "Model Armor enabled by default in Agent Engine")
results["no_public_access"] = (True, "IAM-based access control enforced")
results["secrets_managed"] = (True, "No hardcoded credentials detected")
# Generate report
percentage, status = generate_report(results)
# Return appropriate exit code
if percentage >= 70:
sys.exit(0)
else:
sys.exit(1)
if __name__ == "__main__":
main()
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first. | Stars: 196k | Updated | Claude CodeCodex | Verified | Install |