On this page
How to Build an AI Agent for Data Analysis and Reporting
For finance, operations and BI teams that want to ask questions of business data in plain English and get scheduled reports without waiting on an analyst, the workable pattern is not "point a chatbot at the database". It is to define your metrics once in a semantic layer, let the agent query only through that layer with the asking user's permissions, verify every number against the query that produced it, and keep a person in the loop for anything that goes to customers, auditors or the board.
No-code and BI-vendor assistants are a sensible first step. A custom build is worth considering when your data is spread across systems, access rules are strict, or you need tight control over accuracy and cost.
Why "chat with your data" often disappoints
Two problems explain most failures.
First, language models are good at writing plausible SQL and plausible prose, and neither is the same as correct. "Revenue" can mean gross, net of refunds, recognised or invoiced, depending on who is asking. A model that guesses will give a confident answer to a different question from the one you meant.
Second, the agent usually sees more data than the person asking should. If it connects with an admin credential, anyone using it can reach anything. That is a security and privacy problem before it is an accuracy problem.
Both are solved by structure, not by a better prompt.
Here is how the first problem looks in practice (illustrative numbers). An order is worth 100, with 20 refunded later and 10 of tax. "Gross sales" is 100, "net of refunds" is 80, and "net of refunds and tax" may be 70, depending on how finance reports. Ask an ungoverned agent for "revenue by region" and you get one of these three at random, with no warning. A semantic layer makes the choice once, in writing, and the agent shows which one it used.
Working on something like this? Talk it through with the team that builds it.
Step by step: building the agent
Step 1: Pick the questions that matter
List the 20 questions your team asks most often, such as "What was net revenue by region last month?" or "Which invoices are over 60 days overdue?" Group them by data source. Start with one source and one audience. A narrow agent that is right beats a broad one that is sometimes wrong.
Step 2: Get the data into a reliable place
Agents work best on a clean, queryable store such as a warehouse, a reporting database or a well-structured set of views, not directly on a live production system. If your data sits in separate tools with different customer IDs, resolve that first. Our post on the data silo trap and unified data layers covers the options.
Step 3: Build a semantic layer
A semantic layer is a governed list of metrics and dimensions: what "net revenue" means, which tables and joins it uses, which filters are standard, and what a "customer" is. The agent chooses from these defined metrics and does not invent calculations. It can be a feature of your BI tool, a dedicated metrics layer, or a carefully documented set of views and a glossary for a simpler build. Finance should sign off the definitions.
Step 4: Connect with read-only, permission-aware access
Use a read-only credential. Better, pass the user's identity through so the query returns only the rows and columns that person may see. If row-level security is not available, restrict what the agent can reach by role. Enforce permissions in the data layer and not in the prompt. A prompt that says "do not show salaries" is a request, not a control. The same principle is explained for document search in our guide to secure RAG and verification strategies.
Step 5: Generate queries, then verify them
For each question the agent should:
- map the request to metrics in the semantic layer, and ask a clarifying question if it is ambiguous;
- generate the query and run it;
- show the answer together with the query, the filters and date range, and the metric definitions used;
- run sanity checks, such as totals matching a known report, no negative counts, and period-over-period changes within a plausible range.
Never let a model do arithmetic in prose. Calculations happen in the query or in code, and the model only describes the result. If the query returns nothing or fails, the agent says so and does not fill the gap.
Step 6: Build a test set
Write 30 to 50 questions with known right answers, taken from reports your team already trusts. Run them every time you change a prompt, model or definition. Track accuracy, and review every wrong answer to see whether the cause was an ambiguous metric, a bad join or a model error. This evaluation set is the single best protection against silent regressions.
Step 7: Schedule reports, with review where it counts
Weekly sales summaries, aged debtor lists and inventory alerts can run on a schedule and arrive in Slack or email with the underlying figures attached. For external or financial reporting, add an approval step: the agent prepares the draft and commentary, an analyst checks the numbers and publishes. Label machine-written commentary clearly, and include a link back to the source data.
Step 8: Log and monitor
Log the question, user, query, result and any corrections. Review the logs to find questions people keep asking that the semantic layer does not cover, and queries that are slow or expensive. Set limits on query cost and row counts so one question cannot overload your database.
No-code or custom?
| No-code or BI-vendor assistant | Custom agent | |
|---|---|---|
| Setup time | Days to weeks | Weeks to a few months |
| Best when | Data is in one supported tool or warehouse | Data spans several systems or custom sources |
| Permissions | Inherits the tool's model | Designed to your rules and roles |
| Accuracy control | Limited to vendor features | Your own checks, tests and metric logic |
| Cost at volume | Per-seat or per-query pricing | You choose models and caching |
| Fit with workflows | Within the tool | Reports into Slack, email, your apps |
Start with the vendor assistant if your BI tool offers one and your data is already modelled. Move to custom when the limits show up: questions that span systems, strict row-level rules, a need to approve outputs before delivery, or costs that rise with usage. Published 2026 estimates from development vendors (Kellton, aichat, SoluLab, Cleveroad) put a single-purpose custom agent at roughly $5,000 to $50,000, and multi-step systems at $25,000 to $100,000 or more, with yearly maintenance quoted at 15 to 30% of the build cost. Check that the value of the time saved justifies the build before you commit; see our AI agent cost comparison.
How to decide what to do next
- Can finance agree one definition for your top five metrics?
- Is the data accessible in one queryable place?
- Do you know who may see what?
- Do you have 30 questions with known answers to test against?
- Who reviews reports before they leave the company?
Red flags: a tool that connects with an admin account, answers without showing the query, or cannot say "I don't know".
Questions to ask a vendor: how are metric definitions stored and versioned, does the query run as the asking user or as a shared service account, what happens when the question is ambiguous, and can I export the definitions and logs if I switch tools?
If your data is sensitive, the guide to compliant and secure AI systems covers where the model should run.
Sources
Cost figures in this article are published 2026 estimates from development vendors, not independent benchmarks.
Written by the Futurise Solutions team. We use AI tools to help with research and drafting; our team edits each article and checks figures and regulatory details against the sources linked in it. Spotted something wrong? Email us.




