
An AI Data Pipeline an Agent Built in 2 Hours
How an AI agent built my entire data reporting pipeline in 2 hours, connecting sources, building a semantic model, and creating dashboards automatically.
I used to spend days building out client data reporting systems. Connect the data sources, figure out the joins, set up the BI tool, build the dashboards, realize the numbers don't match, debug everything, repeat. It was a slog.
Last month, an AI agent built my entire data reporting pipeline, from raw data sources to finished dashboards, in about two hours. I didn't write a single line of SQL myself.
The agent was Claude Code, and it had help: a semantic layer that defines the metrics up front, which makes the agent's job a lot easier. Here's how the build went.
Why does business reporting keep breaking?
If you've ever managed reporting for a business, you know the pain. Joins and calculations live inside individual Looker blends or dashboard queries, so changing one thing breaks three others. The revenue in Dashboard A doesn't match Dashboard B, and you spend an afternoon figuring out why. Every new report means recreating the same joins, filters and calculations by hand. And each client turns into a one-off build, so what worked for Client A doesn't transfer to Client B.
I've watched analytics people spend a big share of their week keeping existing dashboards running instead of finding anything new.
Most BI setups put the logic in the wrong place. The dashboards become the source of truth, when the data model should be.
Model-first reporting with an AI agent on top
What changed things for me: once you have a proper semantic layer, a central place where metrics, dimensions and joins are defined once, an AI agent can do the rest.
The agent doesn't have to invent logic each time. It works from a consistent, documented data model where the definitions already exist, and its job is to assemble them into dashboards.
The stack I landed on:
- Claude Code, the orchestrator that plans, writes code, connects things and iterates
- Cube, the semantic layer with the central metric and dimension definitions
- Metabase, the BI tool, quick to build in and approachable for stakeholders
- Playwright, the browser automation that builds dashboards through the Metabase interface
Together they give a small team the kind of reporting that usually takes a dedicated data team.
Why these tools?
Cube as the semantic layer
Cube is an open-source semantic layer that sits between your data sources and your BI tools. You define your metrics and dimensions once, in code, and every downstream tool uses those definitions.
That buys you consistency. "Revenue" means the same thing everywhere. "Customer count" uses the same logic whether you're in Metabase, building an embedded dashboard, or querying via API.
Cube connects to the major data warehouses (Snowflake, BigQuery, Postgres, Databricks) and exposes your semantic model via SQL, REST and GraphQL. That's what makes it work well with an agent: Claude Code can introspect the model, understand the relationships, and generate queries that actually run.
Gartner has since come to the same conclusion. In a May 2026 press release it tied inaccurate AI agents to missing semantics and said organizations will budget for semantic capabilities as a non-negotiable foundation. I'm seeing that play out firsthand.
Metabase as the BI layer
Metabase is an open-source BI tool that's easy to use. Non-technical stakeholders can build their own queries, and technical users can drop into SQL when they need to.
The self-hosted open source version is free. Just run docker run -d -p 3000:3000 metabase/metabase and you're up. Managed Metabase Cloud starts at $100 a month on the Starter plan, per the Metabase pricing page.
I picked Metabase over the alternatives because it's simple enough for an AI agent to navigate through Playwright and still capable enough for real business analytics.
Playwright for the UI work
This is the part I didn't expect to work as well as it did. Claude Code doesn't stop at SQL or config files. It drives the Metabase UI to create the dashboards.
Using Playwright (the browser automation framework), the agent can:
- Navigate to Metabase
- Create new questions using the query builder
- Configure filters and visualizations
- Build dashboards and arrange charts
- Set up date filters, pivot tables, and drill-downs
That covers the last mile. You end up with dashboards stakeholders can open and use, with no hand-off from generated code to someone clicking through the UI.
How did the agent build it, step by step?
The data lived in three places: Stripe, HubSpot, and a Postgres application database.
Step 1: Inventory and connect the data sources
I started by describing the situation to Claude Code:
"I have three data sources: Stripe for payments, HubSpot for CRM data, and a Postgres database with application data. The goal is consolidated reporting on revenue, customer lifecycle, and product usage."
The agent asked clarifying questions:
- What are the core entities? (Customers, subscriptions, events)
- What's the grain of each data source? (Transaction-level for Stripe, contact-level for HubSpot)
- What are the must-have metrics? (MRR, churn rate, LTV, conversion rates)
Then it provided a connection plan with:
- Read-only credentials for each source (least privilege)
- Environment variable structure for secrets
- Sanity checks to run after connecting ("Can we query? Do row counts match expectations?")
Step 2: Set up the data stack
The agent recommended the Cube and Metabase stack and walked through setup. For Cube that meant a local development configuration, a Docker Compose setup for production, and connection strings for each data source. For Metabase it was the Docker deployment command, the initial admin setup, and the connection to Cube's SQL endpoint.
This took maybe 20 minutes of guided iteration. The agent handled the config files; I just approved and ran commands.
Step 3: Pull schemas and map entities
Once connected, the agent introspected the schemas from each data source. It identified:
- Customers (from HubSpot contacts and Stripe customers)
- Subscriptions (from Stripe)
- Transactions (from Stripe charges)
- Product events (from Postgres)
It then proposed an entity relationship map, highlighting where the joins would happen (email as the common key between HubSpot and Stripe, user_id linking Postgres events to Stripe customers).
Step 4: Build the semantic model in Cube
This is where the agent earned its keep. It generated Cube data model files that defined:
Measures:
mrr: Monthly recurring revenuetotal_revenue: Lifetime revenue per customerchurn_rate: Calculated as churned customers / total customersconversion_rate: Trials converted to paid
Dimensions:
signup_date,first_payment_date,churn_dateplan_type,billing_intervalacquisition_channel(from HubSpot)cohort_month(derived from signup date)
Joins:
- Explicit, documented relationships between cubes
- Handles for the tricky cases (customers with multiple subscriptions, attribution to original acquisition channel)
The agent also flagged potential issues: "Watch out for fanout on the events table, a customer can have thousands of events, so we should aggregate before joining."
Step 5: Connect Cube to Metabase
With the semantic model in place, the agent configured the connection between Cube and Metabase:
- Set up Cube's SQL API endpoint
- Added it as a database in Metabase
- Synced the schema so all cubes appeared as tables
- Configured display names so metrics were human-readable
Step 6: Build dashboards with Playwright
Now for the fun part. I gave the agent a screenshot of an existing Looker dashboard and said: "Recreate this in Metabase."
The agent used Playwright to:
- Navigate to Metabase
- Create a new question using the MRR measure
- Add a date filter (relative: last 12 months)
- Set the visualization to a line chart
- Save and add to a new dashboard
- Repeat for each chart in the original
Pivot tables are fiddly, and the agent needed a couple of attempts to get the configuration right. I'd take a screenshot of the issue, paste it into the conversation, and the agent would adjust.
Step 7: Validate and iterate
The final step was validation. The agent ran reconciliation queries:
- Total revenue in Cube vs. raw Stripe data
- Customer counts matching between HubSpot and the semantic layer
- MRR calculations verified against known-good monthly totals
We caught one discrepancy (a timezone issue on the date dimension) and fixed it in the model. After that, everything matched.
The results
| Metric | Before (Manual) | After (AI Agent) |
|---|---|---|
| Setup time | 3 to 5 days | ~2 hours |
| Dashboard iteration | 2 to 4 hours each | 10 to 15 minutes |
| Metric consistency | Low (logic scattered) | High (defined once) |
| Maintainability | Fragile | Solid |
| Cross-client reusability | None | High |
The speed is nice, but I care more about the quality. Metrics are defined once in the semantic layer and used everywhere, so I've stopped having "why don't these numbers match?" debugging sessions.
What didn't work perfectly?
There were limits.
Ambiguous specs got questions back. If I said "show me revenue by month," the agent would ask: "Booking date or payment date? Including refunds? Which revenue types?" That's useful, because those questions would otherwise turn into bugs later.
Pivot tables needed iteration. Complex visualizations sometimes took 2 to 3 attempts. The agent would get close, I'd screenshot the issue, and we'd refine.
Data modeling still needs a person. The agent can propose a model, but someone has to confirm that "customer" means what we think it means and that the join logic matches how the business actually works.
UI automation fails sometimes. Playwright would occasionally time out or click the wrong element. The agent's retries handled most of these, but now and then I had to step in.
What does this mean for analysts?
I don't see this replacing analysts. It takes the toil off their plate so they can do the analysis.
The infrastructure work, meaning the connections, models and dashboards, is grunt work. An AI agent does it faster and more consistently than I do.
People are still needed to define what the metrics mean for the business, decide which questions are worth answering, and turn the results into actions. That's where I want to spend my time, instead of debugging why two dashboards show different revenue numbers.
How do you replicate this?
If you want to try this approach:
-
Start with a reporting inventory. What decisions do your dashboards support? What are the must-have metrics? For the real estate version of that metric list, see an AI command center for investors.
-
List your data sources. For each one: what's the grain, what are the core entities, and what keys can you join on?
-
Set up a semantic layer. Cube is my recommendation, but dbt's semantic layer or Looker's modeling layer work too. What matters is defining metrics once, in code.
-
Connect your BI tool. Metabase is quick. Tableau or Looker work if you're already invested there.
-
Use an AI agent for the last mile. Claude Code with Playwright can build the dashboards themselves as well as the SQL behind them.
-
Validate against known-good numbers. Always reconcile back to the source systems.
-
Document metric definitions. Treat them like product requirements. When someone asks "what is churn rate?" there should be one canonical answer.
FAQ
Q: Does this work with Looker instead of Metabase?
Yes, though the Playwright automation is more complex because Looker's UI is harder to automate. I've had better results with Metabase for agent-driven builds.
Q: What about dbt instead of Cube?
dbt is great for transformation logic but doesn't have the same semantic layer capabilities (though the dbt semantic layer is catching up). You could use dbt for transforms and Cube for the metrics layer.
Q: How do I handle sensitive data?
Use read-only database credentials. Keep secrets in environment variables, never in prompts. The agent doesn't need access to raw PII, just schema information and aggregate results.
Q: What if my data sources don't have good keys for joining?
That's a data quality problem no tool fully solves. The agent can help find where the gaps are and propose fixes (fuzzy matching on names, lookup tables, and so on).
Q: Can non-technical people use this approach?
They can use the resulting dashboards, absolutely. Setting up the semantic layer and running the agent still takes some technical comfort, but it's a one-time setup cost, not ongoing maintenance.
Want help building your reporting pipeline?
If you're spending days on reporting infrastructure that should take hours, semantic layers and AI agents can close most of that gap.
Check out our data automation services or explore our comparison of automation tools if you want to see how this fits into a broader automation strategy.
That's all I got for now. Until next time.
For AI connected to your own systems, with results written back and failures monitored, see AI integration services.
Founder & CEO, White Space Solutions
Jason builds AI automation systems for real estate investors and business owners. With experience spanning data analytics, direct mail automation, AI voice agents, and revenue intelligence, he helps companies replace manual workflows with intelligent systems that drive measurable results.
Related Articles
Claude Code for Data Engineering: One Build
How I used Claude Code to build a Customer.io to BigQuery pipeline with Cloud Functions, merges, and cost controls. No data engineering team needed.
Hyperagent AI: Cloud AI Agents, Reviewed
Hyperagent gives each agent its own cloud computer, memory, and skills. What it is, how the fleet architecture works, what it costs, and how to deploy it.
Vercel eve: AI Agents in Your Codebase
Vercel eve is an open-source agent framework where an agent is a directory of files. How it works, what it costs, where it locks you in, and when to use it.
AI Command Center for Real Estate Investors
What an AI command center means for a real estate investor: one screen for what your AI agents and team did, the numbers that matter, and what it costs.