Skip to content

Founder-led. Limited engagements.Talk to Us →

Part 14 of 30 · 30 Days of Building AI Systems

AI Business Intelligence System | 30 Days of Building AI Systems, Day 14

Build an AI business intelligence system: data pipelines, a warehouse, a governed semantic layer, and an LLM that turns metrics into insights and alerts.

By 6 min readAI Systems · Business Intelligence · Data Engineering · Analytics
AI Business Intelligence System | 30 Days of Building AI Systems, Day 14

Yesterday we built an autonomous support agent that resolves customer issues with tools. Today we turn to the company's own numbers with an AI Business Intelligence System: one that connects your data sources, keeps metrics consistent, spots trends and anomalies, and delivers insights as dashboards, scheduled reports, and alerts. The focus here is governed, recurring business reporting. Ad-hoc question answering over SQL gets its own build tomorrow.

AI Business Intelligence System — CodeITronics infographic Save this sheet. The rest of this note walks through it section by section.

What We Are Building

An AI Business Intelligence System that:

  • Connects to multiple data sources and cleans the data
  • Analyzes trends and patterns
  • Generates insights automatically and creates visual dashboards
  • Answers business questions in natural language
  • Sends automated reports and alerts
  • Helps teams make data-driven decisions

Use cases: executive dashboards, sales performance, marketing campaign insights, financial reporting, customer analytics, supply chain, operational metrics, and anomaly alerts.

System Architecture

Data Sources -> ETL and Data Processing -> Data Warehouse and Storage
   -> AI Analysis Engine (LLM) -> Insights and Visualization -> Decision and Action

Notice that the LLM shows up in stage four, after three stages of plain data engineering. That ordering is honest. Most of the work in an AI BI system is getting trustworthy data into one place. An LLM on top of messy, inconsistent data produces confident, well-written, wrong insights.

Key Components

ComponentJob
Data connectorsPull from databases, APIs, files, SaaS apps
Data pipelineExtract, clean, transform, load on a schedule
Data warehouseStructured store for analytics (Snowflake, BigQuery, Redshift, or Postgres at small scale)
Semantic layerDefines metrics, dimensions, and joins once
AI / LLM engineExplains trends, writes summaries, answers questions
Visualization engineDashboards, charts, KPIs
Alerting systemPushes anomalies and reports to Slack, email, Teams
Access and permissionsWho can see which metrics and rows

The Semantic Layer Is the Foundation

The sheet lists a semantic layer as a key component, and it deserves the most attention. A semantic layer is where you define each metric once, with its formula, source table, time column, and allowed dimensions:

metrics:
  - name: net_revenue
    description: Revenue after refunds and discounts, in USD
    table: analytics.orders
    expression: SUM(order_total - refund_amount - discount_amount)
    time_column: ordered_at
    dimensions: [region, channel, product_category]
    owner: finance

The LLM then asks for net_revenue by region, last 30 days instead of writing free-form SQL against raw tables. This has three effects:

  1. Consistency. The number in the AI summary matches the number on the finance dashboard.
  2. Safety. The model can only reach metrics you have defined and permissioned.
  3. Better answers. Metric descriptions give the model the business context it needs.

The sheet places a vector database in the semantic layer row of its stack. That is useful for one thing: helping the model find the right metric for a vaguely worded question by searching metric names and descriptions. The definitions themselves should live in version-controlled config, not in a vector index.

Data to Insights Flow

The detailed flow on the sheet:

  1. Connect data sources and ingest data.
  2. Validate and clean, then transform and aggregate.
  3. Store in the warehouse.
  4. Business questions (natural language) and ad-hoc exploration both feed the AI analysis engine.
  5. The engine produces insights and key findings, dashboards, automated reports, and alerts.
  6. These drive decisions and actions: recommendations, plans, optimizations.

Here is the division of labor that keeps this honest. Detection is statistics. Explanation is the LLM. A scheduled job computes period-over-period changes, decomposes them by dimension, and flags values outside expected ranges. The LLM receives those computed results and writes the paragraph a human will read. It should not be asked to eyeball a table of numbers and find the anomaly itself.

