<< goback()

Agentic Analytics on Snowflake: How to Build AI-Driven BI in 2025

Typedef Team

Agentic Analytics on Snowflake: How to Build AI-Driven BI in 2025

The CFO asks: "What drove the Q3 revenue drop?" Instead of opening a dashboard or writing SQL, you type the question into a chat interface. Seconds later, Snowflake Cortex Analyst returns an answer with the exact SQL it generated and executed.

This represents agentic analytics: AI systems that interpret business questions, generate queries autonomously, and deliver insights without manual intervention. But between the question and the answer lies a critical challenge: ensuring AI produces correct, trustworthy results rather than hallucinated nonsense.

What Agentic Analytics Is

Agentic analytics refers to AI systems that autonomously perform analytical workflows—interpreting questions, accessing data, generating queries, and delivering insights without human SQL writing or dashboard navigation.

Traditional BI requires analysts to translate business questions into technical operations. An executive asking "Which regions underperformed last quarter?" triggers a manual process: open the BI tool, select appropriate metrics, filter by time period, group by region, create visualization. Each step requires technical knowledge.

Agentic systems eliminate these steps. The same question goes directly to an AI agent that determines the required data, generates appropriate SQL, executes against the warehouse, and formats results—all autonomously.

Three core capabilities define agentic analytics:

Autonomous reasoning: Agents parse ambiguous questions and determine analytical strategies. When asked "Why did product views drop on April 5?" the agent doesn't just query view counts—it reasons about causality, checks for related metrics like site performance or marketing campaigns, and synthesizes findings across multiple data sources.

Multi-step orchestration: Agents coordinate multiple operations in sequence. A question about revenue variance might trigger: query current quarter metrics, query comparison period, calculate difference, search documentation for known issues, format explanation. Each step informs the next based on intermediate results.

Self-correction: Production agents validate their work. After generating SQL, they check execution success, verify result reasonableness, and fix errors before returning answers. This reflection prevents obviously wrong results from reaching users.

The technical foundation combines large language models with semantic infrastructure. LLMs provide natural language understanding; semantic layers provide the deterministic business logic that grounds AI reasoning in reality.

How Teams Build AI-Driven BI on Snowflake Today

Organizations implementing agentic analytics on Snowflake follow three primary patterns, each with different complexity and control levels.

Cortex Analyst for Managed Text-to-SQL

Snowflake Cortex Analyst provides a fully managed service that translates natural language questions into SQL queries without requiring custom LLM infrastructure.

The implementation path:

Create semantic models: Define business logic in YAML specifications that map database tables to business concepts. A sales analytics semantic model specifies that "revenue" means SUM(order_amount * (1 - discount_pct)), documents table relationships, and provides synonyms like "sales" and "total revenue" for AI interpretation.

Deploy to Snowflake: Upload YAML files to Snowflake stages or use Snowsight's visual interface to generate models from existing schemas. Cortex Analyst validates specifications and exposes REST APIs for natural language queries.

Integrate applications: Connect chat interfaces, dashboards, or custom applications to the Cortex Analyst API. Users ask questions; the service generates SQL, executes queries, and returns structured results.

The architecture uses an ensemble of LLMs that work together through an agentic workflow. When a question arrives, the system:

  1. Validates whether the question can be answered with available data
  2. Generates SQL using semantic model context
  3. Checks SQL correctness
  4. Fixes errors if needed
  5. Executes the validated query
  6. Returns results with the generated SQL for transparency

Snowflake reports internal benchmarks showing 90% accuracy with this approach versus 51% when LLMs generate SQL directly without semantic grounding.

Cortex Agents for Multi-Tool Workflows

For scenarios requiring more than database queries—combining structured data analysis with document search, external API calls, or multi-hop reasoning—Snowflake introduced Cortex Agents.

Agents operate through a planning-execution-reflection cycle:

