Skip to content

GCP Connector

The GCP connector integrates with Google Cloud Platform using service account credentials, providing 8 live tools and ETL ingestion of cloud resources into the knowledge graph.

Authentication

GCP authentication uses either a service account JSON key or a project ID with Application Default Credentials.

Create a service account in your GCP project and download the JSON key.

json
{
  "name": "Production GCP",
  "source_type": "gcp",
  "config": {
    "service_account_json": {
      "type": "service_account",
      "project_id": "my-project-123",
      "private_key_id": "key-id",
      "private_key": "-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----\n",
      "client_email": "agentcy@my-project-123.iam.gserviceaccount.com",
      "client_id": "123456789",
      "auth_uri": "https://accounts.google.com/o/oauth2/auth",
      "token_uri": "https://oauth2.googleapis.com/token"
    },
    "project_id": "my-project-123"
  }
}
VariableRequiredDescription
service_account_json / GCP_SERVICE_ACCOUNT_JSONYes (or use ADC)Full service account JSON key object
project_id / GCP_PROJECT_IDYesGCP project ID

Application Default Credentials

If Agentcy is running on GCP (GCE, GKE, Cloud Run), you can rely on Application Default Credentials by providing only the project ID:

json
{
  "name": "GCP via ADC",
  "source_type": "gcp",
  "config": {
    "project_id": "my-project-123"
  }
}

Creating a Service Account

  1. Go to IAM & Admin > Service Accounts in the GCP Console
  2. Click Create Service Account
  3. Name it agentcy-connector
  4. Grant the following roles:
    • Viewer (basic read access)
    • Storage Object Viewer (GCS object listing)
    • Kubernetes Engine Viewer (GKE cluster metadata)
    • Compute Viewer (GCE instance metadata)
  5. Click Create Key > JSON and download the key file

TIP

For production use, create a custom role with only the specific permissions Agentcy needs instead of using the broad Viewer role.

Live Tools (8)

ToolDescriptionArguments
gcp_list_instancesList Compute Engine instances with status and metadatazone?, filter?
gcp_get_instanceGet detailed info about a specific GCE instanceinstance, zone
gcp_list_bucketsList Cloud Storage buckets in the projectprefix?
gcp_list_gke_clustersList GKE clusters with status, node count, and versionregion?
gcp_list_cloudsql_instancesList Cloud SQL instances with status and settingsfilter?
gcp_list_service_accountsList service accounts in the projectfilter?
gcp_list_functionsList Cloud Functions with runtime and statusregion?
gcp_list_pubsub_topicsList Pub/Sub topics in the projectfilter?

Example: Agent Using GCP Tools

User: "What GKE clusters are running and how many nodes do they have?"

Agent: Let me check your GKE clusters.
→ Calls gcp_list_gke_clusters()
→ Returns 2 clusters: prod-cluster (3 nodes, v1.28), staging-cluster (1 node, v1.27)
→ Both are in RUNNING state in us-central1
User: "List my Cloud SQL instances"

Agent: I'll pull the Cloud SQL details.
→ Calls gcp_list_cloudsql_instances()
→ Returns instance names, tiers, regions, and status

ETL Ingestion

When you trigger a sync, the GCP connector ingests the following resources into the knowledge graph.

Nodes Created

Node LabelPropertiesGCP Service
GCEInstancename, zone, machine_type, status, internal_ip, external_ip, tagsCompute Engine
GCSBucketname, location, storage_class, creation_time, versioning_enabledCloud Storage
GKEClustername, region, status, node_count, master_version, network, subnetworkKubernetes Engine
GKENodePoolname, machine_type, disk_size_gb, node_count, autoscaling_min, autoscaling_maxKubernetes Engine
IAMBindingrole, members, resourceIAM
ServiceAccountemail, display_name, disabled, project_idIAM

Relationships Created

RelationshipFromTo
RUNS_INGCEInstanceZone
HAS_NODE_POOLGKEClusterGKENodePool
HAS_BINDINGIAMBindingServiceAccount
USESGCEInstanceServiceAccount
HOSTSGKEClusterGCEInstance
STORES_INGKEClusterGCSBucket
MEMBER_OFServiceAccountIAMBinding

Graph Queries

cypher
-- Find all GCE instances by zone
MATCH (i:GCEInstance)
RETURN i.zone, count(i) AS instance_count, collect(i.machine_type) AS types
ORDER BY instance_count DESC

-- Find GKE clusters with their node pools and scaling config
MATCH (c:GKECluster)-[:HAS_NODE_POOL]->(np:GKENodePool)
RETURN c.name, c.status, np.name, np.machine_type,
       np.autoscaling_min, np.autoscaling_max

-- Audit service account permissions
MATCH (sa:ServiceAccount)<-[:HAS_BINDING]-(b:IAMBinding)
WHERE sa.email CONTAINS "agentcy"
RETURN sa.email, b.role

Configuration Reference

json
{
  "name": "Production GCP",
  "source_type": "gcp",
  "config": {
    "service_account_json": { "...": "..." },
    "project_id": "my-project-123",
    "regions": ["us-central1", "us-east1"],
    "sync_gce": true,
    "sync_gcs": true,
    "sync_gke": true,
    "sync_iam": true,
    "label_filters": {
      "env": ["production"]
    }
  }
}
FieldTypeDefaultDescription
service_account_jsonobject--Service account JSON key (or use ADC)
project_idstringrequiredGCP project ID
regionsstring[]allRegions to scan for regional resources
sync_gcebooltrueInclude Compute Engine instances
sync_gcsbooltrueInclude Cloud Storage buckets
sync_gkebooltrueInclude GKE clusters and node pools
sync_iambooltrueInclude IAM bindings and service accounts
label_filtersobject--Only ingest resources matching these labels

Troubleshooting

ErrorCauseFix
PERMISSION_DENIEDService account lacks required rolesAdd the Viewer role or required granular permissions
NOT_FOUNDProject ID is incorrect or project does not existVerify the project ID in the GCP Console
INVALID_ARGUMENTMalformed service account key JSONRe-download the key file from the GCP Console
UNAUTHENTICATEDService account key has been revoked or deletedGenerate a new key for the service account
RESOURCE_EXHAUSTEDAPI quota exceededCheck quotas in APIs & Services > Quotas and request increases

Verifying Access

Test your service account from the command line:

bash
# Activate the service account
gcloud auth activate-service-account --key-file=service-account.json

# Verify project access
gcloud projects describe my-project-123

# Test GCE access
gcloud compute instances list --project=my-project-123

# Test GKE access
gcloud container clusters list --project=my-project-123

Built by AgentcyLabs. For in-house deployment or Agentcy Cloud (PaaS) access, visit agentcylabs.com.