Live
Consolidating State Health Agency Workflows with Gemini Agent SkillsAI agent database load: patterns, pitfalls, and ScyllaDB mitigationsAI agents for healthcare: deployment patterns and operational impact for cloud and DevOps teamsDesigning an Agent‑Ready Platform: Webflow’s Blueprint for Safe AI‑Generated CodeSelf‑service scaling to 5,000 GKE nodes in under five minutesStable Kubernetes Foundations Power AI Agent Workloads on Amazon EKSObject‑Level RBAC in Basin Catalog: Granular Permissions for EngineersEvidence‑Driven Trustworthy AI Models: What Engineers Need to Adjust TodayConsolidating State Health Agency Workflows with Gemini Agent SkillsAI agent database load: patterns, pitfalls, and ScyllaDB mitigationsAI agents for healthcare: deployment patterns and operational impact for cloud and DevOps teamsDesigning an Agent‑Ready Platform: Webflow’s Blueprint for Safe AI‑Generated CodeSelf‑service scaling to 5,000 GKE nodes in under five minutesStable Kubernetes Foundations Power AI Agent Workloads on Amazon EKSObject‑Level RBAC in Basin Catalog: Granular Permissions for EngineersEvidence‑Driven Trustworthy AI Models: What Engineers Need to Adjust Today
Google Cloud

BigQuery AI.AGG GA introduces structured output – practical impact for engineers

AI SummaryPowered by AI

The AI.AGG function in BigQuery is now generally available and supports a user‑defined <code>outputschema</code> for structured results. This change lets data, AI, and operations teams retrieve ready‑to‑query fields directly from unstructured text, reducing pipeline complexity and improving cost predictability.

BigQuery’s AI.AGG() function has moved from preview to general availability and now accepts an output_schema argument that forces the model to return a defined set of columns instead of a free‑form paragraph. For engineers who already run SQL‑based analytics, the ability to get structured rows from raw text or multimodal data eliminates a common hand‑off to external code and makes downstream joins, filters, and visualisations straightforward.

What changed in AI.AGG

During preview, AI.AGG() produced a single text block per grouping, which was useful for ad‑hoc console inspection but required additional parsing for automation. The GA release adds the output_schema parameter, allowing callers to declare the exact field types—strings, numbers, booleans, or arrays—that the Gemini model should populate. The function still runs inside BigQuery, leveraging the same Gemini models, but now returns a regular table schema that can be queried immediately.

Why it matters to engineers

AI engineers can now embed generative summarisation directly in SQL without writing custom extraction code. Cloud and platform engineers gain a native aggregation primitive that reduces the need for separate ETL jobs to transform logs, tickets, or voice transcripts. DevOps and SRE teams benefit from the token‑based cost management controls that accompany the GA release, giving predictable budgeting for large‑scale model calls. Security engineers see fewer data movement steps, which can lower exposure risk when handling sensitive logs or customer feedback.

Typical workflows—bug deduplication, feedback theme extraction, chatbot quality monitoring, and log triage—can now be expressed as a single SELECT that groups raw records and returns ready‑to‑use columns such as issue_count, sentiment_score, or error_category. This eliminates the need for downstream parsing scripts or temporary tables.

Architectural and operational implications

Integrating AI.AGG() with structured output changes the data pipeline shape. Instead of a two‑stage process (raw ingestion → external AI service → re‑ingest), the aggregation happens in‑place within BigQuery. Engineers should consider the following:

  • Query planning: The function is treated as a scalar aggregate; its cost is accounted per row group, so query budgets must include model token usage.
  • Cost controls: The token‑based limits introduced with GA let administrators cap per‑query or per‑project token consumption, preventing unexpected spikes when processing millions of rows.
  • Observability: Model invocation metrics appear in BigQuery job logs, enabling SREs to set alerts on token usage or latency thresholds.
  • Data residency: Since the model runs as part of the BigQuery service, data never leaves the Google Cloud region selected for the dataset, which aligns with typical compliance expectations.

From a security perspective, the reduced data movement means fewer points where data could be intercepted or logged outside of BigQuery’s audit trail. However, practitioners should still treat model output as potentially sensitive and apply standard data‑at‑rest encryption and access‑control policies to the resulting tables.

Related CloudNinjas coverage: Google Cloud.

What This Means For Practitioners

Start by reviewing existing aggregation pipelines that consume unstructured text. Replace external processing steps with a single SELECT … GROUP BY … that calls AI.AGG() and defines an output_schema matching the fields your downstream reports need. Enable token‑based cost limits in the BigQuery project settings to keep usage predictable. Finally, add monitoring for AI.AGG() job metrics so you can spot latency or cost anomalies early.

Originally published atGoogle Cloud Blog