Planning phase: Parse the user's request and decompose it into executable sub-tasks. For "Compare Q3 revenue to last year and identify contributing factors," the agent plans a workflow: query current quarter, query prior year, calculate variance, search relevant documents for context, synthesize explanation.

Execution phase: Route sub-tasks to specialized tools based on data type and operation requirements. Cortex Analyst handles structured SQL queries. Cortex Search retrieves unstructured documents. Custom integrations connect to external systems. Each tool returns intermediate results that inform subsequent steps.

Reflection phase: Evaluate whether intermediate results answer the question or require iteration. If SQL returns unexpected nulls, the agent might request clarification from the user or reformulate the query with additional constraints.

Organizations configure agents through JSON specifications that declare:

  • Available tools and their capabilities
  • Access permissions and security policies
  • Routing logic for different question types
  • Error handling and retry strategies

The agent orchestrates these components automatically, adapting workflows based on runtime results.

Direct LLM API Integration

Teams requiring fine-grained control or specific LLM provider preferences build custom agentic workflows using language model APIs directly.

Common implementation patterns:

Schema context prompting: Inject table schemas, column descriptions, and sample queries into LLM prompts. The model generates SQL based on this context. Accuracy depends heavily on prompt design and context window management.

Retrieval-augmented generation: Embed documentation, business glossaries, and historical queries into vector databases. At query time, retrieve relevant context and include it in prompts to improve generation quality.

Multi-agent architectures: Decompose analytics workflows into specialized agents—a planning agent determines strategy, a generation agent writes SQL, a validation agent checks correctness, and a formatting agent structures results. Each agent uses different prompts and possibly different models optimized for specific tasks.

This approach requires infrastructure for:

  • Embedding generation and vector storage
  • LLM API orchestration with rate limiting
  • Error handling and retry logic
  • Result validation and caching
  • Audit logging and observability

The flexibility comes with operational complexity that many teams underestimate during initial implementation.

Problems with Current Approaches

Despite rapid advancement, agentic analytics faces several technical challenges that prevent reliable production deployment.

SQL Hallucination and Schema Confusion

LLMs generate plausible but incorrect SQL with alarming frequency. When asked to write queries, they hallucinate table names, invent columns that don't exist, and produce syntactically valid queries that return meaningless results.

The root cause: LLMs learn patterns from training data containing millions of SQL queries across diverse schemas, but they lack deterministic knowledge of any specific database structure. Without explicit grounding, they guess based on probability distributions—not actual schema.

Research quantifies this: LLMs writing SQL directly against database schemas achieve 16-20% accuracy on enterprise benchmarks. Even advanced models reach only 40-50% without semantic grounding. For production analytics where business decisions depend on correctness, this failure rate is unacceptable.

The problem compounds with schema size. Databases containing hundreds of tables with inconsistent naming, ambiguous relationships, and sparse documentation produce queries that:

  • Join tables incorrectly or miss required joins entirely
  • Aggregate at wrong granularities (summing already-aggregated values)
  • Apply filters incompletely (missing critical WHERE clauses)
  • Use wrong date logic (comparing timestamps to dates without truncation)

Metric Definition Inconsistency

Without centralized metric definitions, the same question produces different answers depending on who asks or which tool they use.

The CFO asks "What was Q3 revenue?" Three different systems respond:

  • Executive dashboard: SUM(order_total) = $5.2M
  • Finance report: SUM(order_total - discounts) = $4.8M
  • Sales analytics: SUM(order_total) WHERE status != 'refunded' = $4.9M

Each calculation reflects different business logic assumptions. None are necessarily wrong—they answer slightly different questions—but without documentation, users can't distinguish nuance from error.

Agentic analytics amplifies this problem. When AI agents generate metric calculations independently based on natural language prompts, they create variations based on phrasing subtleties. "Total revenue" might produce SUM(revenue) while "revenue total" generates SUM(revenue - returns) depending on context interpretation.

