Back to case studies

Apps & APIs

Pegasus AI Analytics Copilot & SQL-Safe Query Assistant

AI-guided analytics workspace that helps users ask operational questions, routes requests through controlled tools, and returns structured answers through a SQL-safe decision layer.

FastAPIReactOpenAI APIAzure SQLTool CallingPrompt RoutingAnalytics Copilot

Copilot decision flow

Pegasus AI Analytics Copilot

Question input, prompt routing, SQL-safe tools, structured response

SQL-safe

Guided

Query mode

Curated

Tool layer

Structured

Response format

Mock

Test mode

Question categories

Inventory
Trends
Alerts
KPI detail
Exports

Routed workflow

01

Question

02

Router

03

Tool

04

Safe SQL

05

Answer

InputRouteOutputMode
Show slow-moving inventoryInventory toolTable + summarySafe
What changed this month?Trend toolCards + chartSafe
Explain reorder alertsAlert toolSummarySafe

Response outputs

SummaryCardsTableDebugExport
Copilot
Guided analytics mode
FastAPI
Backend orchestration
React
Operator frontend

Business problem

Business users needed faster answers to operational questions, but direct SQL access was not the right solution. Raw database querying creates risk, inconsistency, and dependency on technical users for every follow-up question.

The challenge was to create a safer analytics experience that could translate business questions into structured actions, return usable answers, and support operational workflows without turning the reporting layer into an uncontrolled query environment.

System built

Built an AI-assisted analytics copilot with a FastAPI backend, a React frontend, and a curated SQL-safe tool layer. The system accepts natural-language questions, routes prompts through controlled tool logic, executes approved analytics actions, and returns structured outputs such as summaries, tables, cards, and debug detail.

Instead of exposing unrestricted querying, the copilot guides the user through a governed analytics path that is more usable for business teams and safer for operational systems.

Routing signals

Signals reviewed

The assistant works best when it can recognize question type, route requests correctly, and pull from the right governed tool path.

User question intent
Prompt category or domain
Selected analytics tool
SQL-safe execution path
Structured output format
Debug and reasoning visibility
Domain-specific prompt handling
Response confidence indicators
Mock mode / local testing support
Export or follow-up readiness

Copilot flow

How it works

01

Ask

The user enters an operational or analytical question in natural language.

The frontend gives users a guided workspace for asking questions without needing to know SQL, schemas, joins, or backend details.

02

Route

The system interprets the request and determines which tool, workflow, or analytics path should handle it.

Prompt routing helps separate inventory questions, trend questions, KPI questions, detail lookups, and other domain-specific analytics paths.

03

Execute Safely

Approved backend logic runs through curated SQL-safe tools instead of unrestricted direct querying.

The backend protects the data layer by using controlled functions and approved tool pathways rather than ad hoc database access.

04

Structure

Results are organized into usable outputs such as cards, tables, summaries, or diagnostic detail.

The response layer turns backend output into business-friendly views that can be scanned, reviewed, exported, or debugged.

05

Respond

The frontend returns a guided answer that is easier for business users to act on and easier for developers to troubleshoot.

The final answer balances usability and transparency by supporting summaries, structured data, and debugging context.

System coordination

What the system coordinates

Prompt routing

Routes incoming questions to the most appropriate analytics path, tool, or domain flow.

Tool registry

Defines the approved functions, utilities, and SQL-safe actions the copilot is allowed to use.

Execution layer

Handles backend processing, structured query actions, and controlled analytics responses.

Response layer

Formats outputs into readable summaries, cards, tables, and debugging views for the user.

Impact signals

What the copilot enabled

SQL-safe tool registry

Domain-specific analytics prompts

Structured answers instead of raw query output

FastAPI backend for orchestration

React interface for operator usability

Mock mode for local testing and iteration

Use cases

Use cases supported

Operational analytics Q&A

Supports business questions that need fast answers from structured operational data.

Guided reporting requests

Helps users request analytics without needing to know where every report, table, or calculation lives.

Domain-specific prompts

Routes questions through purpose-built paths instead of forcing every request into one generic chat flow.

Developer-friendly testing

Mock mode and debug views make it easier to validate behavior locally before wiring into production data.

Structured answer delivery

Returns summaries, tables, cards, and detail views instead of unstructured text-only answers.

Safer SQL alternatives

Creates a governed option for analytics exploration without exposing unrestricted query access.

Why this system matters

A safer path between business questions and data answers.

Pegasus AI Analytics Copilot is designed to bridge the gap between business curiosity and technical control. It gives users a guided interface for asking operational questions, while the backend enforces structure, tool governance, and SQL-safe execution.

The result is an analytics experience that feels more modern for users and more responsible for the systems behind it.

Confidentiality note

Visuals and descriptions are sanitized conceptual representations. They do not expose private company data, customer records, credentials, raw exports, internal pricing, operational screenshots, or proprietary source files.