Skip to main content

Claude Code agent for analyzing Google Cloud Run instances — resource waste, performance, pricing, traffic, and security

Project description

cloudrun-agent

A Claude Code agent that analyzes your Google Cloud Run services and generates a visual dashboard with actionable findings.

Analyzes 6 dimensions: resource waste, performance bottlenecks, pricing, traffic & latency, security posture, and recommendations.

Part of Engineering Team — your engineering team on call.

Quick Start

pip install cloudrun-agent
cloudrun-agent install

This installs the agent definition and skills into ~/.claude/ so they're available in every Claude Code session.

Prerequisites

  • Claude Code installed
  • gcloud CLI installed and authenticated
  • Python 3.10+
  • GCP permissions: Cloud Run Viewer, Monitoring Viewer
gcloud auth login
gcloud config set project YOUR_PROJECT_ID

Usage

In Claude Code (recommended)

Just ask Claude:

> analyze my cloud run services
> show me a dashboard of my cloud run fleet
> which services are wasting resources?
> are there security issues in my cloud run setup?

Claude will use the cloudrun-analyzer agent automatically.

Slash Commands

After install, these slash commands are available in Claude Code:

Command What it does
/cloudrun-dashboard Visual fleet report in browser
/cloudrun-check Quick health check in terminal
/cloudrun-inspect Deep dive into a specific service
/cloudrun-history Compare changes over time

Standalone CLI

# HTML dashboard (opens in browser)
cloudrun-agent analyze --html

# JSON output
cloudrun-agent analyze

# Single service deep dive
cloudrun-agent analyze --service my-api --region us-central1

# Filter by project/region
cloudrun-agent analyze --html --project my-project --region europe-west1

# Skip metrics (faster, config-only analysis)
cloudrun-agent analyze --no-metrics

# View snapshot history
cloudrun-agent analyze --history

# Troubleshooting
cloudrun-agent analyze --verbose

What It Analyzes

Dashboard

The HTML dashboard includes:

  • Health score — weighted 0-100 score based on finding severity
  • KPI cards — service count, estimated monthly cost, daily requests, finding counts
  • Services table — per-service CPU, memory, utilization, latency, cost, health status
  • Findings by category — collapsible groups for Security, Resources, Performance, Traffic, Pricing
  • Historical charts — time-series for request count, CPU utilization, latency (P50/P99), instance count
  • Interactive filtering — click any service row to filter all charts
  • Snapshot comparison — delta banner showing changes since last analysis

Finding Categories

Category What it checks
Security Plaintext secrets in env vars, default service accounts, public ingress, IAM policies, VPC connectors
Resources CPU/memory over-provisioning, utilization rates, min-instance idle costs
Performance Cold start risk, concurrency settings, latency percentiles, error rates
Traffic Request volume patterns, scaling behavior, billable instance time, traffic splits
Pricing Cost breakdown (CPU, memory, requests, idle), optimization opportunities

Severity Levels

  • Critical — security risks or significant waste requiring immediate action
  • Warning — optimization opportunities or potential issues
  • Info — informational findings, architectural observations

How It Works

  1. Discovery — lists all Cloud Run services via gcloud run services list
  2. Configuration — fetches detailed config for each service (CPU, memory, scaling, IAM, env vars)
  3. Metrics — queries Cloud Monitoring API for the last 24h (requests, CPU, memory, latency, instances)
  4. Analysis — runs 5 analyzers against config + metrics to produce findings
  5. Dashboard — generates a self-contained HTML file with Chart.js visualizations

No data leaves your machine. All analysis runs locally using your gcloud credentials.

Development

git clone https://github.com/thisisfatih/eng-team
cd eng-team/cloud-architecture/cloud-run-specialist
uv sync

# Run tests
uv run pytest

# Run directly
uv run python -m cloudrun_agent.cli --html

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cloudrun_agent-0.1.0.tar.gz (72.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cloudrun_agent-0.1.0-py3-none-any.whl (44.5 kB view details)

Uploaded Python 3

File details

Details for the file cloudrun_agent-0.1.0.tar.gz.

File metadata

  • Download URL: cloudrun_agent-0.1.0.tar.gz
  • Upload date:
  • Size: 72.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.0

File hashes

Hashes for cloudrun_agent-0.1.0.tar.gz
Algorithm Hash digest
SHA256 6a07cc6b16a511360c1b55d5cff28117ac8534a1b9e2dc6e184c346e19a72bc7
MD5 50bebea7948af588192affa61caa79e0
BLAKE2b-256 40d909077041e491af551a5e8107bf305aaa22ba18e4c21b5ef655bde9c9ba76

See more details on using hashes here.

File details

Details for the file cloudrun_agent-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: cloudrun_agent-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 44.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.0

File hashes

Hashes for cloudrun_agent-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e7de2f70c07ff6af70dfcfac5ebdfca405eeaae8e312eb9e0d22d6a704f1f517
MD5 6a643f6add0801b245a5d013b518e6ba
BLAKE2b-256 fddc817277bc72f69bc7696e9198a6ef09a7ed0480cae2f40f9009f2fb84eaec

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page