Organizations report analytics teams spending significant time reconciling discrepancies rather than generating insights. This "metric reconciliation tax" slows decision velocity and erodes data trust.

Context Window and Token Limitations

LLMs operate within fixed context windows—the maximum text they can process simultaneously. Even extended context models struggle when schemas contain hundreds of tables with thousands of columns.

This constraint forces problematic trade-offs:

Schema truncation: Include only seemingly relevant tables in prompts, risking exclusion of actually needed tables. Determining relevance itself becomes a prediction problem with failure modes.

Iterative refinement: Generate preliminary SQL, check results, refine understanding, regenerate. This multi-round approach increases latency and fails when initial guesses are far from correct.

Retrieval-based filtering: Use separate systems to find relevant schema elements before prompting. This adds infrastructure complexity and introduces additional failure points.

The fundamental tension: comprehensive schema context exceeds token limits, but insufficient context produces unreliable queries.

Row-Level Security and Governance

Traditional BI enforces access control through dashboard permissions—users see only dashboards they're authorized to access. Agentic analytics bypasses this model entirely. Agents generate arbitrary SQL against underlying tables, potentially exposing data that carefully designed dashboards would hide.

The governance challenge manifests through:

Dynamic SQL generation: Agents don't query pre-approved views—they generate new queries on every request. Standard database permissions apply, but agents must understand these constraints to avoid exposing sensitive data combinations.

Column sensitivity: Certain columns like personally identifiable information require masking even when users have table access. Agents must recognize sensitive columns and apply appropriate transformations.

Cross-domain aggregation: A single query might join data from multiple domains with different sensitivity levels. Agents need to understand which combinations are permissible.

Audit requirements: Compliance often requires knowing not just what data was accessed but what business question prompted the access. Standard query logs show SQL but lose the original natural language context.

Existing security frameworks weren't designed for AI agents generating dynamic queries based on unpredictable user questions.

Explainability and Debugging

When dashboards show incorrect data, analysts trace through SQL queries to identify error sources. When agents produce wrong results, the debugging path is opaque.

Agents involve multiple reasoning steps—question interpretation, query planning, SQL generation, result processing—with LLM decisions at each stage. Why did the agent choose a specific table? Why did it apply this filter? Why this aggregation logic?

Production systems require:

Reasoning transparency: Show planning steps and tool selection rationale. Users need to see "I'm querying the orders table because it contains transaction-level revenue data" rather than just getting results.

Query lineage: Connect generated SQL back to the original question and intermediate reasoning. When results look wrong, trace through the interpretation chain to find where reasoning diverged from intent.

Confidence scoring: Indicate when the agent is uncertain versus confident. Questions with ambiguous phrasing or incomplete semantic coverage should trigger warnings rather than returning potentially wrong results.

Alternative interpretations: Provide multiple possible readings when questions admit several reasonable interpretations. "Revenue by region" might mean customer location, shipping location, or billing location—all valid depending on context.

Without explainability, organizations can't debug failures or build trust in agent-generated insights.

How to Build Better Agentic Analytics

Production-grade agentic analytics requires architectural patterns that combine AI flexibility with deterministic reliability.

Semantic Views as the Grounding Layer

Snowflake Semantic Views encode business logic as first-class database objects, providing the deterministic foundation that prevents LLM hallucination.

Rather than forcing AI to infer metric definitions from raw schemas, semantic views explicitly specify:

Logical table abstractions: Map messy physical schemas to clean business entities. An "orders" logical table might unify data from raw.order_header, raw.order_lines, and raw.order_adjustments while presenting a single coherent view.

Fact and dimension classification: Mark columns as facts (numeric values to aggregate) or dimensions (categorical attributes for grouping). This guides agents toward correct operations—SUM(revenue) makes sense, SUM(region) does not.

Explicit metric definitions: Specify calculations once with proper aggregation logic. "Net revenue" becomes SUM(order_amount * (1 - discount_rate) - refund_amount). All downstream systems—BI tools, notebooks, AI agents—consume this identical definition.

