gcp_ai_agents
GCP AI Agent Framework
This directory contains the Google Cloud Platform (GCP) AI Agent Framework, designed to enable natural language interaction for managing various GCP services. It allows users to perform common tasks such as creating resources, listing existing configurations, and executing specific operations through intuitive commands.
Getting Started
To use the GCP agent framework, you need to specify --platform gcp when running the main.py script, followed by your command in plain English.
Before running any commands, ensure you have authenticated to GCP. The framework uses google.auth.default(), which typically relies on Application Default Credentials. You can set this up by running:
gcloud auth application-default login
Agents and Commands Implemented
Compute Agent
Manages Google Compute Engine virtual machines.
-
Smart Create Instance:
- Creates a Compute Engine instance with sensible defaults.
- Usage:
python main.py --platform gcp "compute smart-create instance <name> type <machine-type> image-project <project> image-family <family> in <zone>" - Example:
python main.py --platform gcp "compute smart-create instance my-gcp-vm type e2-medium image-project debian-cloud image-family debian-11 in us-central1-a"
-
List Instances:
- Lists all Compute Engine instances in a specified zone.
- Usage:
python main.py --platform gcp "compute list instances in <zone>" - Example:
python main.py --platform gcp "compute list instances in us-central1-a"
-
Start Instance:
- Starts a specified Compute Engine instance.
- Usage:
python main.py --platform gcp "compute start instance <name> in <zone>" - Example:
python main.py --platform gcp "compute start instance my-gcp-vm in us-central1-a"
-
Stop Instance:
- Stops a specified Compute Engine instance.
- Usage:
python main.py --platform gcp "compute stop instance <name> in <zone>" - Example:
python main.py --platform gcp "compute stop instance my-gcp-vm in us-central1-a"
-
Delete Instance (with safety prompt):
- Deletes a specified Compute Engine instance.
- Usage:
python main.py --platform gcp "compute delete instance <name> in <zone>" - Example:
python main.py --platform gcp "compute delete instance my-gcp-vm in us-central1-a"
Storage Agent
Manages Google Cloud Storage buckets.
-
Smart Create Bucket:
- Creates a Cloud Storage bucket with sensible defaults (Standard_LRS, StorageV2, HTTPS only, TLS 1.2, no public blob access).
- Usage:
python main.py --platform gcp "storage smart-create bucket <name> in <location>" - Example:
python main.py --platform gcp "storage smart-create bucket my-unique-gcp-bucket in US"
-
List Buckets:
- Lists all Cloud Storage buckets.
- Usage:
python main.py --platform gcp "storage list buckets" - Example:
python main.py --platform gcp "storage list buckets"
-
Delete Bucket (with safety prompt):
- Deletes a specified Cloud Storage bucket.
- Usage:
python main.py --platform gcp "storage delete bucket <name>" - Example:
python main.py --platform gcp "storage delete bucket my-unique-gcp-bucket"
SQL Agent
Manages Google Cloud SQL databases.
- Smart Create SQL Database:
- Creates an Azure SQL Server (if it doesn't exist) and an Azure SQL Database.
- Usage:
python main.py --platform gcp "sql smart-create instance <name> version <version> tier <tier> in <region>" - Example:
python main.py --platform gcp "sql smart-create instance my-sql-instance version POSTGRES_14 tier db-f1-micro in us-central1"
Functions Agent
Manages Google Cloud Functions.
- Smart Create Function:
- Creates a Cloud Function with sensible defaults (e.g., Python 3.9, HTTP trigger, sample code).
- Usage:
python main.py --platform gcp "functions smart-create function <name> runtime <runtime> trigger-topic <topic-name> in <region>" - Example:
python main.py --platform gcp "functions smart-create function my-http-function runtime python39 in us-central1"
Network Agent
Manages Google Cloud VPC Networks.
- Smart Create Network:
- Creates a VPC network with sensible defaults.
- Usage:
python main.py --platform gcp "network smart-create network <name> [auto-create-subnetworks true/false]" - Example:
python main.py --platform gcp "network smart-create network my-gcp-network auto-create-subnetworks true"
GKE Agent
Manages Google Kubernetes Engine (GKE) clusters, including Anthos enablement.
- Smart Create Cluster:
- Creates a GKE cluster with the specified name, machine type, and number of nodes.
- Configures default OAuth scopes and enables Workload Identity.
- Optionally enables Anthos-related features, making the cluster ready for Anthos registration.
- Usage:
python main.py --platform gcp "gke smart-create cluster <name> in <region> [machine-type <type>] [num-nodes <count>] [anthos-enabled true/false]" - Example:
python main.py --platform gcp "gke smart-create cluster my-gke-cluster in us-central1 machine-type e2-medium num-nodes 2 anthos-enabled true"
BigQuery Agent
Manages Google BigQuery operations.
- Run Query:
- Runs a SQL query in BigQuery and retrieves the results.
- Usage:
python main.py --platform gcp "bigquery run query \"<query-string>\"" - Example:
python main.py --platform gcp "bigquery run query \"SELECT * FROM project.dataset.table LIMIT 10\""
Pub/Sub Agent
Manages Google Cloud Pub/Sub topics.
- Smart Create Topic:
- Creates a Cloud Pub/Sub topic.
- Usage:
python main.py --platform gcp "pubsub smart-create topic <topic-name>" - Example:
python main.py --platform gcp "pubsub smart-create topic my-new-topic"
Vertex AI Agent
Manages Google Cloud Vertex AI Workbench notebook instances.
- Smart Create Notebook Instance:
- Creates a Vertex AI Workbench notebook instance.
- Usage:
python main.py --platform gcp "vertexai smart-create notebook <name> in <location> [machine-type <type>] [image-project <project>] [image-family <family>]" - Example:
python main.py --platform gcp "vertexai smart-create notebook my-ml-notebook in us-central1 machine-type n1-standard-2"
Vision AI Agent
Manages Google Cloud Vision AI operations.
- Analyze Image Labels:
- Detects labels in an image stored in a Cloud Storage bucket.
- Usage:
python main.py --platform gcp "visionai analyze image-labels in bucket <bucket-name> object <object-name> [max-labels <count>]" - Example:
python main.py --platform gcp "visionai analyze image-labels in bucket my-image-bucket object photos/dog.jpg max-labels 5"
Language AI Agent
Manages Google Cloud Natural Language AI operations.
- Analyze Sentiment:
- Detects the sentiment of a given text.
- Usage:
python main.py --platform gcp "languageai analyze sentiment for text \"<text>\"" - Example:
python main.py --platform gcp "languageai analyze sentiment for text \"I love working with GCP!\""
Text-to-Speech Agent
Manages Google Cloud Text-to-Speech operations.
- Synthesize Speech:
- Synthesizes speech from text and saves it to a local file.
- Usage:
python main.py --platform gcp "texttospeech synthesize speech for text \"<text>\" [output-file <file>] [language-code <code>] [gender <gender>]" - Example:
python main.py --platform gcp "texttospeech synthesize speech for text \"Hello, this is a test.\" output-file gcp_output.mp3 language-code en-US gender NEUTRAL"
IAM Agent
Manages Google Cloud IAM resources.
- Smart Create Service Account:
- Creates a service account and attaches a specified role.
- Usage:
python main.py --platform gcp "iam smart-create service-account <id> [display-name \"<name>\"] [role <role-name>]" - Example:
python main.py --platform gcp "iam smart-create service-account my-app-sa display-name \"My Application Service Account\" role roles/viewer"
Security Command Center (SCC) Agent
Manages Google Cloud Security Command Center.
- Smart Enable SCC:
- Conceptually enables Security Command Center for a project.
- Usage:
python main.py --platform gcp "scc smart-enable scc for project <project-id>" - Example:
python main.py --platform gcp "scc smart-enable scc for project my-gcp-project-id"
Cost Management Agent
Provides insights into Google Cloud costs.
- Get Cost Trends:
- Retrieves simulated cost trends for a project.
- Usage:
python main.py --platform gcp "cost-management get cost-trends [for <days> days]" - Example:
python main.py --platform gcp "cost-management get cost-trends for 30 days"