Kanji
・Cloud engineer / freelance ・Born in 1993 ・From Ehime / Living in Shibuya, Tokyo ・5 years AWS experience Profile details
Table of Contents
spiffe://agents.global.org-*.system.id.goog/resources/...
--functional-type=agent --identity-type=agent-identity --identity-certificate
principal://
actAs
As autonomous AI coding agents (such as Antigravity, Claude Code, OpenCode, and Codex) become integral parts of our day-to-day engineering workflows, we are increasingly entrusting them not just with syntax completion, but with autonomous infrastructure tasks—deploying Cloud Run services, provisioning BigQuery datasets, and executing staging verification runs.
However, during these automation initiatives, the single biggest headache and operational risk I encountered was: “What cloud credentials should we actually grant to an autonomous agent?”
When teams want to get automation moving quickly, they often fall into a dangerous trap: dropping a CI/CD or developer service account key (a static JSON private key file) directly into the agent’s working directory, or attaching a broad service account to the host VM/container running the agent.
I personally stumbled into this exact pitfall during an experimental project. I tasked an autonomous data aggregation agent with spinning up a temporary batch service on Cloud Run and fetching sample telemetry from BigQuery. While the agent succeeded in writing and running the code, during its debugging loop it exhibited dangerous behaviors:
roles/iam.serviceAccountUser
iam.serviceAccounts.actAs
Fortunately, this occurred within an isolated sandbox environment, preventing any real damage. But it taught me an unforgettable lesson: granting traditional static service accounts to an autonomous, trial-and-error AI agent is an unacceptable security hazard.
“Is there a native, zero-trust authentication foundation built specifically for AI agents—one that provides cryptographic isolation, eliminates static keys, and structurally blocks privilege escalation?”
To answer this urgent need, Google Cloud launched the preview release of “Agent Identity” in November 2026.
▲ End-to-end architecture: Autonomous AI agents receive SPIFFE cryptographic IDs, 24h auto-rotated X.509 certificates, and DPoP-bound tokens, enforced by Agent Gateway and IAM (principal://) least-privilege policies.
Released as part of the broader Gemini Enterprise Agent Platform ecosystem, Agent Identity re-engineers workload identity from the ground up.
Its core philosophy is distinct: AI agents are treated neither as human users nor as static machines, but as first-class, dynamic autonomous principals.
spiffe://agents.global.org-{ORG_ID}.system.id.goog/resources/run/projects/{PROJECT_NUMBER}/locations/{REGION}/services/{SERVICE_NAME}
spiffe://agents.global.org-{ORG_ID}.system.id.goog/resources/aiplatform/projects/{PROJECT_NUMBER}/locations/{REGION}/reasoningEngines/{AGENT_ID}
iam.serviceAccounts.getAccessToken
Here is my verification log from our remote testbed (Google Cloud SDK 594.0.0), deploying an autonomous agent runner to Cloud Run with Agent Identity and configuring principal:// least-privilege IAM bindings.
▲ Deploying a Cloud Run service with --functional-type=agent --identity-type=agent-identity --identity-certificate and binding scoped BigQuery IAM roles via principal:// (sensitive project IDs and emails masked).
In Google Cloud CLI ( gcloud beta run deploy ), three key flags govern Agent Identity and Agent Registry integration:
gcloud beta run deploy
--functional-type=agent
mcp-server
agent
--identity-type=agent-identity
service-account
--identity-certificate
# Deploy autonomous agent to Cloud Run with automatic Agent Registry registration gcloud beta run deploy data-analyst-agent-01 \ --image="asia-northeast1-docker.pkg.dev/${PROJECT_ID}/agent-repo/runner:v1.2" \ --region="asia-northeast1" \ --functional-type=agent \ --identity-type=agent-identity \ --identity-certificate \ --no-allow-unauthenticated \ --project="${PROJECT_ID}"
Upon deployment, Google Cloud automatically provisions the SPIFFE identity and 24-hour auto-rotating X.509 certificate without requiring manual identity pre-creation. The in-container metadata server ( http://metadata.google.internal/computeMetadata/v1/ ) immediately supplies DPoP-bound credentials.
http://metadata.google.internal/computeMetadata/v1/
During testing, I hit a major stumbling block when attempting to grant BigQuery permissions to the newly deployed agent.
If you treat the agent like a traditional service account and use the serviceAccount: prefix—or if you pass the spiffe:// URI directly to --member —the command fails immediately:
serviceAccount:
spiffe://
--member
# Incorrect command (fails: serviceAccount: prefix is rejected) gcloud projects add-iam-policy-binding "${PROJECT_ID}" \ --member="serviceAccount:data-analyst-agent-01@${PROJECT_ID}.iam.gserviceaccount.com" \ --role="roles/bigquery.dataViewer"
Error message:
ERROR: (gcloud.projects.add-iam-policy-binding) INVALID_ARGUMENT: The principal 'serviceAccount:data-analyst-agent-01@...' is not a valid service account.
Because Agent Identity is a first-class principal on Google Cloud’s unified Workload Identity foundation, you must replace spiffe:// with the principal:// URI scheme:
# Correct command (succeeds: principal:// URI scheme with IAM Condition) ORG_ID="YOUR_ORG_ID" PROJECT_NUMBER=$(gcloud projects describe "${PROJECT_ID}" --format="value(projectNumber)") AGENT_PRINCIPAL="principal://agents.global.org-${ORG_ID}.system.id.goog/resources/run/projects/${PROJECT_NUMBER}/locations/asia-northeast1/services/data-analyst-agent-01" # Grant BigQuery Data Viewer scoped to a specific dataset via IAM Condition gcloud projects add-iam-policy-binding "${PROJECT_ID}" \ --member="${AGENT_PRINCIPAL}" \ --role="roles/bigquery.dataViewer" \ --condition="expression=resource.name.startsWith('projects/${PROJECT_ID}/datasets/analytics_reporting'),title=RestrictToAnalyticsDataset" # Grant BigQuery Job User privilege gcloud projects add-iam-policy-binding "${PROJECT_ID}" \ --member="${AGENT_PRINCIPAL}" \ --role="roles/bigquery.jobUser"
Below is the verification output from our remote testbed confirming the CLI flag specifications in Google Cloud SDK 594.0.0, structural blocking of service account impersonation ( generateAccessToken ), and per-agent Cloud Audit Logs attribution:
generateAccessToken
▲ Remote verification (Google Cloud SDK 594.0.0): inspecting immutable functional-type flags, verifying 403 PERMISSION_DENIED on service account impersonation attempts, and confirming DPOP_AND_X509_MTLS audit log records.
As shown in TEST 2, even if an agent attempts to call iamcredentials.googleapis.com to impersonate a privileged service account, the platform rejects the call with AGENT_IDENTITY_IMPERSONATION_BLOCKED (HTTP 403). Furthermore, the measured P50 latency overhead of DPoP signature verification is just +4.2 ms , delivering zero-trust security with negligible runtime impact.
iamcredentials.googleapis.com
AGENT_IDENTITY_IMPERSONATION_BLOCKED
+4.2 ms
Here is the complete sequence flow illustrating how an autonomous agent obtains its certificate-bound DPoP token and safely interacts with Google Cloud APIs through Agent Gateway:
The decisive security advantage here is the combination of Agent Registry and Agent Gateway: even if an LLM hallucination or prompt injection attempts to invoke an unregistered MCP server or exfiltrate data to an unauthorized endpoint, the gateway terminates the connection immediately.
When planning an enterprise adoption of Agent Identity, use this checklist:
--functional-type
agent-{role}-{env}-{id}
.json
principal://agents.global.org-{ORG_ID}.system.id.goog/...
protoPayload.authenticationInfo.principalSubject
principal://agents.global...
PERMISSION_DENIED
Agent Identity solves a longstanding vulnerability in autonomous AI agent architectures.
However, in my own production setups, full-scale enterprise migration remains unverified. As of the November 2026 preview, two practical considerations warrant patience:
hashicorp/google-beta
Handing permissive, static service account keys to autonomous AI agents is an operational gamble that modern cloud architectures cannot afford.
Google Cloud’s “Agent Identity” establishes a zero-trust foundation for the agentic era through SPIFFE cryptographic identity with 24-hour X.509 auto-rotation , dual mTLS and DPoP token replay prevention , and structural blocking of impersonation .
If your team is deploying autonomous coding agents or hosted MCP servers on Cloud Run, GKE, or Vertex AI, I strongly encourage testing --functional-type=agent --identity-type=agent-identity in a sandbox environment today. I will continue tracking its evolution toward General Availability and Terraform parity.
--functional-type=agent --identity-type=agent-identity
Real-time AI quant analysis of earnings reports, corporate filings, and momentum indicators for global equities and Japanese stocks.
Master conversation skills with realistic AI phone training and 5-axis feedback. Includes 16-lesson interactive academy and studio AI portraits.
Effortlessly snap receipts for instant AI itemization. Integrated with LINE for seamless group expense tracking and pain-free settlement.
Interactive AI personas (Fortune Teller, Butler, Bartender) host real-time games, challenges, and conversation starters for unforgettable gatherings.
Unbiased healthcare database featuring zero-additive filters and active ingredient cost performance metrics.