Skip to content

jeremylongshore/tons-of-skills-marketplace / plugins/ai-ml/jeremy-vertex-engine/skills/vertex-engine-inspector

vertex-engine-inspector

Verified

Inspect 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".

FileKindSize
SKILL.mdskill md6.7 KB
references/ARD.mdmarkdown5.5 KB
references/PRD.mdmarkdown4.5 KB
references/errors.mdmarkdown6.0 KB
references/example-inspection-report.mdmarkdown1.2 KB
references/examples.mdmarkdown19.4 KB
references/inspection-categories.mdmarkdown3.3 KB
references/inspection-workflow.mdmarkdown1.1 KB
scripts/check-security.pyexecutablescript8.3 KB
scripts/inspect-agent.shexecutablescript6.0 KB

scripts/inspect-agent.sh

View on GitHub
#!/bin/bash
# inspect-agent.sh - Inspect Vertex AI Agent Engine deployment
# Performs comprehensive validation including runtime config, security, and compliance

set -euo pipefail

# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m'

# Configuration
AGENT_ID="${1:-}"
PROJECT_ID="${2:-${GCP_PROJECT_ID:-}}"
REGION="${3:-us-central1}"

usage() {
    cat <<EOF
Usage: $0 <AGENT_ID> [PROJECT_ID] [REGION]

Inspect Vertex AI Agent Engine deployment for production readiness.

Arguments:
    AGENT_ID     Agent resource ID or name
    PROJECT_ID   GCP project ID (default: \$GCP_PROJECT_ID)
    REGION       GCP region (default: us-central1)

Example:
    $0 my-agent my-project us-central1
    GCP_PROJECT_ID=my-project $0 my-agent

EOF
    exit 1
}

if [[ -z "$AGENT_ID" ]]; then
    echo "Error: AGENT_ID is required"
    usage
fi

if [[ -z "$PROJECT_ID" ]]; then
    echo "Error: PROJECT_ID is required (set GCP_PROJECT_ID env var or provide as argument)"
    usage
fi

echo "Inspecting Vertex AI Agent Engine deployment..."
echo "Agent Engine ID: $AGENT_ID"
echo "Project: $PROJECT_ID"
echo "Region: $REGION"
echo ""

# Phase 1: Configuration Analysis
echo -e "${GREEN}Phase 1: Configuration Analysis${NC}"
echo "Retrieving agent engine metadata via Python SDK..."
echo "NOTE: There is no 'gcloud ai agents' CLI — using vertexai Python SDK."

