Data

AI agent for BigQuery: marketing spend and first-party revenue analysis

TL;DR

The agent reads from BigQuery — running SQL it writes itself from a plain-language question — so you can join Google Ads or DV360 spend with your own Google Analytics, CRM or revenue tables and compute estimated ROAS from numbers you trust, not platform-reported conversions. Reads are ungated: the agent queries whatever project and dataset you select in the context picker. One approval-gated write tool exists (mutate_query) for a CREATE / INSERT / UPDATE / DELETE you explicitly approve after seeing the SQL; it is not exposed over MCP or to the autonomous loop.

Availability
Available
Connection method
Provider sign-in (OAuth)

How can an AI agent use BigQuery for marketing analysis?

Agent Planners can query authorized BigQuery tables to reconcile campaign spend with first-party revenue. Specify the datasets, time zone, refund treatment and campaign join keys. Ask for unmatched rows before calculating return on ad spend. The result depends on the data and attribution rules you supply.

Connect BigQuery and check permissions

  1. 1Open Integrations and click Connect on the BigQuery card.
  2. 2Sign in with a Google account that can read the project.
  3. 3Name the dataset in your goal; the agent writes its own SQL against it.
The authorization asks for bigquery.readonly plus two project-listing scopes. Read-only by construction: there is no scope here that could write a table. A first goal worth typing: Join last quarter of ad cost with my orders table and give me estimated ROAS per campaign, with unmatched orders shown separately, refunds netted out.

What the agent does with BigQuery

  • Writes and runs SQL against your chosen project/dataset from a plain-language question.
  • Joins ad-platform cost data (Google Ads, DV360) with your own Google Analytics, CRM or order tables for true, margin-aware ROAS.
  • Hands off to the Python sandbox for anything SQL can't express cleanly — cohort/LTV math, custom charts.

Example tasks for BigQuery

Goal you'd typeWhat the agent does
"Join last month's Google Ads cost with our Shopify order revenue and give me estimated ROAS per campaign, with unmatched orders shown separately."Writes the SQL join keyed on campaign/date/order id and returns per-campaign profit-aware ROAS.
"What's the 90-day repeat-purchase rate for customers who came from paid search vs. organic?"Queries your CRM/orders tables joined with attribution data and computes the cohort comparison.
"Pull a custom report: spend, impressions and margin by DV360 line item for Q2."Runs the SQL directly against whatever tables hold that data in your warehouse.

Guardrails

  • Reads run ungated. Exactly one write tool exists (mutate_query, for CREATE / INSERT / UPDATE / DELETE), and every real statement pauses for a person, who reads the SQL, in a task and over MCP (unless an admin set that API key to apply such changes, or the connection is the workspace's own app); dryRun:true validates and sends nothing. Autonomous runs do not have this tool.
  • Scoped to the project/dataset you select in the context picker; it doesn't discover or query tables outside that scope.

Frequently asked questions

Can the agent write to my BigQuery tables?
Only through one approval-gated tool. Reads run freely; a CREATE / INSERT / UPDATE / DELETE (mutate_query) is drafted, shown to you with the exact SQL, and runs only after you approve it, over MCP too. Autonomous runs do not have this tool. The standard connection is read-only (BigQuery's read-only scope); the full BigQuery scope that an approved write needs is a separate upgrade you choose, and without it a write cannot run.
Do I need to know SQL to use this?
No — describe the question in plain language and the agent writes the SQL. If you already know exactly what query you want, you can also just ask for that directly.
How is this different from just trusting Google Ads' reported conversions?
Platform-reported conversions use the platform's own attribution and can miss refunds or offline revenue. Joining spend with your own warehouse data gives you a ROAS number built from what actually happened.

BigQuery tools the agent can use

The tool catalog lists 5 read tools and 1 write tool for BigQuery — the same names MCP clients, the REST API and the in-app agent call. Read and write support for the operations listed.

This is every BigQuery tool in the catalog. See every tool for BigQuery (6) or browse the complete tool catalog.

Read (5 of 5)

  • Readbigquery__run_query

    Run query

  • Readbigquery__run_query_paged

    FOR LARGE RESULT SETS — walks the result in bounded pages instead of materialising it.

  • Readbigquery__list_datasets

    List datasets

  • Readbigquery__get_table_schema

    FREE (no scan — tables.get metadata).

  • Readbigquery__preview_table_rows

    FREE (tabledata.list — ZERO bytes billed).

Write (1 of 1)

  • WritePerson approvesbigquery__mutate_query

    Mutate query

Authorized raw requests

bigquery__raw_request takes a request in BigQuery's own format and routes it through the family's own gateway tool, so the same account binding, approvals and refusals apply. It needs the tools:raw scope and is found through search_tools or the REST tool list. It reads only: changes go through the typed tools, which carry the approval rules.

Limitations

  • Permissions: the connected login's role and the permissions it granted decide what each tool can read or change. A tool the login cannot use answers with what is missing; it never works around it.
  • Approvals: in the app, changes wait for approval unless the task runs with auto-approve. Over MCP and REST they follow the credential's setting (an API key applies ordinary changes at once unless it is set to require approval; a third-party OAuth connection waits). 1 write is marked “Person approves”: it waits for a person on every lane — only the workspace's own OAuth app and an API key an admin set to apply changes you can't take back skip that wait. Forbidden Rules can block any of them.
  • Operations the platform's API does not offer, and operations not in the catalog, are not available through these tools.

At most 40 tools are listed on this page. Read more about how changes are approved.

Check access to BigQuery

Use the setup guide to check account eligibility, permissions and available operations. 4,400 one-time free credits and plan details.

Related platforms

How the agent works