QueryVault — AI-Powered Research with Verifiable Financial Accountability
Ask in natural language. Validate the SQL. Know the cost. Approve the execution. Verify the payment.
QueryVault is an AI-assisted logistics analytics platform that connects natural-language research with controlled SQL execution, deterministic pricing, explicit approval, and PayPal Sandbox financial settlement.
Inspiration
AI has made it easier to ask questions about complex data. But generating a SQL query is only the beginning.
What happens if an AI proposes an unsafe query? How does a user know what execution will cost? Who authorizes the expense? And how can the resulting payment be reconciled with the actual work performed?
These questions inspired QueryVault.
We wanted to explore what happens when an AI-powered research system treats security, financial authorization, and accountability as first-class components, rather than adding them after execution.
The result is a platform designed around a simple principle:
An AI-generated query should never automatically become an authorized financial action.
What it does
QueryVault allows users to explore a synthetic logistics dataset through natural-language questions.
Instead of requiring users to write SQL manually, it uses an AI-assisted research workflow with seven visible stages:
Question → Proposal → Validation → Quote → Acceptance → Execution → Result
A user submits a question, and an AI model can propose a corresponding SQL query. The proposal then passes through a SQLGlot-based security firewall and restricted PostgreSQL planning checks.
Before execution, QueryVault calculates a deterministic price and presents the proposed operation for explicit approval.
Once approved, a permitted query executes using restricted, read-only database access. The user receives the actual result alongside an inspectable record of the decision process.
The system also supports refusal when a query violates security rules or financial constraints.
PayPal integration
QueryVault connects this research workflow to PayPal's developer platform through a separately restricted local financial workflow.
The PayPal Sandbox integration supports payment authorization, internal query-charge accounting, final capture, and reconciliation.
In verified Sandbox testing, QueryVault recorded two query charges of $0.70 and $0.35, followed by a successfully completed $1.05 capture against a previously authorized $20 Sandbox payment.
The reconciliation recorded zero discrepancy and no outstanding internal reservations.
This creates a traceable relationship between approved research activity and its eventual payment settlement.
For safe public demonstrations, QueryVault also provides an isolated guest mode with a virtual $3 research allowance. Virtual charges are not real PayPal payments, and public guests have no access to the operator's payment authority.
How we built it
QueryVault combines a React and TypeScript frontend with a Python FastAPI backend and PostgreSQL database.
AI research: Groq-hosted GPT-OSS-20B generates SQL proposals from natural-language questions.
SQL security: SQLGlot parses and validates proposed statements, while restricted PostgreSQL permissions and planning checks provide additional safeguards.
Pricing and approval: A deterministic quote is tied to the proposed operation. Explicit acceptance is required before an eligible paid execution.
Financial integration: PayPal Sandbox APIs support the authorization, capture, and reconciliation workflow.
Data: The demonstrator uses synthetic logistics data, including 600 shipment records, rather than confidential customer information.
Deployment and reproducibility: Docker, Docker Compose, database migrations, automated tests, and documented local setup procedures support independent evaluation.
The frontend presents the research lifecycle through an interactive Proof Engine and provides separate buyer research and seller operations experiences.
Challenges we faced
Securing AI-generated SQL
The main challenge was ensuring that a plausible AI-generated query could not bypass database restrictions.
We addressed this with independent SQL validation, restricted read-only database access, and explicit refusal behavior.
Making AI decisions financially accountable
A quote alone is not sufficient authorization. We needed to connect the approved operation to the eventual execution and financial record while avoiding duplicate or unauthorized actions.
This led us to deterministic pricing, approval-bound execution, and reconciliation controls.
Separating demonstrations from payment authority
A public demonstration must be interactive without exposing credentials, privileged records, or real payment operations.
We separated the guest research environment from the restricted local operator workflow, using synthetic data, quotas, and virtual spending controls.
Building a complete experience
We wanted the result to feel like a usable product, not just a collection of API endpoints.
The interface therefore communicates the actual system state, including validation, approval, execution, refusal, and financial evidence.
Accomplishments we're proud of
Verified backend functionality: The final audit passed 213 backend tests and 26 additional subtests against isolated PostgreSQL 18.
Security evaluation: The evaluation accepted 29 legitimate SQL cases, rejected 31 adversarial cases, and matched 20 out of 20 known answers.
Real database execution: The guest demonstration returned the actual result of 600 synthetic shipments through the restricted backend.
PayPal Sandbox settlement: A completed $1.05 capture was independently verified and reconciled to the two recorded query charges.
Reproducible source: The final audited source candidate was built and run from a clean Docker/Linux extraction.
Product experience: QueryVault includes an interactive seven-stage Proof Engine, buyer research workflows, seller financial views, responsive layouts, and visible safety decisions.
These are measured prototype results, not claims of universal accuracy or production certification.
What we learned
Building QueryVault reinforced an important engineering lesson: reliable AI systems need more than accurate model output.
They need boundaries between proposals and execution, transparent decisions, explicit authorization, recoverable state, and evidence that users can inspect.
We also learned the value of using actual payment and database verification instead of relying entirely on mocked demonstrations.
What's next
Our future direction is to extend the prototype with broader data connectors, stronger operational monitoring, configurable organizational budgets, additional authorization policies, and more comprehensive evaluations.
A production deployment would also require further infrastructure hardening, live service monitoring, and operational security review.
Demonstration and source code
GitHub: https://github.com/sujith-sakthivel04/QueryVault
The repository contains source code, an open-source license, synthetic data, automated tests, and local reproduction instructions.
The demonstration video shows genuine application validation, approval, and PostgreSQL execution using a clearly labeled simulated AI provider. The PayPal Sandbox settlement segment presents previously verified historical evidence; it does not initiate a new payment.
QueryVault demonstrates a direction for AI-powered commerce in which research is not only intelligent, but also controlled, priced, authorized, and financially verifiable.
Built With
- docker
- docker-compose
- fastapi
- gpt-oss-20b
- groq
- paypal
- paypal-sandbox
- postgresql
- pytest
- python
- react
- sql
- sqlglot
- typescript
- vite