# Use Python SDK to retrieve agent engine metadata (no gcloud CLI exists for Agent Engine)
AGENT_INFO=$(python3 -c "
import json, vertexai
client = vertexai.Client(project='${PROJECT_ID}', location='${REGION}')
engine = client.agent_engines.get(
    name='projects/${PROJECT_ID}/locations/${REGION}/reasoningEngines/${AGENT_ID}'
)
print(json.dumps({'name': engine.name, 'display_name': getattr(engine, 'display_name', 'unknown'), 'state': getattr(engine, 'state', 'unknown'), 'create_time': str(getattr(engine, 'create_time', 'unknown'))}))
" 2>&1 || echo "{}")

if [[ "$AGENT_INFO" == "{}" ]]; then
    echo -e "${RED}Failed to retrieve agent engine information${NC}"
    echo "Ensure google-cloud-aiplatform[agent_engines] is installed and credentials are configured."
    exit 1
fi

echo "$AGENT_INFO" | jq -r '
    "Display Name: \(.display_name // "unknown")",
    "State: \(.state // "unknown")",
    "Created: \(.create_time // "unknown")"
'

# Check Code Execution configuration
CODE_EXEC=$(echo "$AGENT_INFO" | jq -r '.tools[] | select(.codeExecution) | .codeExecution')
if [[ -n "$CODE_EXEC" ]]; then
    TTL=$(echo "$CODE_EXEC" | jq -r '.stateTtl // "unknown"')
    echo -e "${GREEN}Code Execution: Enabled (TTL: $TTL)${NC}"

    # Validate TTL (7-14 days optimal)
    if [[ "$TTL" =~ ^[0-9]+d$ ]]; then
        DAYS="${TTL%d}"
        if (( DAYS >= 7 && DAYS <= 14 )); then
            echo -e "  ${GREEN}✓ TTL optimal ($DAYS days)${NC}"
        elif (( DAYS < 7 )); then
            echo -e "  ${YELLOW}⚠ TTL low ($DAYS days) - may cause session loss${NC}"
        fi
    fi
else
    echo -e "${YELLOW}Code Execution: Disabled${NC}"
fi

# Check Memory Bank configuration
MEMORY_BANK=$(echo "$AGENT_INFO" | jq -r '.tools[] | select(.memoryBank) | .memoryBank')
if [[ -n "$MEMORY_BANK" ]]; then
    MAX_MEMORIES=$(echo "$MEMORY_BANK" | jq -r '.maxMemories // "unknown"')
    echo -e "${GREEN}Memory Bank: Enabled (Max: $MAX_MEMORIES)${NC}"

    if [[ "$MAX_MEMORIES" =~ ^[0-9]+$ ]] && (( MAX_MEMORIES >= 100 )); then
        echo -e "  ${GREEN}✓ Memory limit adequate${NC}"
    else
        echo -e "  ${YELLOW}⚠ Low memory limit may truncate conversations${NC}"
    fi
else
    echo -e "${YELLOW}Memory Bank: Disabled${NC}"
fi

# Phase 2: A2A Protocol Validation
echo ""
echo -e "${GREEN}Phase 2: A2A Protocol Validation${NC}"

AGENT_URL=$(echo "$AGENT_INFO" | jq -r '.endpoint // empty')
if [[ -n "$AGENT_URL" ]]; then
    echo "Testing AgentCard endpoint..."

    AGENT_CARD_URL="${AGENT_URL}/.well-known/agent-card"
    if curl -sf -H "Authorization: Bearer $(gcloud auth print-access-token)" "$AGENT_CARD_URL" > /dev/null 2>&1; then
        echo -e "${GREEN}✓ AgentCard accessible${NC}"
    else
        echo -e "${RED}✗ AgentCard not accessible${NC}"
    fi
else
    echo -e "${YELLOW}⚠ No endpoint URL found${NC}"
fi

# Phase 3: Security Audit
echo ""
echo -e "${GREEN}Phase 3: Security Audit${NC}"

# Check IAM permissions
echo "Checking IAM configuration..."
SERVICE_ACCOUNT=$(echo "$AGENT_INFO" | jq -r '.serviceAccount // empty')
if [[ -n "$SERVICE_ACCOUNT" ]]; then
    echo "Service Account: $SERVICE_ACCOUNT"

    # Check if service account has excessive permissions
    IAM_POLICY=$(gcloud projects get-iam-policy "$PROJECT_ID" \
        --flatten="bindings[].members" \
        --filter="bindings.members:serviceAccount:$SERVICE_ACCOUNT" \
        --format=json)

    ROLES=$(echo "$IAM_POLICY" | jq -r '.[].bindings.role')
    if echo "$ROLES" | grep -q "roles/owner\|roles/editor"; then
        echo -e "${RED}✗ Service account has excessive permissions${NC}"
    else
        echo -e "${GREEN}✓ Service account follows least privilege${NC}"
    fi
else
    echo -e "${YELLOW}⚠ No service account configured${NC}"
fi

# Phase 4: Production Readiness Score
echo ""
echo -e "${GREEN}Phase 4: Production Readiness Scoring${NC}"

SCORE=0
MAX_SCORE=100

# Security checks (30 points)
[[ -n "$SERVICE_ACCOUNT" ]] && ((SCORE+=10))
! echo "$ROLES" | grep -q "roles/owner\|roles/editor" && ((SCORE+=20))

# Performance checks (25 points)
[[ -n "$CODE_EXEC" ]] && ((SCORE+=15))
[[ -n "$MEMORY_BANK" ]] && ((SCORE+=10))

# Configuration checks (25 points)
[[ -n "$AGENT_URL" ]] && ((SCORE+=15))
[[ "$(echo "$AGENT_INFO" | jq -r '.state')" == "ACTIVE" ]] && ((SCORE+=10))

# Observability checks (20 points)
[[ -n "$CODE_EXEC" ]] && ((SCORE+=10))
[[ -n "$MEMORY_BANK" ]] && ((SCORE+=10))

PERCENTAGE=$((SCORE * 100 / MAX_SCORE))

echo ""
echo "Overall Score: $PERCENTAGE%"
if (( PERCENTAGE >= 85 )); then
    echo -e "${GREEN}🟢 PRODUCTION READY${NC}"
elif (( PERCENTAGE >= 70 )); then
    echo -e "${YELLOW}🟡 NEEDS IMPROVEMENT${NC}"
else
    echo -e "${RED}🔴 NOT READY${NC}"
fi

echo ""
echo "Inspection complete!"
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: 472kUpdated Claude CodeCodexVerifiedInstall
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: 472kUpdated Claude CodeCodexVerifiedInstall
rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first.Stars: 196kUpdated Claude CodeCodexVerifiedInstall