A Minimal Tech Stack

LayerMinimal choice
FrontendNext.js, or start with an existing BI tool like Apache Superset
BackendPython (FastAPI)
ProcessingPandas or Polars, Spark only at real scale
WarehousePostgreSQL to start, Snowflake or BigQuery as you grow
OrchestrationAirflow, Prefect, or Dagster for scheduled pipelines
LLMOne general model for summaries and Q&A
DeliverySlack, email, or Teams

Example Dashboard and Insights

The sheet's sample dashboard shows total revenue, new customers, active users, and conversion rate, each with a change versus last month, plus revenue over time, sales by region, and top products. Below that sit two AI panels.

Recent insights read like: revenue increased mainly due to growth in North America; one product contributes about a third of total revenue; conversion rate improved for the third consecutive month.

Anomaly alerts read like: sudden drop in signups in the Asia region; high refund rate detected in one product.

To make "mainly due to growth in North America" trustworthy, the system must compute the contribution of each region to the change, then pass that table to the LLM with an instruction to describe only what the data shows. Each insight should link to the query and numbers behind it, so a skeptical executive can check it in one click.

Delivery matters as much as analysis. At CodeITronics, our Consolidated KPI Reporting Bot replaced founders logging into five tools daily with a cron worker that polls Stripe, PostHog, and SQL and posts a daily Slack summary. The result was zero daily dashboard logins. Often the most useful BI interface is a short message in the channel people already read.

Production Concerns

Data quality. Add tests to your pipelines for freshness, row counts, nulls, and duplicates. If yesterday's data did not load, the AI summary must say so instead of reporting a fake drop.

Evaluation. For generated insights, check factual accuracy against the source numbers automatically: every number in the text should appear in the input data. Track how often humans flag an insight as wrong or useless.

Alert fatigue. Too many anomaly alerts and people mute the channel. Start with a few high-value metrics, tune thresholds, and group related alerts into one message.

Permissions. Apply row and metric-level access before data reaches the LLM. A regional manager's summary should not include other regions.

Cost. Warehouse compute usually dominates, not LLM tokens. Summaries run on small aggregated tables, so they are cheap. Schedule heavy transforms off-peak.

Key Takeaways

  • An AI BI system is mostly data engineering. The LLM sits on top of a trusted pipeline.
  • Define metrics once in a semantic layer and let the LLM query metrics, not raw tables.
  • Detect anomalies with statistics, then use the LLM to explain them.
  • Deliver insights where people already work, and link every insight to its numbers.

FAQs

How is this different from the Day 8 data analyst?

Day 8 was an exploration copilot for analyzing a dataset you load. This system runs continuously over governed company metrics and produces recurring reports and alerts.

Do I need a data warehouse to start?

Not necessarily. A Postgres read replica with a few well-defined views works for early-stage companies. Move to a warehouse when data volume or source count makes it painful.

Can the LLM do forecasting for BI?

Use proper forecasting models for forecasts. The LLM can explain the forecast, its assumptions, and its uncertainty in plain language.

Up Next

Day 15 builds the AI Text-to-SQL Data Analyst: natural language questions turned into safe SQL over your warehouse, with schema grounding, query validation, read-only guards, and a review step before anything runs. If you want AI reporting built on your own data, get in touch.

Keep reading

AI Customer Support Agent | 30 Days of Building AI Systems, Day 13

Build an autonomous AI customer support agent: RAG answers, tool actions like order lookups and refunds, a clear escalation policy, and guardrails that hold.

AI Workflow Automation System | 30 Days of Building AI Systems, Day 12

Build an AI workflow automation system: triggers, LLM intent parsing, a deterministic workflow engine, idempotent actions, retries, and human approval gates.

AI Meeting Assistant System | 30 Days of Building AI Systems, Day 11

How to build a live AI meeting assistant: a bot that joins calls, transcribes and diarizes in real time, answers questions, and syncs action items to tools.

Subscribe to the edition

One useful systems note a week from real Salesforce and automation builds. Unsubscribe in one click.

Letters

Letters to the editor

No letters yet. Questions and counterpoints are welcome.