Relationship specifications: Document how logical tables connect. When queries need customer region alongside order metrics, the semantic view specifies the join path: orders → customers → regions with correct cardinality handling to prevent row duplication.

Creating semantic views in Snowflake follows two approaches:

SQL DDL:

sql
CREATE SEMANTIC VIEW sales_analytics AS
LOGICAL TABLES
  orders (
    FACTS order_amount, tax_amount
    DIMENSIONS customer_id, product_id, order_date
    PRIMARY KEY order_id
  ),
  customers (
    DIMENSIONS customer_id, region, segment
    PRIMARY KEY customer_id
  )
RELATIONSHIPS
  orders.customer_id = customers.customer_id
METRICS
  total_revenue AS SUM(order_amount),
  avg_order_value AS SUM(order_amount) / COUNT(DISTINCT order_id)

YAML specifications:

Store semantic models as version-controlled YAML files, then import to Snowflake:

yaml
semantic_model:
  name: sales_analytics
  tables:
    - name: orders
      base_table: raw.orders
      measures:
        - name: revenue
          aggregation: sum
          expr: order_amount
      dimensions:
        - name: order_date
          expr: order_timestamp::date
  relationships:
    - from: orders.customer_id
      to: customers.customer_id

The YAML approach enables infrastructure-as-code workflows—semantic definitions commit to source control, undergo code review, and deploy through CI/CD pipelines.

AI-Powered Semantic Model Generation

Manual semantic modeling requires significant effort for large schemas. Snowflake addresses this through AI-assisted generation in Snowsight.

The generation workflow:

  1. Select tables to include in the semantic view
  2. Provide example SQL queries representing common analytical questions
  3. Add business context descriptions
  4. Let Cortex analyze query history to infer relationships and patterns
  5. Review AI-generated suggestions and refine with domain knowledge

The AI identifies patterns including:

  • Tables frequently joined together likely share foreign key relationships
  • Columns appearing in COUNT(DISTINCT x) are dimension candidates
  • Aggregated columns with SUM or AVG are fact candidates
  • Date truncation patterns indicate time dimension granularity

This provides a baseline that analysts iterate on, reducing initial modeling effort while maintaining accuracy through human review.

Verified Query Repositories

Beyond semantic definitions, explicit examples improve accuracy. Verified Query Repositories (VQR) pair natural language questions with known-correct SQL.

Example VQR entries:

yaml
verified_queries:
  - question: "What was total revenue last quarter?"
    sql: |
      SELECT SUM(order_amount) as total_revenue
      FROM orders
      WHERE order_date >= DATE_TRUNC('quarter', CURRENT_DATE - INTERVAL '3 months')
        AND order_date < DATE_TRUNC('quarter', CURRENT_DATE)

  - question: "Which customers had declining spend year-over-year?"
    sql: |
      WITH this_year AS (
        SELECT customer_id, SUM(order_amount) as revenue_2025
        FROM orders WHERE YEAR(order_date) = 2025
        GROUP BY customer_id
      ),
      last_year AS (
        SELECT customer_id, SUM(order_amount) as revenue_2024
        FROM orders WHERE YEAR(order_date) = 2024
        GROUP BY customer_id
      )
      SELECT t.customer_id, t.revenue_2025, l.revenue_2024
      FROM this_year t
      JOIN last_year l ON t.customer_id = l.customer_id
      WHERE t.revenue_2025 < l.revenue_2024

Agents use VQR as few-shot learning examples. When new questions resemble verified queries, agents adapt proven patterns rather than generating from scratch—improving accuracy on similar question types.

Multi-Stage Validation Architecture

Production agents require structured workflows that enforce correctness at each step.

Question interpretation stage: Parse user intent, identify ambiguous terms, request clarification when needed. If a user asks about "revenue," the agent confirms whether they mean gross revenue, net revenue, or revenue after returns.

