Google Cloud
Google Cloud gives each agent its own service account, at the level you choose on the projects you choose, and Google’s managed MCP servers to use it through. An agent reads VMs, networks, GKE, Cloud Run, Cloud SQL, Cloud DNS, buckets, metrics and logs as itself; where you allow it, restarts VMs and pods, scales workloads and runs jobs; at the opt-in top level, changes infrastructure.
Crewlet manages those accounts through one provisioner service account you create. No service account key is ever made or downloaded: Crewlet signs in as the provisioner with Workload Identity Federation, using a key of its own whose public half you hand to Google, and issues each agent’s token for an hour at a time, never storing it.
Nothing here receives events from Google Cloud yet; see What is not supported yet.
What agents get
Section titled “What agents get”| An agent on | Can | Cannot |
|---|---|---|
viewer (the default) | Read the project and its allow policy, VMs, disks, networks, firewall rules and load balancers, GKE objects except Secrets, Cloud Run services and jobs, Cloud SQL instances, Cloud DNS zones and records, bucket metadata, metrics and logs, and call Google’s MCP tools | Change anything, or read an object in a bucket, a Secret, an API key or billing |
operator | viewer’s, plus start, stop, reset, suspend and resume VMs, resize managed instance groups, delete and evict pods, scale deployments, stateful sets and replica sets, restart Cloud SQL instances, run and cancel Cloud Run jobs as defined, edit alerting, dashboards and uptime checks, and read and write bucket objects | Change a VM’s metadata, a pod’s spec, a database’s users, passwords or certificates, or any allow policy |
administer (opt-in) | operator’s, plus create, change and delete VMs that run as no service account, disks, images, networks, routes, load balancers, firewall rules and certificates; manage GKE clusters and node pools; manage Cloud SQL fully; manage DNS zones and records; manage buckets and their access | Act as another service account, grant anything on the project, read a Secret or an API key, or touch billing |
Administer can create access that outlives the agent’s token (an SSH key or startup script on a VM, a database user or client certificate, another principal’s access to a bucket or DNS zone), which stays after the agent is turned off. Give it only to an agent you trust with that, and review its Cloud Audit Logs.
Raising an agent to operator or administer asks for a fresh sign-in (step-up). administer is never the default.
Setting it up from the dashboard
Section titled “Setting it up from the dashboard”Open Company › Integrations › Google Cloud.
The identity project
Section titled “The identity project”Crewlet’s service accounts live in a project of their own, the identity project: the provisioner crewlet-provisioner and one account per agent, nothing else.
- A new, empty project, used only for Crewlet. The provisioner holds Service Account Admin there, so any other service account is one it could act as. The block refuses a project that runs workloads or holds an account Crewlet did not make.
- Its ID is all you give Crewlet. The form suggests one; keep it and the block creates the project, or type the ID of an empty project you made on the new project page (Google shows the ID under the name, and it can differ from the name). If an older block ran in a project that already runs something, undo it there.
Connecting Crewlet
Section titled “Connecting Crewlet”The connect form’s Setup steps say the same, step by step, each with where it happens, what shows it worked and what people hit.
One block, run once:
- Open the form. Crewlet makes its ES256 federation key at once, sealed as
GOOGLE_CLOUD_FEDERATION_KEY; its private half never leaves the secret store. The form shows the Cloud Shell block straight away, drawn from the Identity project ID as you type it. - Copy the block with its Copy button, open Cloud Shell, paste it whole and run it. About a minute. Before it changes anything it stops, with one
Crewlet setup stopped: ...line saying what to do, if Cloud Shell has no active account (rungcloud auth login), if the project runs workloads (Firebase, App Engine, Compute Engine, Cloud Run, Cloud Functions or GKE) or if it holds a service account not namedcrewlet-*. Then it:- creates the identity project if it does not exist;
- enables the IAM, IAM Service Account Credentials, Security Token Service, Cloud Resource Manager and Service Usage APIs;
- creates the provisioner if missing, and grants it Service Account Admin, Service Usage Viewer and
crewletApiEnabler, a custom role holdingserviceusage.services.enablealone, so Crewlet turns on a Google product’s APIs itself; - creates the workload identity pool
crewletand its providercrewlet-engineholding Crewlet’s public key (inline, nothing uploaded), or updates the provider’s key if it exists; - lets Crewlet’s subject act as the provisioner (Workload Identity User);
- prints the provider’s full name as its last line:
projects/<project number>/locations/global/workloadIdentityPools/crewlet/providers/crewlet-engine, with the project’s number, not its ID.
- Paste that last line into Workload identity provider, press Test connection, then Save. The form closes, and within about a minute the status goes from Needs attention to Setting up to Connected.
The block follows what you type and needs no save to appear or change. A save made before the provider is pasted keeps what you typed; the setup finishes once the provider is pasted.
Connected gives no agent any access yet. Prepare each project agents should work in, then turn the agents on.
The block is safe to run again. It pins the provider to this company’s subject (crewlet:<company>), so no other identity can use it. A provider holds at most 8 keys; when Crewlet’s key changes, the block updates the provider with update-oidc. Turning on a Google growth product never changes the block.
Prepare a project for Crewlet
Section titled “Prepare a project for Crewlet”Each project an agent may use is prepared once, by somebody who can change its allow policy (an Owner). Paste this into Cloud Shell, with IDENTITY set to your identity project and TARGET to the project:
IDENTITY=example-crewlet-idTARGET=example-prodPROV=crewlet-provisioner@${IDENTITY}.iam.gserviceaccount.comexport CLOUDSDK_CORE_DISABLE_PROMPTS=1
gcloud services enable cloudresourcemanager.googleapis.com --project="$TARGET"
PERMS=cloudsql.instances.restart,compute.instanceGroupManagers.update,compute.instances.reset,compute.instances.resume,compute.instances.start,compute.instances.stop,compute.instances.suspend,container.deployments.updateScale,container.pods.delete,container.pods.evict,container.replicaSets.updateScale,container.statefulSets.updateScaleif gcloud iam roles describe crewletOperator --project="$TARGET" >/dev/null 2>&1; then gcloud iam roles update crewletOperator --project="$TARGET" --permissions="$PERMS"else gcloud iam roles create crewletOperator --project="$TARGET" --title="Crewlet Operator" \ --description="Restart and scale only, for Crewlet agents at the Operator level. Do not add permissions." \ --stage=GA --permissions="$PERMS"fi
cat > crewlet-viewer.yaml <<'YAML'title: Crewlet Viewer roles onlydescription: Crewlet may grant or revoke only the Viewer level's roles.expression: "api.getAttribute('iam.googleapis.com/modifiedGrantsByRole', []).hasOnly(['roles/browser', 'roles/cloudsql.viewer', 'roles/compute.viewer', 'roles/container.viewer', 'roles/dns.reader', 'roles/logging.viewer', 'roles/mcp.toolUser', 'roles/monitoring.viewer', 'roles/run.viewer', 'roles/storage.bucketViewer'])"YAMLcat > crewlet-operator.yaml <<YAMLtitle: Crewlet Operator roles onlydescription: Crewlet may grant or revoke only the Operator level's additional roles.expression: "api.getAttribute('iam.googleapis.com/modifiedGrantsByRole', []).hasOnly(['roles/monitoring.editor', 'roles/run.jobsExecutor', 'roles/storage.objectUser', 'projects/${TARGET}/roles/crewletOperator'])"YAMLcat > crewlet-administer.yaml <<'YAML'title: Crewlet Administer roles onlydescription: Crewlet may grant or revoke only the Administer level's additional roles.expression: "api.getAttribute('iam.googleapis.com/modifiedGrantsByRole', []).hasOnly(['roles/cloudsql.admin', 'roles/compute.instanceAdmin.v1', 'roles/compute.networkAdmin', 'roles/compute.securityAdmin', 'roles/container.clusterAdmin', 'roles/dns.admin', 'roles/storage.admin'])"YAML
for C in viewer operator administer; do gcloud projects add-iam-policy-binding "$TARGET" --member="serviceAccount:$PROV" \ --role=roles/resourcemanager.projectIamAdmin --condition-from-file=crewlet-$C.yaml --format=nonedonefor ROLE in roles/serviceusage.serviceUsageViewer roles/iam.roleViewer; do gcloud projects add-iam-policy-binding "$TARGET" --member="serviceAccount:$PROV" \ --role="$ROLE" --condition=None --format=nonedone
# Optional: the roles Crewlet may grant an agent here beside its level, at most 10.GRANTS="'roles/pubsub.editor', 'roles/cloudscheduler.admin'"if [ -n "$GRANTS" ]; then cat > crewlet-grants.yaml <<YAMLtitle: Crewlet grants listdescription: Crewlet may grant or revoke only these roles, one agent at a time, on request.expression: "api.getAttribute('iam.googleapis.com/modifiedGrantsByRole', []).hasOnly([${GRANTS}])"YAML gcloud projects add-iam-policy-binding "$TARGET" --member="serviceAccount:$PROV" \ --role=roles/resourcemanager.projectIamAdmin --condition-from-file=crewlet-grants.yaml --format=nonefi
# Only where "See more in Atlas" made its account: let it search this project too.ATLAS=crewlet-atlas@${IDENTITY}.iam.gserviceaccount.comif gcloud iam service-accounts describe "$ATLAS" --project="$IDENTITY" >/dev/null 2>&1; then if gcloud iam roles describe crewletAtlasReader --project="$TARGET" >/dev/null 2>&1; then gcloud iam roles update crewletAtlasReader --project="$TARGET" \ --permissions=cloudasset.assets.searchAllResources --format=none else gcloud iam roles create crewletAtlasReader --project="$TARGET" --title="Crewlet Atlas reader" \ --description="Search resources by name and type, for Crewlet's atlas. Do not add permissions." \ --stage=GA --permissions=cloudasset.assets.searchAllResources --format=none fi gcloud projects add-iam-policy-binding "$TARGET" --member="serviceAccount:$ATLAS" \ --role="projects/$TARGET/roles/crewletAtlasReader" --condition=None --format=nonefiWhat this does:
- Creates
crewletOperator, a custom role with exactly the 12 restart and scale permissions above (Google has no predefined Compute or GKE operator role without credential-making permissions; see Roles no level grants). - Gives the provisioner Project IAM Admin three times, each under a condition listing one level’s roles, so it can grant or revoke only those. Google limits such a list to 10 roles, hence one per level.
- Adds Service Usage Viewer (to check the project’s APIs) and Role Viewer (to check
crewletOperatorand the grants list’s roles). - Where
GRANTSnames roles, gives Project IAM Admin a fourth time under the grants list: roles Crewlet may grant one agent on request (granting one more role). Empty for none. - Where See more in Atlas made the
crewlet-atlasaccount, lets it search this project by name and type.
Afterwards:
- The project’s IAM page should show the provisioner with Project IAM Admin three times, each under its “Crewlet … roles only” condition (four with the “Crewlet grants list”), plus Service Usage Viewer and Role Viewer, and nothing else.
- Enable the APIs of the products your agents use; each product’s MCP server is enabled with its API.
Crewlet finds your prepared projects itself. It offers a project once all three conditions are there exactly, crewletOperator holds exactly its 12 permissions, and every role a grants list names is grantable (none can act as another identity, mint or read a credential or key, grant access, run as a workload’s identity or reach billing). A half-prepared project, or one whose grants list names such a role, is named on the card with what to change.
Testing the connection
Section titled “Testing the connection”Test connection checks with reads only, in this order, and a failure lists each part Passed up to the one that Failed, with what to change:
- Google’s Security Token Service accepts Crewlet’s federation token;
- Crewlet can act as the provisioner;
- the identity project’s APIs are on;
- the provisioner holds Service Account Admin and may turn on APIs (
crewletApiEnabler); - each prepared project carries the three conditions and an exact
crewletOperator; - the identity project holds no account but the provisioner’s and Crewlet’s;
- the identity project’s service account count is under its quota.
Turning agents on
Section titled “Turning agents on”Every agent is off until you turn it on. On the integration’s Agents tab, turn On each agent that should use Google Cloud, choose its Access level and Projects (only prepared projects are offered), then press Review changes and Save and sync. Crewlet creates the agent’s service account in the identity project and grants its level on its projects (what each change does).
Undo the Cloud Shell block
Section titled “Undo the Cloud Shell block”The block stops, changing nothing, in a project that runs workloads or holds accounts Crewlet did not make. If an older block ran in the wrong project, or you want to remove Crewlet from its identity project, run this in Cloud Shell as an Owner of that project. Where the block created the project for you, gcloud projects delete "$IDENTITY" removes it all at once instead.
IDENTITY=the-wrong-project-idPROV=crewlet-provisioner@${IDENTITY}.iam.gserviceaccount.com
for ROLE in roles/iam.serviceAccountAdmin roles/serviceusage.serviceUsageViewer \ "projects/$IDENTITY/roles/crewletApiEnabler"; do gcloud projects remove-iam-policy-binding "$IDENTITY" --member="serviceAccount:$PROV" \ --role="$ROLE" --condition=None --format=nonedonegcloud iam roles delete crewletApiEnabler --project="$IDENTITY" --quietgcloud iam service-accounts delete "$PROV" --project="$IDENTITY" --quietgcloud iam workload-identity-pools delete crewlet --project="$IDENTITY" --location=global --quiet
# Only where See more in Atlas was on:ATLAS=crewlet-atlas@${IDENTITY}.iam.gserviceaccount.comgcloud projects remove-iam-policy-binding "$IDENTITY" --member="serviceAccount:$ATLAS" \ --role=roles/serviceusage.serviceUsageConsumer --condition=None --format=nonegcloud iam service-accounts delete "$ATLAS" --project="$IDENTITY" --quietWhat this removes:
- the provisioner,
crewlet-provisioner, and itsroles/iam.serviceAccountAdmin,roles/serviceusage.serviceUsageViewerandcrewletApiEnableron the project, then that custom role; deleting the provisioner also ends Crewlet’sroles/iam.workloadIdentityUseron it; - the workload identity pool
crewletwith its providercrewlet-engine; Google keeps a deleted pool for 30 days, during which its ID cannot be reused in that project; - where See more in Atlas was on,
crewlet-atlasand itsroles/serviceusage.serviceUsageConsumer. On each other project it was granted on, remove its binding toprojects/<that project>/roles/crewletAtlasReaderwithgcloud projects remove-iam-policy-binding, then the role withgcloud iam roles delete crewletAtlasReader --project=<that project>; - where a Google growth product was turned on, Crewlet made the company’s growth reader,
crewlet-gr-..., there: delete it withgcloud iam service-accounts delete.
It leaves the APIs on, as a project already running something may use them: iam.googleapis.com, iamcredentials.googleapis.com, sts.googleapis.com, cloudresourcemanager.googleapis.com and serviceusage.googleapis.com, plus cloudasset.googleapis.com with Atlas and the growth products’ APIs. Disable one with gcloud services disable <api> --project="$IDENTITY" only if nothing else there uses it.
Giving each agent its own Google Cloud account
Section titled “Giving each agent its own Google Cloud account”On the integration’s Agents tab, turn an agent on, choose its level and its projects, and review.
- An agent that is on must have at least one project. An empty list means no project, never every project, so a new company project never silently widens every agent.
- The tab offers the projects you prepared, by name with project ID.
Each agent’s access is a level
Section titled “Each agent’s access is a level”Each level is a fixed set of Google’s roles, granted on each of the agent’s projects. The project’s IAM page shows them under the agent’s account:
| Level | Roles, as the IAM page names them |
|---|---|
viewer | Browser, Cloud SQL Viewer, Compute Viewer, Kubernetes Engine Viewer, DNS Reader, Logs Viewer, MCP Tool User, Monitoring Viewer, Cloud Run Viewer, Storage Bucket Viewer |
operator | Viewer’s roles, plus Monitoring Editor, Cloud Run Jobs Executor, Storage Object User and Crewlet Operator |
administer | Operator’s roles, plus Cloud SQL Admin, Compute Instance Admin (v1), Compute Network Admin, Compute Security Admin, Kubernetes Engine Cluster Admin, DNS Administrator and Storage Admin |
Caveats:
- Cloud Run Viewer reads a service’s configuration, environment variables included. Reference Secret Manager instead of a plain environment variable.
- Storage Object User and Storage Admin read every object in the project’s buckets. Keep Terraform state and exported keys out of the projects agents work on.
- Storage Bucket Viewer is a Beta role at Google.
What each change does at Google Cloud
Section titled “What each change does at Google Cloud”| Change | At Google Cloud |
|---|---|
| Turn on | Creates the agent’s service account in the identity project, lets the provisioner make tokens for that account alone, then grants the level’s roles on each project |
| Change the level | Adds or removes the roles between the two levels on each project. The account and its unique ID stay |
| Change the projects | Grants the level’s roles on an added project, removes them from a dropped one |
| Grant or remove a role | Binds or unbinds that one role on the grant’s projects, one write per role. A level change never removes a role a live grant holds |
| Turn off | Disables the account first, so it stops everywhere at once, then removes its roles from every project. The account and its audit history stay |
| Turn back on | Enables the account and grants its roles again. An account somebody else disabled at Google is never turned back on without being asked |
| Remove (only when off) | Deletes the account. Cloud Audit Logs keep its entries |
Granting one more role
Section titled “Granting one more role”When an agent needs a role no level holds, give it that role alone, beside its level, instead of a higher level:
- On the Agents tab: open the agent’s row, choose Add grant, pick the role, choose its projects (none is the agent’s own projects), and how long: 4 hours, 24 hours, 7 days, or permanent.
- From the agent’s request: when Google refuses a call with
PERMISSION_DENIED, the agent asks withrequest_access, naming the role that holds the permission and why. You answer in your Inbox: Grant for this change (it lapses after the hours shown), Add to this agent permanently, or Not now. Either grant shows the exact grant first, and Grant approves it: the engine saves it and only then tells the agent yes.
What Crewlet does:
- The catalogue is your grants lists. A role can be granted on a project only where that project’s grants list names it (Prepare a project), since the provisioner may change only roles its conditions list. Crewlet reads each listed role’s title and permissions from Google and offers it where any prepared project lists it. A grant naming a project whose list lacks the role is refused, naming the role and the condition to add it to.
- A grant is a plain binding of the role to the agent’s account on its projects, one role per write, so exactly one condition allows each write.
- A grant never outlives its expiry: a pass a minute before it lapses removes the binding; the level stays.
- A role holding any permission that is not a read needs a fresh sign-in, as
operatorandadministerdo.
roles: - handle: sre integrations: google_cloud: enabled: true level: viewer projects: [example-prod] grants: - id: g2h8v4d6s1q permission: roles/pubsub.editor expires_at: 2026-11-15T18:00:00Z granted_at: 2026-11-15T14:00:00Z reason: Create the release topicThe account is the engine’s, and named for the seat
Section titled “The account is the engine’s, and named for the seat”The account’s name:
- Its ID is
crewlet-plus the agent’s handle (cut to 17 characters) plus 4 characters that tell two handles apart; Google limits an ID to 30 characters. - Its display name is
Crewlet <company> <handle>.
The engine acts only on accounts it recorded when it made them, by Google’s unique ID, never adopting by name. An account named like Crewlet’s but unrecorded is reported, never deleted.
Tokens are issued for an hour, never stored
Section titled “Tokens are issued for an hour, never stored”- An agent’s credential is
GOOGLE_CLOUD_ACCESS_TOKEN_<HANDLE>: a token Crewlet makes for the agent’s account by impersonation when a tool needs it, good for one hour. - It lives in the engine’s memory and is renewed before expiry. Nothing is sealed, so nothing rotates.
- An agent that is off is issued nothing, and disabling its account stops an issued token at once.
- Until the account is made and Google has applied the grant, a tool that names the token waits and retries on its own. A refusal after that names what to fix, on the connection or the agent’s row of the Agents tab.
The agent’s Google Cloud tools
Section titled “The agent’s Google Cloud tools”Google’s managed MCP servers are the agent’s tools. Add them from Company › Tools › MCP servers, one instance per agent:
- Cloud Monitoring;
- Cloud Logging;
- Compute Engine;
- Google Kubernetes Engine;
- Cloud Run;
- Cloud SQL;
- Cloud Storage;
- Resource Manager.
Each reads the agent’s own token as a bearer Authorization header. The Agents tab shows the tool as live once one of them is declared for the agent.
The Google Cloud CLI works in the agent’s box too. Crewlet writes the token to .config/crewlet/gcloud-token under the home of every Google Cloud agent’s box, keeps it current while the run lasts, and sets CLOUDSDK_AUTH_ACCESS_TOKEN_FILE to its path in the box and CLOUDSDK_CORE_PROJECT to the agent’s first project. A setting of the same name in the agent’s own sandbox environment wins. The Agents tab lists these as provided by Crewlet. Install the CLI in your box image (Crewlet never downloads binaries); the tool reads live only for a Google Cloud MCP server, since Crewlet cannot see whether the CLI is installed. A token the run prints, gcloud auth print-access-token or the file’s own, is kept in its session redacted, as every known credential shape is (Code Sandbox). The run’s live output shows the commands it runs and a failed call’s first line, never a command’s output, redacted by the same shapes (Security model).
Agents in GKE clusters
Section titled “Agents in GKE clusters”No level lets an agent write Kubernetes objects inside a cluster beyond deleting pods and scaling. This is deliberate. Kubernetes Engine Developer and Admin:
- read every Secret;
- make Kubernetes service account tokens;
- let a workload run as any Kubernetes service account, which through Workload Identity means any Google service account bound to one: acting as another identity.
Administer manages clusters and node pools (Kubernetes Engine Cluster Admin), never the objects in them.
To let one agent do more inside a cluster, bind its account email to a Kubernetes Role yourself, for example:
kubectl create rolebinding sre-agent-edit --role=deployer --namespace=app \ --user=crewlet-sre-a1b2@example-crewlet-id.iam.gserviceaccount.comGoogle applies changes within minutes
Section titled “Google applies changes within minutes”Google’s IAM is eventually consistent: a new account can take a moment before a project accepts a grant to it, a grant can take minutes to apply, and a change can read back stale.
Crewlet waits these out, never reporting a failure. The sync ends as done once its writes are made, and the agent’s tool on the Agents tab says what it waits on:
- “Waiting: Google is still applying the grant”, up to 10 minutes after Crewlet grants access (turning on, raising the level, adding a project), since the first token can take a minute or two;
- “Waiting: Google is still applying the change”, up to 3 minutes after any other change (lowering the level, dropping a project).
Each ends by itself. A sync that cannot see its own write after 3 minutes says so and the next pass retries: for a new account, “Google is still creating the agent’s account”.
Disconnecting
Section titled “Disconnecting”Disconnecting turns every agent off: it disables each account this engine made and removes its roles, and deletes the accounts if you also choose to remove them. The identity project, provisioner, pool and provider are yours and stay; remove the provider’s key if you will not reconnect.
Google’s growth products sign in through this identity
Section titled “Google’s growth products sign in through this identity”The Google page (Company › Integrations › Google) holds what every Google product shares, once: this connection, the company reader, the Google sign-in client, and a switch per product. Turning a product on there is all it takes on Crewlet’s side; each product’s own page keeps its agents, their access and its activity.
Google’s growth products (Google Analytics, Search Console, Google Ads and Google Play) sign in through the identity project this connection sets up. No Google Cloud project needs to be prepared for them, but each needs Google Cloud connected with its provisioning block. The design is ADR-0172.
Each agent gets a second account, its growth identity, used for those products alone:
- Its ID is
crewlet-plus the agent’s handle (cut to 15 characters) plus 6 characters, the name Crewlet gives every agent’s identity at any vendor, and its display name ends ingrowth. - It is never the agent’s Google Cloud account, and its tokens never leave the engine: no agent’s box holds one. You add its email in each product, at the role the agent may act with.
- Crewlet makes it when the agent’s first growth product turns on and turns it off when the last turns off or the agent is removed. It keeps the account, so the roles you gave it return with the agent; delete it in the identity project if the agent will not return. Turning Google Cloud off for an agent leaves it working.
- It is recorded by Google’s unique ID and never adopted by name. If somebody turns it off at Google, Crewlet reports it and leaves it off.
The company reads its figures as its own reader, crewlet-gr- plus the company’s name (cut to 14 characters) plus 4 characters. When a growth product is turned on, Crewlet turns on that product’s APIs in the identity project, makes the reader if it is missing, and lets only this company’s Crewlet act as it; no block is run. You add its email once in each product, at the product’s read role.
A connection made with an earlier block gets one finding, “Run the Cloud Shell block again, once”: that block did not grant crewletApiEnabler. Copy the block from Google Cloud’s settings and run it; turning on another Google product then needs no block.
Products that refuse service accounts sign in with a person’s consent
Section titled “Products that refuse service accounts sign in with a person’s consent”AdSense and AdMob accept no service account, so the company reaches them through one person’s consent, which Crewlet keeps (ADR-0178). AdSense and AdMob connect this way. A product’s sign-in covers reading alone until an agent may change settings; then a person signs in again for both. For each:
- Your own OAuth client, made as below.
- An administrator signs in with Google from the product’s page, at a fresh step-up. Crewlet asks for exactly the scopes the product’s agents need, keeps the grant only if Google granted exactly those, seals the refresh token where no operator view reaches, and renews it on every node. Crewlet needs a public address for this: Google sends the browser back to it, and offers no device sign-in for these products.
- Signing in again replaces the grant and revokes nothing at Google. If Google refuses to renew the sign-in, the product reports
credential_rejectedand Crewlet stops asking Google until somebody signs in again. - Signing out or disconnecting deletes Crewlet’s copy, and revokes the access at Google only when no other product’s sign-in uses a client in the same Cloud project, since Google’s revocation would end that one too. When it does not revoke, the answer says how to remove Crewlet at myaccount.google.com. Separate projects per product make every sign-out a revocation.
The company’s own OAuth client
Section titled “The company’s own OAuth client”AdSense and AdMob sign in as it, and Google Analytics and Google Play use it, optionally, for Add it for me. It is set once, under Google sign-in on the Google page’s Settings tab (Company › Integrations › Google), which shows the values below, and kept at integrations.google_cloud.sign_in_client. A product’s own oauth block, where written, overrides it for that product alone.
- In a Google Cloud project you control, open Google Cloud › Credentials and create an OAuth client ID of type Web application, after turning on the APIs the product’s page names.
- Under Authorized redirect URIs, add
<api.public.external_url>/webhooks/mcp-oauth(<api.external_url>/webhooks/mcp-oauthwithout a public listener), exactly as the form shows it: Google refuses any address not registered exactly. Leave Authorized JavaScript origins empty, since the engine exchanges the code itself. When the address changes, as a temporary tunnel’s can on restart, add the new URI before the next sign-in: each sign-in records the redirect it came back through, so the redirect notice lists every client still signed in through an earlier address, with the new URI to copy, and the product’s form says Redirect URI out of date. Sign-ins already made keep working. With no public address the form says so, and a sign-in is refused. - In Google Auth Platform › Audience, choose Internal if whoever signs in is in the project’s Google Cloud organization. Otherwise choose External and press Publish app (Google’s unverified-app warning is fine for the few people who sign in), or keep it in Testing and add each person who signs in as a test user: Google ends a test user’s sign-in seven days after consent, and a refusal about then says so (Manage App Audience).
- Paste the client’s ID and secret under Google sign-in on the Google page, or write them in
integrations.google_cloud.sign_in_client, the secret as a${VAR}. Optionally, add the project’s ID (project): the client ID carries only the project’s number, and with the ID Ask Crewlet can link that project’s Credentials, Audience and API pages.
Configuration
Section titled “Configuration”integrations: google_cloud: enabled: true provisioning: identity_project: example-crewlet-id provider: projects/123456789012/locations/global/workloadIdentityPools/crewlet/providers/crewlet-engine federation_key: "${GOOGLE_CLOUD_FEDERATION_KEY}" atlas_read: false sign_in_client: # optional: the OAuth client every Google sign-in is made as client_id: "123456789012-abc.apps.googleusercontent.com" client_secret: ${GOOGLE_SIGN_IN_CLIENT_SECRET} project: example-signin # optional: the client's project ID, for links to its pagesroles: - handle: sre integrations: google_cloud: enabled: true level: operator # viewer (the default), operator or administer projects: [example-prod]| Field | Required | Meaning |
|---|---|---|
enabled | yes | Turn the integration on. |
provisioning.identity_project | yes | The identity project’s ID. The provisioner is crewlet-provisioner@<identity_project>.iam.gserviceaccount.com. |
provisioning.provider | to finish | The provider’s full resource name, as the Cloud Shell block prints it. Never needed to save the other fields. |
provisioning.federation_key | yes | Crewlet’s ES256 key, made by the dashboard and sealed as GOOGLE_CLOUD_FEDERATION_KEY. Keep it a ${VAR} reference. |
provisioning.atlas_read | no | Let the atlas search what each project runs, as the account crewlet-atlas (see more in Atlas). Off by default. |
roles[].integrations.google_cloud.enabled | yes | Whether the agent has its own account. Off disables it and removes its roles. |
roles[].integrations.google_cloud.level | no | viewer (the default), operator or administer. |
roles[].integrations.google_cloud.projects | when enabled | The project IDs the agent acts on, each prepared for Crewlet. At least one. |
roles[].integrations.google_cloud.grants | no | Roles its account holds beside its level (granting one more role). Written by the Agents tab and by approving the agent’s request, never typed. |
There is no company-wide project list: Crewlet reads the projects you prepared from the provisioner’s own grants.
Roles no level grants, and why
Section titled “Roles no level grants, and why”No level grants a role that mints or reveals a credential outliving the agent’s own access, acts as another identity, grants on the project, or reads billing:
| Role | Why not |
|---|---|
| Owner, Editor | Basic roles with thousands of permissions, acting as other service accounts among them |
| Viewer (basic) | Reads every API key’s string |
| Project IAM Admin, Security Admin | Grants anything on the project |
| Service Account User, Service Account Token Creator, Service Account Key Admin | Acts as, or makes credentials for, other service accounts |
| Secret Manager Secret Accessor | Reads secret payloads |
| Kubernetes Engine Developer, Kubernetes Engine Admin | Reads Secrets, mints Kubernetes tokens, runs workloads as other identities (see Agents in GKE clusters) |
| Cloud Run Developer, Cloud Run Admin | Runs a job with overridden arguments as the job’s own identity |
| Cloud SQL Editor (below Administer) | Creates client certificates |
| Storage HMAC Key Admin | Makes an HMAC key for any service account |
| Any billing role | No level touches billing |
Each prepared project’s conditions refuse these to the provisioner too, so it cannot grant one even if asked.
What the atlas reads
Section titled “What the atlas reads”The engine reads the company’s projects for its atlas once an hour unless atlas.refresh_interval_seconds says otherwise, as the provisioner through the same federation, with no role beyond the setup blocks’. Every call is a GET; nothing at Google Cloud changes.
| Part | Calls | Role | What the atlas gains |
|---|---|---|---|
| Projects | GET /v3/projects:search, 100 a page | whatever lets the provisioner see the project | each active project as an account, with its id and display name. The identity project is the account the settings already name |
| Services | GET /v1/projects/{id}/services for the enabled ones, once per project | Service Usage Viewer on the project, which the Prepare a project block grants | what the project is used for |
What an enabled API says. Each enabled API is read as one of the atlas’s capabilities, and its own name is never recorded:
| Capability | Enabled API |
|---|---|
compute | Compute Engine, Cloud Run, Kubernetes Engine, Cloud Functions, App Engine, Batch |
database | Cloud SQL, Spanner, Firestore, Memorystore for Redis and for Memcached, AlloyDB, Bigtable |
dns | Cloud DNS |
model_api | Vertex AI, the Gemini API |
ci | Cloud Build, Cloud Deploy |
code_hosting | Cloud Source Repositories, Secure Source Manager |
identity | Identity Platform, Identity-Aware Proxy |
An API not in the table says nothing, including every API a new project has enabled before anybody uses it (Cloud Storage, BigQuery, Datastore, Cloud Logging, Cloud Monitoring).
A project being deleted is not read. Google keeps it thirty days in a non-active state. The atlas leaves it out from the first read after the deletion and retires it a day later.
A refusal is a finding, never a failed read. Where Google refuses a project’s services (the provisioner lacks Service Usage Viewer there, as on a project the Prepare a project block never ran on), the project is still read as an account, the source’s standing counts such projects and names the block, and what an earlier read said they are used for stays. If Google refuses the project listing itself, or does not trust the provisioner at federation or impersonation, the read fails as a rejected credential.
What is never read. A project’s labels, tags, IAM policy, organization and folder. Nothing inside a project is read without See more in Atlas; with it, what each project runs is read by name and type alone.
Cost and limits. A read costs one call per hundred projects and one per active project, plus the two that mint the provisioner’s token hourly. On Google’s rate limit the call waits as long as Google asks (five seconds if no wait is named), up to three times and thirty seconds a wait. Past that, or when a listing fails part way, the read stops and records nothing, and the engine reads again five minutes later. A provisioner that can read more than 1,000 projects is not read: the standing says so, and nothing is retired. A project that two complete reads at least a day apart both miss is retired from the atlas.
See more in Atlas: what each project runs
Section titled “See more in Atlas: what each project runs”See more in Atlas on the connect form (integrations.google_cloud.provisioning.atlas_read, off by default) lets the atlas list what each project runs. It is optional and never changes what an agent can do.
The one step. Turn it on, run the connection’s Cloud Shell block (again, if you ran it before) as an Owner of the projects, and save. The block now also:
- enables the Cloud Asset API in the identity project, and lets the new account use it there (Service Usage Consumer);
- creates the service account
crewlet-atlasin the identity project, if missing; - lets Crewlet’s subject act as it (Workload Identity User), as for the provisioner;
- on every active project where the provisioner holds a role, creates the custom role
crewletAtlasReader, holdingcloudasset.assets.searchAllResourcesand nothing else, and grants it tocrewlet-atlas. A project the person running the block may not change is named and skipped.
Nothing needs pasting back. A project prepared later is covered by the atlas lines of Prepare a project, or by running the identity block again.
Who reads. The engine exchanges its federation token at Google’s Security Token Service and impersonates crewlet-atlas directly, never through the provisioner. Cloud Audit Logs show each search under crewlet-atlas@<identity project>.iam.gserviceaccount.com, never under the provisioner or an agent.
Why not Cloud Asset Viewer. It also lists and exports assets whole, which include a function’s environment variables or an instance’s startup script. crewletAtlasReader holds only the search permission, and the search names its fields and never asks for a resource’s configuration (versionedResources).
| Asset type | Read as | What the atlas gains |
|---|---|---|
| Compute Engine instance | a server | its name, internal and external addresses, and Region |
| Cloud SQL instance | a datastore | its name and Region. Its engine is in its configuration, which is not read |
| Memorystore for Redis instance | a datastore | its name, Region and the engine redis |
| AlloyDB cluster | a datastore | its name, Region and the engine postgres |
| Spanner instance | a datastore | its name and the engine other |
| Cloud Run service, Cloud Run function | a workload running on the project | its name and Region |
| Cloud Storage bucket | a bucket, by its global name | its name and location, and that the project uses object storage |
| Pub/Sub topic | a queue | its name |
Each entry belongs to, or runs on, its project’s account. A resource Google is deleting is left out, and a stopped instance is still a server.
What is never read. No resource’s configuration, labels, tags, description, network tags, keys, environment, metadata or data. Of an instance’s attributes only its two address lists are decoded. Kubernetes Engine clusters, DNS zones and every type outside the table are not read.
A refusal is a finding, never a failed read. A project whose search Google refuses (the role was never granted there) is listed on the atlas’s Sources tab, its earlier record stands, and other projects are read. An unreachable account, or a Cloud Asset API off in the identity project, is one finding naming the block. Any other failure stops the read, changing nothing.
To undo it. Turn the switch off, which stops the searches at once, and delete the account in the identity project:
Its grants stop working with it. The leftover custom role crewletAtlasReader grants nothing; delete it with gcloud iam roles delete crewletAtlasReader --project=PROJECT if wanted. What the atlas recorded stays until a person retires it.
Cost and limits. A search costs one call per project per 500 resources, plus the two that mint the account’s token hourly. Cloud Asset Inventory allows 400 searches a minute per billed project (the identity project); a read waits out the rate limit like any other.
Google Cloud’s limits worth knowing
Section titled “Google Cloud’s limits worth knowing”These are Google’s, not Crewlet’s.
| Limit | Value | What it means |
|---|---|---|
| Service accounts per project | A per-project quota (“Service Account Count”, commonly 100) | The identity project holds the provisioner and one account per agent that is on or off but not removed |
| Service account ID | 6 to 30 characters | Crewlet’s names fit; see The account is the engine’s |
| Roles in one grant condition | 10 | Why each level has its own condition |
| Keys on a workload identity provider | 8 | Reconnecting updates the key in place |
| Token lifetime | 1 hour | Crewlet renews before expiry |
| Rate limits | A 429, with Retry-After on some limits | A read waits as long as Google asks, or 5 seconds where it names no wait, up to 30 seconds and 3 times; a longer wait is left to the next pass. A write is never resent: Google answers a spent quota with the same status |
What is not supported yet
Section titled “What is not supported yet”- Inbound alerts. Cloud Monitoring alerts cannot wake an agent yet.
- Deploys. Deploying a Cloud Run revision, or creating a VM or node pool that runs as a service account, needs Service Account User on that account, which Crewlet never grants. Grant it yourself on one runtime account if an agent should deploy as it.
- Billing. No level reads costs or budgets.
- An engine running on Google Cloud still uses federation with Crewlet’s key, not the attached service account.
Troubleshooting
Section titled “Troubleshooting”| Finding | What it says | What clears it |
|---|---|---|
credential_missing | The identity project is unset, the federation key did not resolve, or the provider is not pasted yet | Run the Cloud Shell block, paste the provider name it prints, and save |
approval_required | “Run the Cloud Shell block again, once”: the provisioner may not turn on APIs, so a Google product’s APIs stay off | Run the current block once |
credential_rejected | Google’s Security Token Service refused Crewlet’s token, or Crewlet cannot act as the provisioner | Run the Cloud Shell block again: it restores the provider’s key and the Workload Identity User binding |
level_unavailable | A project cannot grant a level an agent uses: a condition or crewletOperator is missing or differs | Run Prepare a project for Crewlet again for that project |
grant_excess | The identity project holds service accounts besides the provisioner and Crewlet’s | Move them to another project |
registration_orphaned | The identity project holds accounts named for this company’s agents that Crewlet has no record of | Delete the ones nobody uses |
If a grant is refused with a message about permitted customers or domains, your organization enforces domain restricted sharing (iam.allowedPolicyMemberDomains, on by default for organizations created since May 2024), and it refuses the agent’s service account. Add your organization’s principal set to the constraint’s allowed values, or ask your organization administrator to.
Part of Crewlet. Generated from crewlet/crewlet main at 3f5565e.