A Multi-Agent Self-Healing Framework for Enterprise Text-to-SQL with Hallucination Risk Prediction and Explainable Query Generation

Authors

  • Bharath Kumar N Senior Software Engineer, IBM
  • T L Manasa Faculty of Engineering & Technology, Department of Electrical & Electronics Engineering, Mangalayatan University, Beswan, Aligarh, UP, India

DOI:

https://doi.org/10.70917/ijcisim-2026-3933

Keywords:

Text-to-SQL, Large Language Models, Multi-Agent Systems, Self-Healing, Hallucination Detection, Explainable AI, Enterprise Analytics, Query Generation, Uncertainty Estimation, Natural Language Interfaces to Databases

Abstract

Despite the success of natural-language interfaces (NLIs) to relational databases, which has been growing over the last few years, and the advent of the large language model (LLM) revolution, production Text-to-SQL (Text2SQL) systems continue to fail silently when generating a syntactically correct query that is semantically incorrect against a poorly documented schema containing a significant amount of data. This paper presents a multi-agent self-healing framework, which integrates iterative query repair and an explicit hallucination-risk predictor, along with an explanation layer that allows all generated queries to be auditable prior to execution. The framework consists of five cooperating agents: Schema Retrieval agent, Query Planner, SQL Generator, Execution-Grounded Validator and Hallucination Risk Estimator, and can be orchestrated by launching a bounded self-healing loop when there is a perceived high risk of hallucinated joins, columns, and filter values. The Hallucination Risk Estimator is light, supervised and fast to predict, before running a query, the probability that its generated query will be hallucinatory, that is, refer to an inexistent table, column, or relationship in a schema, using a token-level log-probability features and a semantic-entropy sampling from multiple candidate queries with schema-grounding confidence scores. An Explainability agent then turns the accepted query into an explanation, in natural language, of the reasons for the query and a link to the schema and provenance trace, which brings the trace back to the phrase and schema element responsible for creating the query. We evaluate the framework using a protocol derived from previously established enterprise-style benchmarks that use anonymized data-warehouse schemas from the finance, retail, and logistics domains and contrast it with single-pass prompting and executing-only self-correction as well as a multi-agent benchmark without a risk gate. The proposed architecture gains more accuracy in terms of execution, is much less likely to produce hallucinated queries that are not detected when users interact with an enterprise analytics dashboard, creates explanations that reviewers find more useful than static schema dumps, and does not generate explanations that require an unnecessarily long time to repair.  

Downloads

Download data is not yet available.

Downloads

Published

2026-07-29

How to Cite

Bharath Kumar N, & T L Manasa. (2026). A Multi-Agent Self-Healing Framework for Enterprise Text-to-SQL with Hallucination Risk Prediction and Explainable Query Generation. International Journal of Computer Information Systems and Industrial Management Applications, 18(12s), 596–603. https://doi.org/10.70917/ijcisim-2026-3933

Issue

Section

Original Articles