Query planning stage: Determine which semantic views, metrics, and dimensions the question requires. Map the parsed intent to available semantic objects before generating any SQL.

SQL generation stage: Produce executable queries against semantic views—not raw tables. The semantic view handles join logic and aggregation rules; the agent focuses on question-specific filters and groupings.

Result verification stage: Check execution success, validate result reasonableness, identify anomalies. If a revenue query returns zero, that's suspicious and warrants additional validation before returning to users.

Explanation generation stage: Translate results back to natural language with business context. Include the generated SQL for transparency and debugging.

Each stage can use different LLM configurations—question interpretation might use a faster, cheaper model while SQL generation uses a more capable one optimized for code.

Hierarchical Context Engineering

Rather than dumping entire schemas into prompts, structure context in layers.

Business domain layer: Provide high-level descriptions before technical details. "The sales domain tracks customer orders, revenue, and product performance across regions and time periods."

Semantic definition layer: Include metric and dimension definitions from semantic views. Agents understand what "revenue" means as a business concept before seeing any SQL.

Relationship graph layer: Show how logical tables connect. A visual representation of orders → customers → regions helps agents identify valid join paths.

Physical schema layer: Include underlying table structures only when agents need to debug or when semantic views don't cover the specific use case.

This layered approach manages token budgets while providing appropriate context at the right abstraction level.

Observability and Audit Infrastructure

Production agentic analytics requires instrumentation beyond traditional BI tools.

End-to-end request tracing: For every agent interaction, log the original natural language question, parsed intent, generated SQL (including failed attempts), execution time, result row counts, and final formatted response. This creates a complete audit trail for debugging and compliance.

Performance metrics: Track agent behavior over time including question success rate, SQL generation accuracy, result validation pass rate, and user satisfaction signals from explicit feedback or implicit behaviors like follow-up questions.

Snowflake Account Usage views provide raw telemetry:

sql
-- Track Cortex Analyst usage patterns
SELECT * FROM SNOWFLAKE.ACCOUNT_USAGE.CORTEX_ANALYST_USAGE_HISTORY
WHERE request_timestamp > DATEADD(day, -7, CURRENT_TIMESTAMP)
ORDER BY request_timestamp DESC;

-- Analyze semantic view query patterns
SELECT
  semantic_view_name,
  COUNT(*) as query_count,
  AVG(execution_time_ms) as avg_latency
FROM query_logs
WHERE query_type = 'SEMANTIC_VIEW'
GROUP BY semantic_view_name;

This telemetry enables continuous improvement—identifying which semantic views need refinement, which question types fail frequently, and which prompts require tuning.

Future Directions for Agentic Analytics

Agentic analytics in 2025 represents early adoption, not final maturity. Several technical directions will reshape analytics over the next 2-3 years.

Proactive Intelligence and Anomaly Detection

Current agents react to questions. Next-generation agents anticipate needs through continuous monitoring.

Agents will scan metrics constantly, detect unusual patterns, and alert stakeholders proactively: "Revenue in the Northeast region dropped 15% yesterday—likely due to weather disruptions affecting three distribution centers based on shipping delay spikes."

Rather than waiting for "How can we improve conversion rates?" agents will analyze patterns and surface insights automatically: "Conversion rates are 23% higher when discount codes appear within 30 seconds of site visits. This pattern emerged over the past two weeks across all regions."

Agents will also model scenarios without explicit requests: "If marketing increases ad spend in the Mid-Atlantic region by 20%, expected revenue increase is 12-15% based on historical elasticity patterns and current market conditions."

This shift from reactive Q&A to proactive intelligence transforms analytics from a support function to an active driver of business outcomes.

Multi-Modal Data Integration

Current agentic analytics focuses on structured data and text. The next wave integrates diverse data types within single analytical workflows.

