← Selected work

Project case study

Lama AI BI Agent: From Business Questions to Decision-Ready Insights

A governed AI BI agent that turns natural-language business questions into traceable analysis without abandoning trusted metric logic.

At a glance

The need

A generic chatbot can produce fluent answers without understanding the organization’s entities, approved views, date rules, invoice identity, customer logic or safe query boundaries. It can also lose the analytical subject when a user asks a short follow-up such as “what about last month?”

What the solution does

Lama is a bilingual virtual BI employee designed to help business users move from a question to a clear, evidence-based answer. It combines enterprise data, a governed semantic layer and an AI workflow so users can ask about sales, customers, invoices, collections and profitability in Arabic or English, continue with contextual follow-up questions and receive analysis shaped for business decisions.

01 / 07

01

Why this needed to exist

Many organizations already hold valuable operational data in SQL Server and reporting systems, but access to insight still depends on fixed dashboards, manual requests and the availability of a technical analyst. Business users know the question they want to ask, yet they may not know the database structure, metric definitions or reporting logic required to answer it safely.

The opportunity was to create a BI experience that feels conversational while remaining grounded in the same governed definitions expected from a serious analytics solution.

A generic chatbot can produce fluent answers without understanding the organization’s entities, approved views, date rules, invoice identity, customer logic or safe query boundaries. It can also lose the analytical subject when a user asks a short follow-up such as “what about last month?”

The core problem was therefore not simply generating SQL. It was preserving business meaning across language, context, metric selection, query construction, execution and response.

02

How the solution works

The AI model was treated as an orchestration and interpretation layer, not as the source of truth. Business meaning lives in governed metadata: approved entities and views, field definitions, metric formulas, date logic, allowed question families, and query boundaries.

Each question is normalized into a clear analytical intent. Relevant context from the prior exchange is inherited where appropriate, the semantic layer supplies the approved business meaning, and the workflow constrains the query before any result is generated or explained.

I designed a multi-stage workflow covering language detection, question normalization, semantic-state handling, governed metadata retrieval, controlled SQL generation, execution, result validation and business response formatting.

Arabic and English questions pass through the same approved analytical workflow. Follow-up handling preserves the metric, period and entity context when the user continues a previous question. The architecture also supports report-oriented requests where the answer needs a structured analytical output rather than a single sentence.

Supporting technologies

  • SQL Server
  • n8n
  • AI/LLM
  • JavaScript
  • JSON
  • Semantic Layer

03

What changed

The project evidence includes the working Lama interface, bilingual question handling, governed workflow behavior and owner-provided semantic architecture covering entities, approved views, metric definitions, date logic, customer and invoice rules, allowed question families and safe query boundaries.

The case demonstrates an implemented system and an iterative testing process. It does not claim unverified client results, production volume or quantified savings.

Lama demonstrates how enterprise BI can move beyond fixed dashboards toward conversational, context-aware decision support while retaining controlled metric and query logic.

Its practical value is reducing the distance between a business question and a usable analytical answer, while keeping the system explainable, testable and governed.

Discuss an AI-enabled BI solution

Start with the problem and the outcome you need.