Gemini Enterprise Demo Generator
The Gemini Enterprise Demo Generator is a low-code web application built on Google Apps Script (GAS) that instantly synthesizes fully functional, domain-specific custom demo environments for Gemini Enterprise. By inputting your client's unique business challenges, the tool dynamically provis
Content
Gemini Enterprise Demo Generator
Disclaimer: This is not an officially supported Google product. This open-source solution is intended to enhance the Google customer experience. Support and/or new releases are handled on a best-effort basis.
What is the Gemini Enterprise Demo Generator?
The Gemini Enterprise Demo Generator is a low-code web application built on Google Apps Script (GAS) that instantly synthesizes fully functional, domain-specific custom demo environments for Gemini Enterprise. By inputting your client's unique business challenges, the tool dynamically provisions datasets, an AI agent with MCP toolsets, and a real-time operations dashboard — all tailored to their business workflow.
💡 Business Value
- Hyper-Fast Pre-Sales: Prepare hyper-personalized demonstrations within minutes instead of weeks.
- Reality-Grounded Demos: The tool provisions actual BigQuery analytics, Google Maps grounding, and Firestore persistence databases for a raw, living demo experience.
⚙️ Technical Features
- Triple-Agent Autonomous Architecture: Features a multi-agent execution framework powered by Gemini 3.8 Flash by default. Consists of a coordinator (
root_agent) for chat, simple retrieval, and A2UI card rendering; an analytical sub-agent (deep_analysis_agent) for complex inline calculations; and a standalone background worker (background_agent) run asynchronously for long-running background tasks and recurring cron scheduled tasks. Models are configurable via--model-analysis-agentand--model-root-agentCLI flags. - Autonomous Workflow Pipelines & Guardrails: Incorporates advanced background pipelines for both workflow-based operations (
SCAN -> ANALYZE -> PLAN -> EXECUTE -> VERIFY -> REPORTwith human-in-the-loop escalations) and deep analytical tasks. All background tasks are protected by an Anti-Shallow Guard self-check to ensure rigorous statistical results and extensive data tool coverage. - MCP Server Catalog: A curated catalog of pre-configured MCP servers (Government & Legal, Finance, Social, Japan-Specific, Environment & Weather, Google Official) with one-click add, recipe bundles, and custom URL import.
- A2UI v0.9 + Material Catalog: Streams interactive dashboards, data tables, Vega-Lite charts, side-panel canvases, and confirmation cards using the A2UI SDK (
a2ui-agent-sdk) on A2UI v0.9 with the Gemini Enterprise composite catalog (Material*components plusCanvas,VegaChart,GcbpTable), delivered via<a2ui-json>tags in model responses. Integrates rich Welcome Card onboarding and step-by-step Workflow Execution Plan patterns. - A2A Protocol Server: The synthesized agent runs as a FastAPI-based A2A server on Cloud Run, compatible with Gemini Enterprise agent registration, and features a standalone
/execute_taskworker for background processing. - Real-Time Persistence Layer: The agent modifies Firestore via MCP, and a synthesized Data Viewer dashboard (Flask on Cloud Run Functions Gen2) watches Firestore collections and updates in real-time.
- Automated Cloud Run Deployment: Containerized deployment to Cloud Run (with
--min-instances 0to control standby costs) and automated Discovery Engine registration for Gemini Enterprise compatibility. - Custom & Managed MCP Import: Import third-party MCP servers from GitHub (bridged via
supergatewaystdio→StreamableHTTP), pick a managed remote server from the catalog (Slack, Notion), or paste any remote MCP URL (https://mcp.yourservice.com/mcp). The generator probes the endpoint, detects its auth mode from RFC 9728 / RFC 8414 metadata, and — where the server supports dynamic client registration (RFC 7591) — registers an OAuth client and runs the PKCE authorization for you, with no app to create by hand. - Image Generation: Built-in
generate_imagetool produces professional infographics and business summary visuals viagemini-3.1-flash-image-preview. - Interactive Dashboards: The agent can dynamically author and publish complete, interactive HTML dashboards (featuring responsive sorting tables, search filtering, Chart.js graphs, light/dark themes, and pure-JS tabs) via the
publish_dashboardtool, hosted securely on Cloud Storage via signed URLs. - Context Caching:
ContextCacheConfigaggressively caches system instructions and A2UI schemas to reduce time-to-first-token. - Google Workspace MCP: Optional integration with Gmail, Drive, Calendar, and People MCP servers via OAuth token passthrough.
- Managed Autonomous Agent (Antigravity): Optionally provisions a Pre-GA Managed Agents API agent (Antigravity harness) the demo agent can delegate long-horizon autonomous tasks to — live web research, code execution in a cloud sandbox, and professional deliverables (presentation decks, documents, PDFs, and web reports) crafted with mounted SKILL.md packs, with live progress streamed into the chat. Enabled by default; provisioning adds ~10 minutes (hidden behind the rest of the setup) and requires only the Vertex AI Agent Platform API — no allowlist.
- Workspace Authorization (No MCP): A lightweight alternative to Workspace MCP that adds Google sign-in for the demo user without any Developer-Preview allowlist. Combined with the Managed Agent, deliverables are saved to the user's Drive as native Google Slides / Docs / Sheets, and the autonomous agent acts on Gmail / Chat / Calendar via the open-source Workspace CLI (gws) inside its sandbox.
- Customer Domain Research: Gemini-powered company research via Google Search grounding — automatically identifies business challenges and agent-automatable workflows from a customer's domain. The output language is detected from the company itself, or you can pick one from the selector next to the domain box; Other language... takes any language you type.
- Target Persona Selector: Pick the demo's primary user (or describe a custom role) in the wizard — the selected persona becomes the protagonist of the generated scenario, demo guide, and agent instruction, keeping every step framed around that role's real workflow.
- Cross-Department Scenario Fabric: Generated demos model realistic organizational hand-offs — records carry
current_department/next_departmentfields plus an append-only audit-trail history, the agent narrates department-boundary transitions, and the Data Viewer surfaces the process stage as a badge. Quantitative grounding derived from domain research keeps the synthetic numbers business-plausible, and a coverage self-check warns when the demo guide fails to showcase a requested capability. Disable everything at once with theDISABLE_CROSSORG_PACKScript Property. - Model Transparency: Real-time model name announcement in the streaming response accordion for runtime visibility.
- Premium Live Architecture Dashboard: Displays a high-fidelity interactive target architecture diagram SVG during the synthesis step with active pulsing and success glowing states across BigQuery, Gemini Agent, and Cloud Run nodes. Features an animated Dynamic Tips Carousel rotating every 12 seconds, a real-time Elapsed Timer, and an Automatic Retry Mechanism (up to 2 retries) for Apps Script generation robustness.
---
Table of Contents
- [What is the Gemini Enterprise Demo Generator?](#what-is-the-gemini-enterprise-demo-generator)
- [1. Prerequisites](#1-prerequisites)
- [2. Repository Setup](#2-repository-setup)
- [3. Apps Script Project Setup](#3-apps-script-project-setup)
- [4. Deploying Code to Apps Script](#4-deploying-code-to-apps-script)
- [5. Google Cloud Project Setup](#5-google-cloud-project-setup)
- [6. Prepare the Usage Log Spreadsheet](#6-prepare-the-usage-log-spreadsheet)
- [7. Script Properties (Zero Hardcoding)](#7-script-properties-zero-hardcoding)
- [8. Manual API Authorization (Required Once)](#8-manual-api-authorization-required-once)
- [9. Web App Deployment](#9-web-app-deployment)
- [10. How the Generated Demo Works](#10-how-the-generated-demo-works)
- [11. Project Structure](#11-project-structure)
- [12. Cleanup](#12-cleanup)
- [13. Guided Walkthrough & Tutorial](#13-guided-walkthrough--tutorial)
- [14. System Architecture](#14-system-architecture)
- [15. Agent Skill (Deploy from a Coding Agent)](#15-agent-skill-deploy-from-a-coding-agent)
---
1. Prerequisites
- Node.js installed
- Clasp installed globally (
npm install -g @google/clasp) - A Google Cloud Project with Billing enabled
- The following Google Cloud APIs enabled on your project:
- Vertex AI Agent Platform API (
aiplatform.googleapis.com) - BigQuery API (
bigquery.googleapis.com) - Google Drive API (
drive.googleapis.com) - Sheets API (
sheets.googleapis.com) - Maps Platform APIs (Places, Geocoding, Routes)
---
2. Repository Setup
- Clone the repository and navigate to the project directory:
git clone https://github.com/GoogleCloudPlatform/generative-ai.git
cd generative-ai/search/gemini-enterprise/ge-demo-generator
- Authenticate with Clasp (if not already):
clasp login
---
3. Apps Script Project Setup
- Create a new Google Apps Script project at script.google.com.
- Find the Script ID:
- Open the Apps Script editor → Project Settings (Gear Icon) → IDs → copy the Script ID.
- Create a
.clasp.jsonfile in the project root (search/gemini-enterprise/ge-demo-generator/— do not create this inside theapp/directory):
{"scriptId": "YOUR_SCRIPT_ID", "rootDir": "app"}
Important: Keep your terminal in the project root (search/gemini-enterprise/ge-demo-generator/). Do notcd app. Clasp reads.clasp.jsonfrom the current directory and deploys the contents of theapp/folder specified by"rootDir": "app".
---
4. Deploying Code to Apps Script
Prerequisites
| Prerequisite | How to verify / install | |---|---| | Node.js | node -v — install from nodejs.org if missing | | Clasp CLI | clasp -v — install with npm install -g @google/clasp if missing | | Clasp Login | Run clasp login to authenticate with your Google account (required once) | | .clasp.json | Must exist in the project root with your Script ID (see Step 3 above) |
Push / Pull Commands
With the .clasp.json in place at the project root, verify the tracked files and use standard clasp commands:
# Check tracked files (should list 4 files: appsscript.json, Code.gs, index.html, SetupError.html)
clasp status
# Push local code to the Apps Script project
clasp push
# Pull latest code from the Apps Script project
clasp pull
# Open the Apps Script editor in your browser
clasp open-script
Files Deployed to Apps Script
Since we declared "rootDir": "app" in .clasp.json, only files inside the app/ directory are pushed. The deployed files are:
appsscript.json— Manifest (scopes, services, webapp config)Code.gs— Backend logicindex.html— Frontend SPASetupError.html— Configuration error page
Automating Deployments (deploy.sh)
If you have already created a web app deployment in Apps Script, you can bypass the manual versioning UI steps and automate pushing code and updating your active deployment in one step using the deploy.sh script:
DEPLOYMENT_ID="YOUR_WEB_APP_DEPLOYMENT_ID" bash deploy.sh
This script will:
- Extract the
APP_VERSIONfromapp/Code.gs. - Push your latest local code via Clasp.
- Create a new version in Apps Script described by the version string.
- Update your active web app deployment to point directly to this newly created version.
---
5. Google Cloud Project Setup
5.1 Link Apps Script to Your Google Cloud Project
- In the Apps Script editor, go to Project Settings (Gear Icon).
- Under Google Cloud Platform Project, click Change project.
- Enter your Google Cloud Project Number (not Project ID) and click Set project.
5.2 Enable Advanced Services
The appsscript.json manifest declares two Advanced Services that must be enabled:
| Service | Purpose | |---|---| | BigQuery (v2) | Used to verify public dataset tables during data generation | | Sheets (v4) | Used to insert People Smart Chips in the usage log spreadsheet |
These are already declared in appsscript.json and will be auto-enabled when the script is first authorized.
---
6. Prepare the Usage Log Spreadsheet
- Create a new Google Spreadsheet (or use an existing one).
- Create a sheet named
Usage_Logswith the following header row:
| Timestamp | User Email | User Goal | AI Summary | Dataset ID | MCP Servers | Generation Time (s) | |---|---|---|---|---|---|---|
Note: The headers are automatically synced on each log write by ensureLogSheetHeaders(). You only need to create the sheet — the function will overwrite row 1 with the correct headers.
- Copy the spreadsheet URL — you will set it as the
LOG_SHEET_URLScript Property in the next section.
---
7. Script Properties (Zero Hardcoding)
This codebase contains no hardcoded parameters. All configuration is managed via Script Properties.
A complete setup is two properties: PROJECT_ID and LOG_SHEET_URL. Everything in §7.2 has a working default and should be left unset.
7.1 Mandatory Properties
| Property | Description | |---|---| | PROJECT_ID | Your Google Cloud Project ID (e.g., my-project-123) | | LOG_SHEET_URL | Full URL of the Google Spreadsheet for usage logging. Must contain a sheet named Usage_Logs. |
Important: Both properties are checked at startup. If any are missing, the app displays a SetupError.html page with instructions instead of the main UI.
7.2 Optional Properties
You do not need to set any of these. Every property below has a working default, and leaving it unset is the supported configuration — it is what a normal deployment looks like. Set one only when you specifically want the behaviour it describes, and remove it again once you no longer do.
Tuning — occasionally useful in a normal deployment:
| Property | Default | Description | |---|---|---| | LOCATION | global | Vertex AI Agent Platform API location (e.g., us-central1, global) | | MODEL | gemini-3.8-flash | Gemini model name for data generation | | GITHUB_TOKEN | (unset) | GitHub personal access token used for GitHub API calls when importing custom MCP servers from a repository URL. Only needed for private repos or to avoid unauthenticated rate limits |
Development and administration — for working on this sample, not for running it. If you are deploying the app to give demos, skip these entirely:
| Property | Default | Description | |---|---|---| | TEMPLATE_REPO | this repository | Git clone URL (ending in .git) the generated setup script fetches agent_template/ from at run time — see the note below | | TEMPLATE_REF | main | Branch, tag, or commit SHA of the agent template. A branch/tag is resolved to a concrete commit SHA at script-generation time (each generated script is pinned to that SHA); set a 40-hex SHA to hard-pin | | TEMPLATE_SUBDIR | search/gemini-enterprise/ge-demo-generator/agent_template | Repo path of the template directory | | DISABLE_CROSSORG_PACK | (unset) | Set to 1 to disable every cross-departmental prompt insertion (persona anchor, cross-department scenario fabric, process-state rules) at once — an admin rollback lever, not a user-facing option |
Note: The three TEMPLATE_* properties override the defaults baked into
Code.gs. Setting them lets a deployed app switch template sources (for
example to a fork during development, or to this repository's latest release
commit) without redeploying the Apps Script code.
TEMPLATE_REPO is a git clone URL — the string you would hand to git clone, ending in .git. Browsing to agent_template/ on github.com gives you a different kind of URL: it contains /tree/, it already includes the path that belongs in TEMPLATE_SUBDIR, and git cannot fetch from it. An app configured that way still generates scripts, but they fail with repository ... not found for whoever runs them. A complete, correct set:
TEMPLATE_REPO https://github.com/GoogleCloudPlatform/generative-ai.git
TEMPLATE_REF main
TEMPLATE_SUBDIR search/gemini-enterprise/ge-demo-generator/agent_template
7.3 Setting Properties
Option A: Via Script Editor (Recommended for first-time setup)
- Open the Apps Script editor.
- Find the
initializeProjectfunction. - Run it with your values:
initializeProject('your-project-id', 'https://docs.google.com/spreadsheets/d/xxx/edit');
Option B: Via Project Settings UI
- Open the Apps Script editor.
- Go to Project Settings (Gear Icon).
- Scroll to Script Properties.
- Add each property manually.
---
8. Manual API Authorization (Required Once)
Even with correct scopes in appsscript.json, you must manually authorize the script to access your data.
- In the Apps Script editor, select the
forceAuthorizefunction from the function dropdown. - Click Run (▶️).
- A "Review Permissions" popup will appear. Follow the prompts to authorize access.
- You may need to click "Advanced" → "Go to [project name] (unsafe)" if prompted with an "unverified app" warning.
Note: The forceAuthorize function explicitly triggers authorization for Drive and Spreadsheet scopes by performing a safe read/write test.
---
9. Web App Deployment
- In the Apps Script editor, click Deploy > New Deployment.
- Click the gear icon next to "Select type" and choose Web App.
- Configure:
- Description: e.g.,
Gemini Enterprise Demo Generator v1 - Execute as:
User accessing the web app - Who has access:
Anyone(or restrict as needed)
- Click Deploy.
- Copy the Web App URL — this is the URL your users will visit.
---
10. How the Generated Demo Works
When a user generates a demo through the web UI, the tool:
- Plans & Generates synthetic business data (BigQuery tables, Firestore documents) using Gemini.
- Produces a Setup Script (
setup-demo-xxx.sh) that the user runs in Cloud Shell. - The setup script:
- Creates a BigQuery dataset and loads CSV data
- Provisions Firestore with operational documents
- Deploys a Data Viewer web app (Flask on Cloud Run Functions Gen2)
- Scaffolds an ADK agent project with MCP toolsets, A2UI support, and an A2A FastAPI server exposing a chat agent (
root_agentanddeep_analysis_agentsub-agent) and a background worker (background_agentvia/execute_taskrunner) - Defaults to Gemini 3.8 Flash for all three agents, with support for model override via
--model-analysis-agentand--model-root-agentCLI flags - Automatically builds a container image and deploys the Agent FastAPI server to Cloud Run (with
--min-instances 0to control standby costs). - Provisions IAM bindings and environment configurations automatically.
- Discovers any existing Gemini Enterprise Apps in your project and registers the newly deployed Cloud Run agent automatically.
- When the Managed Agent option is enabled (default), provisions a Managed Agents API agent in two phases (creation is started early and awaited after deployment, hiding the ~8–10 min wait), uploads the deliverable craft skills from the fetched template to the dashboards bucket, and warms up the sandbox environment (pre-installing the deliverable toolchain and the Workspace CLI). The sandbox environment auto-expires after ~7 idle days; the agent re-provisions a fresh one on the next delegation.
For a detailed walkthrough, see [Section 13: Guided Walkthrough & Tutorial](#13-guided-walkthrough--tutorial).
---
11. Project Structure
ge-demo-generator/
├── app/
│ ├── appsscript.json # Apps Script manifest (scopes, services, webapp)
│ ├── Code.gs # Backend: data generation, setup script synthesis
│ ├── index.html # Frontend: SPA with demo wizard UI + MCP catalog
│ ├── SetupError.html # Error page shown when Script Properties are missing
│ └── package.json # NPM script hooks
├── agent_template/ # Static agent runtime files (fetched by the setup
│ ├── adk_agent/ # script at run time from a pinned repo ref):
│ │ └── app/ # agent.py, tools.py, fast_api_app.py,
│ │ └── examples/ # part_converters.py, A2UI example JSONs
│ ├── managed_agent/ # Managed Agent provisioning helpers
│ ├── demo_skills/ # Deliverable craft skills (SKILL.md packs)
│ └── viewer_app/ # Data viewer (main.py + requirements.txt)
├── .clasp.json # (git-ignored) Your Script ID config
├── AGENTS.md # AI agent development guide
├── deploy.sh # Clasp deployment orchestrator script
├── validate_examples.py # Validates agent_template JSON + Python files
├── check_deps.py # Audits the PINNED_DEPS major caps (AGENTS.md 8)
├── skills/ # (Section 15) The same generator as an Agent
│ └── ge-demo-generator/ # Skill, for a coding agent instead of the
│ ├── SKILL.md # web app: the lifecycle it follows,
│ ├── references/ # the reference material it reads, and
│ └── templates/ # its own copy of the files it scaffolds
├── ge-demo-generator-lite/ # (Subproject) Gemini Enterprise Demo Generator
│ # Lite — Workspace demo-data generator for
│ # Gemini Enterprise editions without
│ # custom-agent support
│ ├── appsscript.json
│ ├── Code.gs
│ ├── index.html
│ ├── SetupError.html
│ └── README.md
└── README.md # This file (contains all documentation)
---
12. Cleanup
Generated demos can be fully cleaned up by running the setup script with the --cleanup flag:
bash setup-demo-xxx.sh --cleanup
This removes:
- BigQuery dataset and tables
- Google Maps API key
- Cloud Run services (main agent + Data Viewer)
- Firestore collection documents
- Dashboards Google Cloud Storage (GCS) Bucket (and all uploaded dashboard HTML snapshots)
- Gemini Enterprise agent registration & authorization resource
- Secret Manager secrets (for custom MCP, Slack, and remote MCP OAuth tokens)
- Slack App notification (manual deletion at api.slack.com required)
- Remote MCP notification (dynamically registered OAuth clients cannot be deleted via API; revoke access in the vendor's connected-apps settings)
- Local directories and uv caches
---
13. Guided Walkthrough & Tutorial
Welcome! This tutorial will guide you through the setup and execution of your synthesized Gemini Enterprise agent demo.
13.1 Prerequisites
Before we begin, ensure your Cloud Shell is targeting the correct project:
gcloud config set project {{project-id}}
---
Step 1: Provision & Deploy the Demo Environment
The Demo Generator has synthesized a fully automated setup script for you. This script is responsible for:
- Provisioning the BigQuery dataset and loading synthetic data.
- Initializing the Firestore database with operational configurations.
- Creating the necessary IAM policies and service account roles.
- Building the container image and deploying the FastAPI Agent to Cloud Run in your project.
- Deploying the real-time Data Viewer dashboard to Cloud Run Functions (Gen2).
- Attempting automatic registration of your agent inside Gemini Enterprise.
To run it:
- Go back to the ADK Agent Demo Generator Web UI.
- Under Step 3: Deploy, click the Copy button next to the Setup Script.
- Paste the command into your Cloud Shell terminal window (at the bottom of your screen) and press Enter.
- Confirm when prompted to verify the target Google Cloud project and proceed.
The deployment process will output status messages and logs. Once done, it will print Quick Access Links to your terminal.
---
Step 2: Access the Chat Agent in Gemini Enterprise
If the setup script successfully registered the agent to an existing Gemini Enterprise App, it will print a direct console link:
- Click the Start Chatting in Gemini Enterprise link printed at the end of the script output.
- If manual registration is needed (because no Gemini Enterprise app was pre-configured), see [Step 5: Manual Agent Registration (If Needed)](#step-5-manual-agent-registration-if-needed).
- Open the Preview panel in the Gemini Enterprise console and start interacting with your custom agent!
---
Step 3: Access the Real-Time Data Viewer
If your demo setup includes database operations (like approving incidents or editing records), you can monitor updates in real time using the Data Viewer:
- Locate the Firestore Data Viewer link printed in your terminal (under Quick Access Links).
- Open this link in your browser. It points to a live Flask dashboard running as a Cloud Run Function.
- Keep this tab open alongside your Gemini Enterprise chat window to witness the agent modifying database states in real time!
---
Step 4: Try the Scenarios
Use the Step 4: Run Live Demo section in your Demo Generator Web UI for tailored prompts matching your business domain.
Common Scenarios to Try:
- Analytical queries: "Find all pending safety issues from last week using the BigQuery tool."
- Maps grounding: "Show where the incidents occurred on a map and estimate travel times."
- State modification: "Change the status of incident ID 104 to 'Under Investigation' and log our inspection notes." (Observe the Data Viewer update immediately!)
- Complex workflows: "Assign a nearby inspector to incident 104 and notify them."
---
Step 5: Manual Agent Registration (If Needed)
If the setup script could not find an existing Gemini Enterprise App in your project, it will skip automatic registration. You can register the agent manually in the Google Cloud Console:
- Go to the Gemini Enterprise Console.
- Create or select an App (e.g., an Agent Engine/Discovery Engine app).
- In the left-hand navigation pane, select Agents.
- Click Create Agent / Register Agent.
- Set the Target URL to your Cloud Run FastAPI app endpoint:
https://[YOUR_MAIN_AGENT_SERVICE_URL]/a2a/app*(This URL is listed under Quick Access Links in your terminal).* - Fill in the agent name and description, select standard OAuth credentials if needed, and save.
- Once saved, you can chat with the agent in the Preview panel.
---
13.2 Troubleshooting: Cloud Run Reliability
If your agent occasionally stops responding or feels slow in Cloud Run:
1. Handling "Cold Starts"
Cloud Run may spin down instances after inactivity (cold starts). The first request after a break might take longer as it loads heavy libraries (like pandas or scikit-learn).
- Tip: Sending the same prompt again usually works as the container is then "warm."
- Solution: For scaled usage, consider using a warmer service or reducing the number of heavy dependencies in your
requirements.txt.
2. BigQuery Token Lags
Retrieving fresh auth tokens for BigQuery can sometimes add latency.
- Fix Applied: Our generated
tools.pynow includes stability patches that cache tokens for 30 minutes to ensure smooth tool execution.
3. Execution Timeouts
The default timeout for Cloud Run is 60 seconds. If your agent performs many sequential tool calls, it might hit this limit.
- Optimization: Use
gemini-3.1-pro-previewfor high-speed reasoning, and try to keep tool queries efficient.
4. Cloud Run Deployment Failures (Org Policies)
If the setup fails to provision the Data Viewer application or the main Agent service:
- Cause: Many enterprise Google Cloud Projects restrict unauthenticated endpoints via organization policies (like
constraints/iam.allowedPolicyMemberDomains). - Mitigation: The setup script is designed to print a warning and proceed even if the Data Viewer deployment fails due to ingress policies. The main agent will still be deployed; you can access its logs in the Google Cloud Run console.
5. 403 Permission Denied on Tool Invocation
If sub-agents fail to modify Firestore or pull from BigQuery:
- Action: Ensure the default Cloud Run Compute Service Account (
[PROJECT_NUMBER]-compute@developer.gserviceaccount.com) has been successfully provisioned with the following roles: roles/mcp.toolUserroles/datastore.user(For Firestore)roles/bigquery.dataViewer&roles/bigquery.jobUserroles/aiplatform.user
6. Setup Appears to Hang at "Deploying Main Agent to Cloud Run via Source"
If the deploy step never returns, the container is almost certainly crashing at import and Cloud Run is retrying the startup probe forever — which produces no obvious error in the script output.
- Cause: a dependency changed its module layout in a new release. Every pip requirement is capped at the next major in
PINNED_DEPS(app/Code.gs) precisely to prevent this, but a package can still break within a major. - Detection: the Docker build runs
dep_smoke_test.py, which resolves every third-party module and symbol the generated code imports and fails the build naming the offending one. Check the Cloud Build log forFAIL: dependency import smoke test; theuv pip freezeoutput printed just above it shows the versions actually installed. - Fix: cap the offending package below the breaking release in
PINNED_DEPSand re-run.python3 check_deps.pyshows the current floor / cap / resolved / latest for every requirement. Note that a cap belongs below the last version that is known to *work*, which is not always the newest one the resolver can reach --a2a-sdkis held at<0.4.0for exactly this reason. - Imported MCP servers: cloned MCP server repos install their own dependencies into their own virtualenv inside the image, so a third-party requirement cannot reach the packages the agent imports from — a sidecar may hold
mcp2.x while the agent holds 1.x. If such an install fails, the build stops and prints the reason. It used to succeed quietly and produce an image whose MCP sidecar started but could not serve a tool call.
7. Endless "The agent requires additional authorization" Prompt
If every message comes back with the Gemini Enterprise authorization card, you complete consent, and the very next turn asks again — with no error anywhere in the UI, in Cloud Run, or in the agent logs:
- Cause: Consent only validates the
client_idand the redirect URI, so it succeeds even when the code-to-token exchange that Gemini Enterprise performs afterwards fails. The usual reason is a stored OAuth client secret that no longer matches the client (rotated or deleted). Because every demo in a project shares one OAuth client, this breaks all Workspace-authorization demos at once. - Detection: The setup script now probes the token endpoint with a throwaway code before wiring the credentials into Gemini Enterprise.
invalid_grantmeans the credentials are good (only the fake code was rejected);invalid_clientmeans the secret is stale. - Fix: Add a new secret to the existing OAuth client (the
client_idand redirect URI stay valid) athttps://console.cloud.google.com/auth/clients, then re-run the setup script — it prompts for the new secret, verifies it, stores it as a new Secret Manager version, and refreshes the authorization resource.
8. "Research failed" with a 429 About Search as a Tool
If Customer Domain Research fails with code: 429 and a message about "the maximum number of requests with search as tool you can make per day":
- Cause: the daily Google Search grounding cap is enforced per project, per day. On a project shared with other people, your own request count is irrelevant — the bucket is drained collectively, and it refills at midnight US/Pacific.
- Fix: point the
PROJECT_IDScript Property at a project with its own quota, or wait for the reset. There is no Cloud Quotas entry for this limit to raise. The scenario box still works by hand in the meantime; research is not required to build a demo.
---
13.3 Cleanup
When you are done with the demo, see [Section 12: Cleanup](#12-cleanup) for instructions on removing all provisioned resources.
---
Need Help?
The sections above cover the documentation, the system architecture, and the developer guide. If they do not answer your question, use the table below.
Before you report a failing setup script: the script prints the underlying error immediately _above_ the ❌ summary line. Those lines usually identify the cause on their own, so always include them.
| What you need | Where to go | | --- | --- | | A bug or a question about this sample | Open an issue in this repository. Enter AGENTS.md in the File Name field so the issue is routed to the owner of this sample automatically, and prefix the title with [ge-demo-generator]. | | A Google Cloud product problem (Gemini Enterprise, Cloud Run, BigQuery) | Google Cloud Support. If you have a support contract, this is faster than GitHub. | | An Agent Platform API defect | Google Issue Tracker |
When you open an issue, please include:
- the
Version:line printed at the end of the setup script (for example,v11.45-public) - the agent-template ref the script printed (
📥 Fetching agent template (ref ...)) - the output of
git --version - whether you ran the script in Cloud Shell, which is the supported environment for the setup script
---
14. System Architecture
This document describes the system architecture of the Gemini Enterprise Demo Generator and the synthesized demo environments it produces.
---
14.1 Overview
The Gemini Enterprise Demo Generator is a low-code accelerator built on Google Apps Script that allows Customer Engineers to instantly synthesize fully functional AI agent demo environments for any business domain. It generates domain-specific datasets, an ADK-based agent with MCP toolsets, and a real-time operations dashboard — all provisioned into the user's own Google Cloud project.
The system is divided into two main parts: the Generator Dashboard (the Apps Script web app) and the Synthesized Demo Environment (the Google Cloud resources created by the setup script).
---
14.2 Generator Dashboard (Apps Script)
Frontend (index.html)
A Tailwind-based Single Page Application (~388 KB, ~7,000 lines) that provides:
- Demo Wizard: Step-by-step UI to input business requirements, configure options (row count, table count, public dataset enrichment), and generate the demo.
- Customer Domain Research: Gemini-powered company research via Google Search grounding — automatically identifies business challenges and agent-automatable workflows from a customer's domain. The output language is detected from the company itself, or you can pick one from the selector next to the domain box; Other language... takes any language you type.
- Data Preview: Inline data tables and ER diagrams for the generated datasets.
- Premium Live Synthesis Progress Dashboard: Displays a high-fidelity interactive Google Cloud target architecture blueprint SVG during synthesis. It shows the active pulsing/success glowing states across BigQuery, Gemini Agent, and Cloud Run nodes with flowing SVG stream lines. Includes a context-sensitive animated Dynamic Tips Carousel rotating every 12 seconds, a real-time Elapsed Timer, and an Automatic Retry Mechanism (up to 2 retries) for robust Apps Script code generation and parsing recovery. Exposes active model name (
generatorModel) for transparency. - Setup Script Export: One-click copy of the generated bash setup script for Cloud Shell.
- Demo Guide: Auto-generated demo prompts tailored to the synthesized domain.
- History Sidebar: Personal and community demo history with favorites, restore, and delete functionality. Includes a Community Activity Feed showing real-time usage.
- MCP Server Catalog: A curated catalog of pre-configured MCP servers organized by category (Government & Legal, Finance & Markets, Social & Communication, Japan-Specific, Environment & Weather, Google Official), with one-click add, recipe bundles, and search/filter. Includes both sidecar (GitHub-based) and remote managed servers (e.g., Slack).
- MCP URL Import: Import third-party MCP servers from any GitHub repository via Gemini-powered analysis.
- System Instruction Editor: Edit the agent's business and technical instructions post-generation.
- Onboarding & Feature Notifications: First-run onboarding modal and feature notification system for new capabilities.
- Social Proof & Engagement: Weekly activity badge in the header, all-time usage statistics inline, Community Activity Feed in the right sidebar, and post-generation share link CTA.
Backend (Code.gs)
A monolithic Google Apps Script file (~17.7k lines, ~952 KB) that contains:
| Module | Key Functions | Description | |---|---|---| | Configuration | CONFIG, checkConfiguration | Script Property-driven config; startup validation | | Web App Entry | doGet | Serves index.html or SetupError.html based on config state | | Data Generation | generateDemo, planAndGenerateData, buildPlanningPrompt | Orchestrates the full generation pipeline using Gemini | | Public Dataset Discovery | discoverPublicDataset, verifyAndResolveTable | Uses Google Search grounding to find and verify real BigQuery public datasets | | Data Validation | validateGeneratedData, validateAndRepairValue | Schema-aware validation and auto-repair of generated CSV data | | Setup Script Synthesis | generateSetupScript | Generates the bash setup script: Cloud resource provisioning, a pinned fetch of agent_template/ (static agent code), per-demo config emission (.env, generated_instruction.md, mcp_config.json), Dockerfile assembly, and deployment logic. The template source is pinned via TEMPLATE_REPO / TEMPLATE_REF / TEMPLATE_SUBDIR in CONFIG (Script-Properties overridable); update TEMPLATE_REF to the release commit SHA whenever agent_template/ changes | | History & Persistence | logUsageToSheet, saveToDrive, restoreDemo, getPersonalHistory, getGlobalHistory | Usage logging (Sheets), backup (Drive), and restore | | Usage Statistics | getUsageStats | Aggregated usage data (total/weekly demos, unique users, locations, recent activity feed) from the Usage_Logs sheet | | Favorites & Deletion | toggleFavorite, deleteHistoryItem | Per-user favorites and owner-only history deletion | | Vertex AI Agent Platform Utilities | callVertexAI, callVertexAIWithSearch, executeWithRetry | API calls with retry logic and Google Search grounding | | Customer Domain Research | researchCompanyByDomain, mergeTemplateWithCompanyInfo | Google Search-grounded company research, challenge identification, and workflow discovery | | **MCP Import & Analysis*
Source and license
- Source
- Google Cloud Generative AI
- Original
- GoogleCloudPlatform/generative-ai/search/gemini-enterprise/ge-demo-generator
- License
- Apache-2.0