Image analysis will join BI workflows: "Show regions where product placement photos deviate from brand guidelines, correlated with sales performance." Agents will analyze retail location images, extract structured data, and join with sales metrics.

Video content will become queryable: "Which training videos correlate with improved sales rep performance?" Agents will transcribe videos, extract key concepts, and correlate with CRM outcomes.

Audio transcripts will feed analytical pipelines: "What topics in customer support calls predict churn?" Agents will process call recordings, extract structured insights, and integrate with retention models.

Snowflake's support for unstructured data via Snowpark and Cortex AI capabilities positions the platform for this convergence. Semantic views will extend beyond tables to encompass images, videos, and audio as first-class analytical objects.

Collaborative Human-Agent Workflows

The future isn't full automation—it's intelligent collaboration between analysts and agents.

Agent-assisted exploration: Analysts pose initial questions; agents generate multiple analytical paths. "Here are three ways to analyze Q3 performance: regional comparison, product category trends, or customer cohort analysis. Which approach would you like to explore first?"

Continuous learning from feedback: When analysts correct metric definitions or refine queries, agents incorporate this knowledge for future questions. The system improves through interaction rather than requiring retraining.

Hybrid reasoning workflows: Quantitative insights from agents combine with qualitative context from analysts. The agent calculates that sales dropped 18%, but the analyst knows the region experienced supply chain disruptions—together they produce complete understanding.

This collaborative model leverages AI speed and scale while preserving human judgment and domain expertise.

Semantic Layer Standardization

The Open Semantic Interchange initiative—a collaboration across the data industry—aims to create vendor-neutral standards for semantic layer definitions. The goal: define metrics once in standard formats and consume them across any platform or tool.

As these standards mature, expect:

Cross-platform semantic layers: Define metrics once and deploy across multiple execution environments without rewriting business logic for each platform.

Semantic model marketplaces: Pre-built, certified semantic definitions for common domains—financial metrics, marketing analytics, supply chain KPIs—that organizations can adopt and customize rather than building from scratch.

Automated compatibility: Tools that validate semantic models against standards and identify compatibility issues before deployment.

Standardization reduces platform lock-in while enabling specialization—teams can choose best-in-class tools for modeling, execution, and consumption knowing they'll interoperate.

Building Production-Ready AI-Driven BI

Organizations successfully deploying agentic analytics share common implementation patterns.

Start with semantic foundations before implementing agents. Building comprehensive semantic views that cover core business metrics provides benefits across all use cases—not just agentic analytics but traditional BI, data science notebooks, and API integrations. This foundational investment enables multiple value streams.

Implement progressively in controlled domains. Begin with areas where failures carry low risk—internal operational reporting rather than customer-facing analytics or regulatory metrics. Prove accuracy and reliability in narrow contexts before expanding scope.

Measure semantic accuracy and agent performance from initial deployment. Track success rates, SQL correctness, result validation pass rates, and user satisfaction. Measurement enables improvement—what doesn't get tracked doesn't get optimized.

The data preparation challenge remains critical for agentic analytics success. Before agents can reason about business questions, data must exist in clean, structured formats with appropriate context. This preprocessing—transforming unstructured documents into structured entities, joining disparate sources, applying business rules—determines agent effectiveness more than model sophistication.

For teams building the data pipelines that enable agentic analytics, Typedef provides infrastructure for processing unstructured data at scale. Rather than writing custom code to prepare data for AI systems, teams can use composable operations that handle the complexity of transforming messy inputs into the clean, enriched data that agents require. Learn more about building reliable AI data pipelines.

Agentic analytics on Snowflake works when properly implemented. Cortex Analyst achieves 90% accuracy with semantic grounding versus 51% without it. But success requires architectural discipline: semantic views provide the grounding, structured validation ensures correctness, and proper observability enables continuous improvement. The shift from dashboards to conversations isn't about replacing analysts—it's about elevating them to focus on insights that require human judgment.

Found this useful?

Star Fenic on GitHub and help others discover it!