PluginWorks in Claude CodeCurrent
Bigquery data analytics
Connect, query, and generate data insights for BigQuery datasets and data.
0
Try it
See what this would do for you. No sign-up needed.
Install in Claude Code
Run these in Claude Code, in order. The first adds the marketplace, the second installs the plugin.
Step 1
/plugin marketplace add anthropics/claude-plugins-official
Step 2
/plugin install bigquery-data-analytics@claude-plugins-official
Review commands before running them. Promptu never runs code on your machine or pushes changes to your repo.
What's inside
2 skills
- bigquery-ai-ml
- bigquery-analytic-hints
1 MCP server
Security scan
Passed
Promptu's text scan of the files it could read didn't match any known risky patterns. It doesn't run the plugin, and a clean scan doesn't mean the plugin is safe.
Automated pattern check of 6 file(s) found nothing risky. Not a full audit.
Details
# BigQuery Data Analytics Skills
> [!NOTE]
> Currently in beta (pre-v1.0), and may see breaking changes until the first stable release (v1.0).
Developers can effortlessly connect, interact, and generate data insights with [BigQuery](https://cloud.google.com/bigquery/docs) datasets and data using natural language commands.
> [!IMPORTANT]
> **We Want Your Feedback!**
> Please share your thoughts with us by filling out our feedback [form][form].
> Your input is invaluable and helps us improve the project for everyone.
[form]: https://docs.google.com/forms/d/e/1FAIpQLSfEGmLR46iipyNTgwTmIDJqzkAwDPXxbocpXpUbHXydiN1RTw/viewform?usp=pp_url&entry.157487=bigquery-data-analytics
## Table of Contents
- [Why Use the BigQuery Data Analytics Extension?](#why-use-the-bigquery-data-analytics-extension)
- [Prerequisites](#prerequisites)
- [Getting Started](#getting-started)
- [Antigravity](#antigravity)
- [Claude Code](#claude-code)
- [Codex](#codex)
- [Installing via a compatible Agent Plugins client](#installing-via-a-compatible-agent-plugins-client)
- [Authenticating via Application Default Credentials (ADC)](#authenticating-via-application-default-credentials-adc)
- [Usage Examples](#usage-examples)
- [Available Tools](#available-tools)
- [Generating Skills Instead](#generating-skills-instead)
- [Additional Extensions](#additional-extensions)
- [Troubleshooting](#troubleshooting)
## Why Use the BigQuery Data Analytics Extension?
* **Natural Language to data analytics :** Find required BigQuery tables and ask analytical questions in natural language.
* **Seamless Workflow:** Stay in your CLI. No need to constantly switch contexts to the GCP console for generating analytical insights.
* **Run advanced analytics :** Generate forecasts, run a contributions analysis using built-in advanced skills.
## Prerequisites
Before you begin, ensure you have the following:
- One of these AI agents installed
- Antigravity
- [Antigravity CLI](https://github.com/google-gemini/gemini-cli) version **v1.6.0** or higher
- [Antigravity 2.0](https://antigravity.google/product/antigravity-2) version **v2.0.0** or higher.
- [Claude Code](https://claude.com/product/claude-code) version **v2.1.94** or higher.
- [Codex](https://developers.openai.com/codex) **v0.117.0** or higher.
- For Claude Code: Enable the **Google Cloud BigQuery** connector (under Claude Settings > Connectors).
- A Google Cloud project with the **BigQuery API** enabled.
- Ensure [Application Default Credentials](https://cloud.google.com/docs/authentication/gcloud) are available in your environment.
- IAM Permissions:
- BigQuery User (`roles/bigquery.user`)
- (Optional) To use BigQuery AI/ML skills
- Ensure that Vertex AI API is enabled
- IAM permissions:
- BigQuery Connection User (`roles/bigquery.connectionUser`)
- Vertex AI User (`roles/aiplatform.user`)
## Getting Started
### Configuration
Please keep these env vars handy during the installation process:
* `BIGQUERY_PROJECT`: The GCP project ID.
* `BIGQUERY_LOCATION`: (Optional) The dataset location.
> [!NOTE]
>
> - Ensure [Application Default Credentials](https://cloud.google.com/docs/authentication/gcloud) are available in your environment.
### Installation & Usage
To start interacting with your database, install the extension for your preferred AI agent, then launch the agent and use natural language to ask questions or perform tasks.
For the latest version, check the [releases page][releases].
[releases]: https://github.com/GoogleCloudPlatform/bigquery-data-analytics-plugin/releases
<!-- {x-release-please-start-version} -->
<details open>
<summary id="antigravity">Antigravity</summary>
You can use either of these two agents for Antigravity:
- [Antigravity CLI](https://github.com/google-gemini/gemini-cli) version **v0.3.0** or higher
- [Antigravity 2.0](https://antigravity.google/product/antigravity-2) version **v0.3.0** or higher.
<blockquote>
💡 <strong>Tip — Migrating from Gemini CLI?</strong><br>
If you previously installed this extension with <code>gemini extensions install</code>, you can convert it to an Antigravity plugin instead of reinstalling from scratch:
<ul>
<li><strong>On first launch of Antigravity CLI</strong>, accept the Migration Options prompt to automatically convert your installed Gemini CLI extensions to Antigravity plugins.</li>
<li><strong>Or, from your terminal</strong>, run:
<pre><code class="language-bash">agy plugin import gemini</code></pre>
</li>
</ul>
See <a href="https://antigravity.google/docs/gcli-migration">Migrating from Gemini CLI</a> for details on plugins, context files (<code>GEMINI.md</code> / <code>AGENTS.md</code>), and MCP server config differences.
</blockquote>
#### Antigravity 2.0 (IDE)
**1. Install the plugin:**
Install the plugin directly from the remote GitHub repository:
```bash
agy plugin install https://github.com/GoogleCloudPlatform/bigquery-data-analytics-plugin
```
**2. Set env vars:**
Set your environment vars as described in the [configuration section](#configuration).
_(Tip: You can verify the MCP server is active by running the `/mcp` command in your active session.)_
#### Antigravity CLI
You can install plugins directly from a remote GitHub repository.
**1. Install the plugin:**
```bash
agy plugin install https://github.com/GoogleCloudPlatform/bigquery-data-analytics-plugin
```
**2. Set env vars:**
Set your environment vars as described in the [configuration section](#configuration).
</details>
<details>
<summary id="claude-code">Claude Code</summary>
**1. Enable the BigQuery Connector:**
Ensure the **Google Cloud BigQuery** connector is connected in Claude (**Settings > Connectors**).
**2. Set env vars:**
In your terminal, set your environment vars as described in the [configuration section](#configuration).
**3. Start the agent:**
```bash
claude
```
**4. Install the plugin:**
```bash
/plugin install bigquery-data-analytics@claude-plugins-official
```
_(Tip: Run `/plugin list` inside Claude Code to verify the plugin is active, or `/reload-plugins` if you just installed it.)_
> 💡 **Authenticating via ADC?** If you prefer to authenticate using local Application Default Credentials (ADC) instead of the connector, configure `"headersHelper": "./scripts/adc-headers.sh"` in `.claude-plugin/plugin.json`. See [Authenticating via ADC](#authenticating-via-application-default-credentials-adc).
</details>
<details>
<summary id="codex">Codex</summary>
**1. Install marketplace:**
```bash
codex plugin marketplace add GoogleCloudPlatform/data-cloud-plugins
```
**2. Install the plugin:**
```bash
codex plugin add bigquery-data-analytics@data-cloud-plugins
```
**3. Set env vars:**
Enter your environment vars as described in the [configuration section](#configuration).
**4. (Optional) Update the marketplace:**
```sh
codex plugin marketplace upgrade data-cloud-plugins
```
</details>
## Installing via a compatible Agent Plugins client
This repository is a valid [Agent Plugins](https://github.com/agentplugins/agent-plugins-spec) (v1) plugin. Any [Agent Plugins–compatible client](https://agent-plugins.org/compatible-clients) can install it directly using its own built-in plugin command — no extra tooling required — by pointing at this repository:
```
https://github.com/GoogleCloudPlatform/bigquery-data-analytics-plugin
```
Beyond harnesses covered by the native install above, compatible clients include VS Code, Cursor, GitHub Copilot, and Kiro. See your agent's documentation for its exact install command.
**Set env vars:**
Set your environment vars as described in the [configuration section](#configuration).
<!-- {x-release-please-end} -->
> [!NOTE]
> * Ensure [Application Default Credentials](https://cloud.google.com/docs/authentication/gcloud) are available in your environment.
> * See [Troubleshooting](#troubleshooting) for debugging your configuration.
## Authenticating via Application Default Credentials (ADC)
If you prefer to authenticate using local Application Default Credentials instead of the BigQuery connector, add the included `headersHelper` script to your `.claude-plugin/plugin.json`:
```json
"mcpServers": {
"bigquery": {
"type": "http",
"url": "https://bigquery.googleapis.com/mcp",
"headersHelper": "./scripts/adc-headers.sh"
}
}
```
Ensure you have authenticated locally:
```bash
gcloud auth application-default login
```
Note for Windows users: Command Prompt and PowerShell cannot execute .sh scripts natively. To use the ADC fallback, you will need to run your agent from a Unix-like terminal such as WSL or Git Bash.
## Usage Examples
Interact with BigQuery using natural language right from your IDE:
* **Find Data:**
* "Find tables related to PyPi downloads"
* "Find tables related to Google analytics data in the dataset bigquery-public-data"
* **Generate Analytics and insights:**
* "Using bigquery-public-data.pypi.file\_downloads show me the top 10 downloaded pypi packages this month."
* “Using bigquery-public-data.pypi.file\_downloads can you forecast downloads for the last four months of 2025 for package urllib3?”
## Available Tools
The tools come from MCP Toolbox's prebuilt `bigquery` server, grouped into toolsets:
- **data** - Use these tools when you need to handle large-scale data exploration and dataset management. Use when users need to find data assets or run SQL at scale. Provides metadata discovery and query execution across the data warehouse.
- **analytics** - Use these tools when you need to handle advanced data intelligence and predictive tasks. Use when a user asks "why" data changed or needs future projections. Provides automated insight generation and time-series forecasting.
For the full, up-to-date list, see the [`bigquery` prebuilt config](https://github.com/googleapis/mcp-toolbox/blob/main/internal/prebuiltconfigs/tools/bigquery.yaml)
in the MCP Toolbox repository.
## Generating Skills Instead
The tool-backed skills this plugin used to ship were generated from the same prebuilt
toolsets. If your agent lacks deferred tool loading, or you prefer skills, regenerate
them with the script in this repository:
```bash
VERSION=<toolbox version> ./.github/scripts/generate_skills.sh
```
Use the toolbox version pinned in [`mcp.json`](./mcp.json). A single toolset, without
the script:
```bash
npx @toolbox-sdk/server@<toolbox version> --prebuilt bigquery skills-generate \
--name "<skill name>" \
--toolset "<toolset>" \
--description "<what it is for>"
```
The generated scripts call the toolbox through `npx`, so no binary download is needed.
See [Generate Agent Skills](https://github.com/googleapis/mcp-toolbox#generate-agent-skills)
in the MCP Toolbox repository.
The hand-authored skills in `skills/` are unaffected and still ship with the plugin.
## Additional Extensions
Find additional extensions to support your entire software development lifecycle at https://github.com/gemini-cli-extensions, including:
* [BigQuery Conversational Analytics](https://github.com/GoogleCloudPlatform/bigquery-conversational-analytics-plugin)
* and more!
## Troubleshooting
Use `gemini --debug` to enable debugging.
Common issues:
* **"failed to find default credentials: google: could not find default credentials."**: Ensure [Application Default Credentials](https://cloud.google.com/docs/authentication/external/set-up-adc) are available in your environment. See [Set up Application Default Credentials](https://cloud.google.com/docs/authentication/external/set-up-adc) for more information.
* **"✖ Error during discovery for server: MCP error -32000: Connection closed"**: The database connection has not been established. Ensure your configuration is set via environment variables.
* **"✖ MCP ERROR: Error: spawn /Users/USER/.gemini/extensions/bigquery-data-analytics/toolbox ENOENT"**: The Toolbox binary did not download correctly. Ensure you are using Gemini CLI v0.6.0+.
* **"cannot execute binary file"**: The Toolbox binary did not download correctly. Ensure the correct binary for your OS/Architecture has been downloaded. See [Installing the server](https://mcp-toolbox.dev/documentation/introduction/#install-toolbox) for more information.
## skills/bigquery-ai-ml/SKILL.md
---
name: bigquery-ai-ml
metadata:
version: v1
publisher: google
description: >-
Load this skill before writing any BigQuery SQL. Leverages BigQuery's
built-in statistical, machine learning and GenAI capabilities for advanced data analytics.
Use when you need to write SQL queries that perform time-series forecasting, predict values, detect outliers or anomalies, find key drivers, perform semantic search or vector search, classify text, calculate similarity, summarize content, translate language, evaluate models, filter by semantic conditions, measure the causal effect of an intervention, compute correlations between columns,
generate descriptive statistics and table distribution profiles,
detect change points or structural breaks, extract trend or seasonality components,
or leverage generative AI capabilities in BigQuery. Do not use for table administration, DDL/DML migrations, query performance troubleshooting, or permission checks.
---
# BigQuery AI & ML
BigQuery integrates with Vertex AI to provide powerful machine learning and
generative AI capabilities directly within SQL queries using built-in functions
like `AI.FORECAST`, `AI.KEY_DRIVERS`, `AI.DETECT_ANOMALIES`, and `AI.GENERATE`.
## Function Selection & Reference Directory
Function | Reference | SQL Shape | Requires `CREATE MODEL` or `CREATE VECTOR INDEX`? | When to Use & Disambiguation
:---------------------------- | :-------------------------------------------------------------------- | :------------- | :------------------------------------------------ | :---------------------------
**`AI.AGG`** | [ai_agg.md](references/ai_agg.md) | `Aggregate` | No | Multi-row semantic aggregation with `GROUP BY`; synthesizes 1 summary string across many rows (unlike per-row `AI.GENERATE`).
**`AI.CAUSAL_EFFECT`** | [ai_causal_effect.md](references/ai_causal_effect.md) | `TVF` | No | Quantifies counterfactual post-intervention impact on a time series after a specific treatment timestamp.
**`AI.CLASSIFY`** | [ai_classify.md](references/ai_classify.md) | `Scalar` | No | Semantic classification of text or multimodal unstructured data into predefined category labels.
**`AI.DETECT_ANOMALIES`** | [ai_detect_anomalies.md](references/ai_detect_anomalies.md) | `TVF` | No | Zero-shot **TimesFM** detector for isolated time-series point anomalies/outliers (use `ML.DETECT_CHANGE_POINTS` for sustained regime shifts).
**`AI.EVALUATE`** | [ai_evaluate.md](references/ai_evaluate.md) | `TVF` | No | Zero-shot **TimesFM** time-series forecast evaluation/backtesting against a historical holdout split.
**`AI.FORECAST`** | [ai_forecast.md](references/ai_forecast.md) | `TVF` | No | Zero-shot **TimesFM** time-series forecasting without training a custom model.
**`AI.GENERATE`** | [ai_generate.md](references/ai_generate.md) | `Scalar` | No | Default for per-row LLM text or multimodal structured extraction (`output_schema`); returns `STRUCT`. Prefer over `AI.GENERATE_TABLE`.
**`AI.GENERATE_EMBEDDING`** | [ai_generate_embedding.md](references/ai_generate_embedding.md) | `TVF` | Yes | Batch generates `ARRAY<FLOAT64>` vector embeddings for text or visual content using a remote embedding model.
**`AI.GENERATE_TABLE`** | [ai_generate_table.md](references/ai_generate_table.md) | `TVF` | Yes | Table-valued structured extraction (`FROM` clause); only use instead of `AI.GENERATE` when a remote model + TVF is explicitly needed.
**`AI.IF`** | [ai_if.md](references/ai_if.md) | `Scalar` | No | Evaluates boolean semantic conditions (`BOOL`) on text or multimodal data for `WHERE`/`CASE`/`JOIN` filtering (do not use `AI.GENERATE_TABLE`).
**`AI.KEY_DRIVERS`** | [ai_key_drivers.md](references/ai_key_drivers.md) | `TVF` | No | Default one-step attribution of dimensional segments driving metric changes (`interest_label_col` `TRUE` vs. `FALSE`). Prefer over `CONTRIBUTION_ANALYSIS`.
**`AI.PREDICT`** | [ai_predict.md](references/ai_predict.md) | `TVF` | No | Zero-shot **TabFM** foundation model for tabular classification or regression without training and managing custom models.
**`AI.SCORE`** | [ai_score.md](references/ai_score.md) | `Scalar` | No | Assigns a continuous `FLOAT64` semantic score to text or multimodal data for ranking or sorting (`ORDER BY`).
**`AI.SEARCH`** | [ai_search.md](references/ai_search.md) | `TVF` | No | Simplified semantic search using a raw string query on tables with autonomous background embeddings (`AI.EMBED` generated column).
**`AI.SIMILARITY`** | [ai_similarity.md](references/ai_similarity.md) | `Scalar` | No | Computes an on-the-fly semantic similarity score (`FLOAT64`) between two text or multimodal inputs without stored embeddings.
**`Remote Models`** | [remote_models.md](references/remote_models.md) | `CREATE MODEL` | Yes | Creates a Vertex AI `REMOTE WITH CONNECTION DEFAULT` model entity for functions that require one (`AI.GENERATE_TABLE`, `AI.GENERATE_EMBEDDING`, `VECTOR_SEARCH`).
**`CONTRIBUTION_ANALYSIS`** | [ml_contribution_analysis.md](references/ml_contribution_analysis.md) | `CREATE MODEL` | Yes | Model-based driver analysis (`CREATE MODEL ... OPTIONS(MODEL_TYPE='CONTRIBUTION_ANALYSIS')` + `ML.GET_INSIGHTS`). Use `AI.KEY_DRIVERS` unless a `MODEL` entity is required.
**`ML.CORRELATION`** | [ml_correlation.md](references/ml_correlation.md) | `TVF` | No | Calculates statistical correlation coefficients between numeric columns, optionally sliced by dimensions.
**`ML.DESCRIBE_DATA`** | [ml_describe_data.md](references/ml_describe_data.md) | `TVF` | No | Generates descriptive statistics (e.g., count, mean, median, min, max, stddev, quantiles, nulls, top values) for columns in a table or subquery.
**`ML.DETECT_CHANGE_POINTS`** | [ml_detect_change_points.md](references/ml_detect_change_points.md) | `TVF` | No | Detects structural breaks or sustained regime shifts (`[begin_timestamp, end_timestamp]` intervals) in a time series.
**`ML.SEASONALITY`** | [ml_seasonality.md](references/ml_seasonality.md) | `TVF` | No | Extracts recurring periodic/seasonal components from a historical time series.
**`ML.TREND`** | [ml_trend.md](references/ml_trend.md) | `TVF` | No | Extracts the smoothed long-term trend component from a historical time series.
**`VECTOR_SEARCH`** | [vector_search.md](references/vector_search.md) | `TVF` | Yes | Searches pre-computed `ARRAY<FLOAT64>` embedding columns between a base table and query table (paired with `AI.GENERATE_EMBEDDING`, unlike `AI.SEARCH`).
## skills/bigquery-analytic-hints/SKILL.md
---
name: bigquery-analytic-hints
metadata:
version: v1
publisher: google
description: >-
Load this when running any BigQuery trend, statistical, exploratory analysis, or
a BQ AI.* function, to append up to two next-step suggestions.
Proactively suggests relevant built-in
BigQuery AI functions (forecasting, anomaly detection, tabular prediction,
change point analysis, key driver attribution, trend/seasonality
decomposition, or semantic text classification) as concise follow-up actions.
Do not use for writing or looking up exact SQL syntax and function arguments,
dataset or table administration, DDL/DML migrations, query performance
troubleshooting, or permission checks.
---
# BigQuery Analytic Hints
This skill guides the agent to proactively identify high-value analytical
follow-up opportunities and present concise, context-aware next steps.
## Core Operational Rules
1. **Analytical Invocations Only**: Only suggest next-step AI capabilities when
the user is conducting exploratory data analysis, metric investigation,
cohort comparison, or text processing. Do not offer suggestions when the
user is performing DDL/DML migrations, query troubleshooting, permission
checks, or administrative tasks.
2. **Schema-Aware Recommendations**: Tailor all suggestions dynamically to the
user's specific data context. Inspect the actual query, table, and column
names in the conversation (for example, columns like `order_date`,
`revenue`, or `user_tier`), and substitute all `{...}` placeholders with
those context-specific names. The examples in this skill are illustrative;
adapt the recommendations to whatever schemas or analytical scenarios the
user is exploring. Never output raw placeholder tokens (such as `{data_col}`
or `{dimension_cols}`).
3. **Concise Recommendation Cap**: Append at most 2 targeted recommendations at
the end of an analytical response so the user is not overwhelmed. Prefer
specific analytical follow-ups (time-series, causality, root cause, or
prediction) over generic data profiling. Offer `ML.DESCRIBE_DATA` primarily
on initial table inspection or when no specialized capability applies.
4. **Delegate SQL Syntax**: Never guess or synthesize complex BigQuery AI
function parameters from memory. Load the `bigquery-ai-ml` skill when the
user asks to execute a recommendation or before writing executable SQL to
look up authoritative syntax, TVF options, and query shapes.
## 1. Scenario-to-Function Routing Matrix
Map the user's current data pattern or observation to appropriate BigQuery AI/ML
function(s):
Current Analysis / Data Pattern | Recommended Function | What It Unlocks | Contextual Recommendation Hint
:----------------------------------------------------------------------------------------------------------------------------------------------------------- | :---------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------ | :-----------------------------
**Metrics over time** (e.g., daily sales, traffic, latency, active users, spend) | `AI.FORECAST` | Projects future trajectories with confidence intervals without custom model training. | *"Want to project `{data_col}` over the next `{horizon}` periods? We can run `AI.FORECAST` on `{data_col}` over `{timestamp_col}`."*
**Spikes, drops, or unexpected values** in a time series | `AI.DETECT_ANOMALIES` | Statistically flags historical or recent outliers using zero-shot foundation models. | *"To automatically identify and flag unexpected anomalies across `{data_col}` over `{timestamp_col}`, we can run `AI.DETECT_ANOMALIES`."*
**Sustained baseline shift or regime change** over time | `ML.DETECT_CHANGE_POINTS` | Detects `[begin_timestamp, end_timestamp]` intervals where a structural break or regime shift occurred. | *"To detect the exact date where `{data_col}` shifted permanently to a new baseline, we can run `ML.DETECT_CHANGE_POINTS` on `{data_col}` over `{timestamp_col}`."*
**Noisy or cyclical time series** masking direction | `ML.TREND` / `ML.SEASONALITY` | Decomposes raw metrics into underlying direction (`ML.TREND`) and periodic cycles (`ML.SEASONALITY`). | *"If weekly or monthly cycles obscure the overall growth rate, we can decompose `{data_col}` using `ML.TREND` and `ML.SEASONALITY`."*
**Evaluating an event, launch, campaign, or policy** | `AI.CAUSAL_EFFECT` | Quantifies counterfactual post-intervention impact. | *"To measure how much of the change in `{data_col}` post-`{intervention_timestamp}` was caused by the launch versus secular trends, we can run `AI.CAUSAL_EFFECT`."*
**Attributing metric variation across dimensions** | `AI.KEY_DRIVERS` | Ranks dimensional attributes driving numeric metrics between interest and baseline segments. | *"Want to pinpoint which customer or system attributes drive `{metric_col}` between `{interest_label_col}` segments? We can run `AI.KEY_DRIVERS` across `{dimension_cols}`."*
**Exploring numeric correlations across features** | `ML.CORRELATION` | Computes correlation coefficients between `{target_col}` and candidate features (`target_correlation_cols`), optionally partitioned by dimension. | *"We can run `ML.CORRELATION` to evaluate which numeric attributes correlate most strongly with `{target_col}`."*
**Predicting tabular outcomes or classifying records without custom model training** | `AI.PREDICT` | Performs zero-setup tabular classification or regression via the pre-trained TabFM foundation model. | *"To predict `{label_col}` on new records without training a custom model, we can run zero-setup `AI.PREDICT` using TabFM."*
**Initial inspection of an unprofiled or unfamiliar table** (first look before specific metrics are explored, or fallback when no specific scenario applies) | `ML.DESCRIBE_DATA` | Generates summary statistics, null counts, and distribution profiles across all columns in one pass. | *"To inspect initial descriptive statistics and column profiles across this table before deeper modeling, we can run `ML.DESCRIBE_DATA`."*
**Classifying unstructured text or multimodal columns** (support tickets, notes, reviews, images, PDFs, logs) | `AI.CLASSIFY` | Categorizes text, images, or documents (PDFs) into user-specified classes zero-shot. | *"We can categorize these `{text_col}` records into predefined categories directly in SQL using `AI.CLASSIFY`."*
**Ranking or prioritizing text or multimodal records** | `AI.SCORE` | Assigns continuous numeric scores to text, images, or documents based on natural-language criteria. | *"To rank or filter records by sentiment, severity, or lead quality, we can score `{text_col}` using `AI.SCORE`."*
**Semantic condition filtering across text or multimodal data** | `AI.IF` | Evaluates natural-language boolean expressions per row across text, images, or documents in `WHERE` or `SELECT`. | *"To filter rows matching nuanced semantic criteria (e.g., churn risk or escalation requests), we can use `AI.IF` on `{text_col}` in the `WHERE` clause."*
**Aggregating many text rows into group summaries** | `AI.AGG` | Synthesizes themes across multi-row groups inside `GROUP BY`. | *"Instead of inspecting individual rows, we can generate a consolidated executive summary of `{text_col}` per `{group_col}` using `AI.AGG`."*
**Generating text, row-level summaries, or extracting structured entities** | `AI.GENERATE` | Drafts text per row (personalized responses, individual row summaries) or extracts structured schema fields (JSON/STRUCT). | *"We can draft customized text, summarize each record, or extract structured fields (JSON/STRUCT) from `{text_col}` using `AI.GENERATE`."*
**Semantic search, fuzzy-matching, or deduplication across text** | `AI.SEARCH` / `AI.SIMILARITY` | Managed conceptual retrieval (`AI.SEARCH`) or semantic proximity scoring for entity deduplication (`AI.SIMILARITY`). | *"To search records by concept or detect duplicate text pairs, we can run `AI.SEARCH` or evaluate semantic similarity via `AI.SIMILARITY`."*
## 2. Capability Chaining Sequences
When the user has executed an initial BigQuery AI/ML query, recommend a chain of
subsequent capabilities.
### Detailed Chaining Actions
1. **Following `AI.FORECAST`**:
* *Audit outliers*: Recommend `AI.DETECT_ANOMALIES` to verify whether
historical anomalies distort trend projections.
* *Backtest model*: Recommend `AI.EVALUATE` across a holdout window to
quantify MAE, MAPE, or RMSE metrics.
2. **Following `AI.DETECT_ANOMALIES`**:
* *Root cause anomaly*: Recommend `AI.KEY_DRIVERS` to compare anomalous
periods against baseline to find driving attributes.
* *Check regime shifts*: Recommend `ML.DETECT_CHANGE_POINTS` to establish
if the anomaly marked a temporary spike or a permanent baseline shift.
3. **Following `ML.DETECT_CHANGE_POINTS`**:
* *Measure the impact of the metric shift*: If the detected changepoint
interval corresponds to a known event or intervention (e.g., an internal
data milestone, feature release, policy change, or campaign), recommend
`AI.CAUSAL_EFFECT` to quantify its impact.
* *Segment attribution*: If no specific event is identified, recommend
`AI.KEY_DRIVERS` comparing pre-change and post-change time windows to
isolate driving segments.
4. **Following `AI.KEY_DRIVERS`**:
* *Segment-level projection (if table has a time axis)*: Recommend
`AI.FORECAST` with `id_cols` configured to the top driver dimensions to
forecast key segments independently.
* *Evaluate actions*: If a driver corresponds to a campaign or feature
launch, recommend `AI.CAUSAL_EFFECT`.
5. **Following `AI.CLASSIFY`, `AI.SCORE`, or `AI.IF`**:
* *Synthesize themes*: Recommend `AI.AGG` grouped by the assigned category
to generate per-topic takeaways.
## 3. Formatting Next Steps in Agent Responses
Append a dedicated section to analytical responses using this structure:
```markdown
### Recommended Next Steps
- **Project future trends**: Run `AI.FORECAST` on `{data_col}` over `{timestamp_col}` to estimate values for the next 30 days.
- **Diagnose anomalies**: Run `AI.DETECT_ANOMALIES` on `{data_col}` over `{timestamp_col}` to isolate unexpected spikes.
```
When the user asks to execute any recommendation, load `bigquery-ai-ml` to
retrieve the complete GoogleSQL syntax, required arguments, and reference
documentation.

