gemini-enterprise-cleanup

Audits and deletes Gemini Enterprise agents, OAuth authorizations, and BigQuery Data Agents via REST APIs.

Updated Jul 7, 2026
One-click install
npx skills add https://github.com/ricardolui/gcp-custom-agent-skills --skill gemini-enterprise-cleanup-ricardolui
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: gemini-enterprise-cleanup
Source: https://github.com/ricardolui/gcp-custom-agent-skills/tree/main/gemini-enterprise-cleanup
Command: npx skills add https://github.com/ricardolui/gcp-custom-agent-skills --skill gemini-enterprise-cleanup-ricardolui

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires requests, google-auth, and includes scripts (resource) components.

What problem does it solve? Orphaned conversational agents, OAuth/A2A authorizations, and BigQuery Data Agents accumulate across GCP projects and are tedious to track down and remove manually through multiple APIs and regions. This Skill provides a guided, safety-first workflow to scan, audit, and delete these resources with dry-run previews and interactive confirmation. ## Core Features & Use Cases - Multi-API Resource Discovery: Lists custom agents in Discovery Engine (Gemini Enterprise), OAuth/A2A authorizations, and BigQuery Conversational Analytics Data Agents across multiple regions. - Safe Deletion Protocol: Enforces dry-run scanning, explicit user confirmation, and correct deletion ordering (agents before authorizations) while preserving managed system agents like deep_research. - Quota and Error Handling: Automatically injects the X-Goog-User-Project header to avoid 403 USER_PROJECT_DENIED errors and supports non-interactive automation via a --yes flag. - Use Case: After a proof-of-concept, a cloud engineer needs to clean up test agents spread across two GCP projects and several regions; running the script with --dry-run lists everything, then a confirmed run deletes it all. ## Quick Start Ask the assistant to scan and clean up Gemini Enterprise agents and BigQuery Data Agents in your GCP projects, starting with a dry-run before confirming deletion.

Frequently Asked Questions about gemini-enterprise-cleanup

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I delete Gemini Enterprise agents in a GCP project?

Run the cleanup script with your project IDs to list custom agents via the Discovery Engine API, then confirm deletion. It sends DELETE requests to the agents endpoint and automatically skips managed system agents like deep_research.

How to clean up BigQuery Conversational Analytics Data Agents?

The script scans the Gemini Data Analytics API across regions such as global, us, us-central1, southamerica-east1, and europe-west1, lists all Data Agents, and deletes them after confirmation. Use --dry-run first to preview what will be removed.

Why do I get 403 USER_PROJECT_DENIED on the Discovery Engine API?

This error occurs when calls to discoveryengine.googleapis.com lack a quota project. The script fixes it by injecting the X-Goog-User-Project header with your project ID on every Discovery Engine request.

Why does deleting an OAuth authorization fail with FAILED_PRECONDITION?

An authorization cannot be deleted while still referenced by an agent. Delete the Discovery Engine agents first, then delete the authorizations; the script already performs deletions in this order.

Can I run the cleanup script without interactive confirmation?

Yes, pass the --yes or -y flag to skip the confirmation prompt for automation pipelines. It is recommended to run with --dry-run first so you can review the resources targeted for deletion.