Articles
An Explainable Machine Learning Framework for Heart Disease Risk Prediction Using Agentic RAG


This work is licensed under a Creative Commons Attribution 4.0 International License.
Copyright
The authors shall retain the copyright of their work but allow the Publisher to publish, copy, distribute, and convey the work.
License
Journal of Artificial Intelligence and Science Communication (JAISC) publishes accepted manuscripts under Creative Commons Attribution 4.0 International (CC BY 4.0). Authors who submit their papers for publication by Journal of Artificial Intelligence and Science Communication (JAISC) agree to have the CC BY 4.0 license applied to their work, and that anyone is allowed to reuse the article or part of it free of charge for any purpose, including commercial use. As long as the author and original source is properly cited, anyone may copy, redistribute, reuse and transform the content.
Received: 26 July 2025; Revised: 8 September 2025; Accepted: 12 September 2025; Published: 10 October 2025
Heart disease is a leading cause of global mortality, making early and reliable risk assessment critical for prevention and clinical decision support. Traditional machine learning models often provide high predictive performance but lack transparency in explaining their decisions. Therefore, there is a growing need for intelligent systems that combine predictive accuracy with explainable outputs suitable for real-world healthcare applications. This study presents a computer-based system that helps estimate a person’s risk of heart disease using common health information. The system also explains the results in simple, easy-to-understand language by using relevant medical knowledge. The framework combines a trained machine learning model for heart disease risk prediction with a Large Language Model Meta AI (LLaMA)-based large language model enhanced using an agentic Retrieval-Augmented Generation (RAG) mechanism. The RAG component retrieves relevant clinical context to ground explanations, improving clarity, consistency, and safety. Experimental evaluation shows that the system provides accurate risk predictions, clear and contextual explanations, and a smooth user experience. Agentic RAG improves explanation relevance and grounding, while LangGraph enhances robustness, fault tolerance, and execution traceability compared to linear pipelines. Experimental evaluation demonstrates strong predictive performance of the proposed model, achieving an accuracy of 88%, precision of 85%, recall of 82%, and an F1-score of 83.5%, while delivering clear, knowledge-grounded explanations through the integration of Agentic RAG and LangGraph orchestration. The results demonstrate the effectiveness of combining machine learning, agentic RAG-enabled large language models develop trustworthy and deployable healthcare decision-support systems for cardiovascular risk assessment.
Keywords:
Heart Disease Agentic RAG LLaMA LangGraph Explainable AIReferences
- Hemida, M.F.; Saghir, M.; Ibrahim, A.A.; et al. Temporal trends in mortality involving atrial fibrillation and rheumatic heart disease: A 25-year nationwide analysis. Front. Cardiovasc. Med. 2025, 12, 1687555.
- Breiman, L. Random forests. Mach. Learn. 2001, 45, 5–32.
- Lundberg, S.M.; Lee, S.-I. A unified approach to interpreting model predictions. In Proceedings of the 31st Conference on Neural Information Processing Systems (NIPS 2017), Long Beach, CA, USA, 4–9 December 2017.
- Saraswat, D.; Bhattacharya, P.; Verma, A.; et al. Explainable AI for Healthcare 5.0: Opportunities and challenges. IEEE Access 2022, 10, 84486–84517. DOI: https://doi.org/10.1109/ACCESS.2022.3197671
- Kalasampath, K.; Spoorthi, K.N.; Sajeev, S.; et al. A literature review on applications of explainable artificial intelligence (XAI). IEEE Access 2025, 13, 41111–41140. DOI: https://doi.org/10.1109/ACCESS.2025.3546681
- Mumuni, F.; Mumuni, A. Explainable artificial intelligence (XAI): From inherent explainability to large language models. arXiv preprint 2025, arXiv:2501.09967.
- Xie, Q.; Chen, Q.; Chen, A.; et al. Medical foundation large language models for comprehensive text analysis and beyond. npj Digit. Med. 2025, 8, 141.
- Matarazzo, A.; Torlone, R. A survey on large language models with some insights on their capabilities and limitations. arXiv preprint 2025, arXiv:2501.04040.
- Touvron, H.; Lavril, T.; Izacard, G.; et al. LLaMA: Open and efficient foundation language models. arXiv preprint 2023, arXiv:2302.13971.
- Said, A. On explaining recommendations with large language models: A review. Front. Big Data 2025, 7, 1505284.
- Singh, A.; Ehtesham, A.; Kumar, S.; et al. Agentic retrieval-augmented generation: A survey on agentic RAG. arXiv preprint 2025, arXiv:2501.09136.
- Li, Y.; Zhang, W.; Yang, Y.; et al. Towards agentic RAG with deep reasoning: A survey of RAG-reasoning systems in LLMs. arXiv preprint 2025, arXiv:2507.09477.
- Xu, G.; Li, X.; Chen, Y.; et al. A comprehensive survey of agentic AI in healthcare. J. Biomed. Inform. 2025, 179, 105045.
- Noviandy, T.R.; Idroes, G.M.; Hardi, I. Integrating explainable artificial intelligence and light gradient boosting machine for glioma grading. Inform. Health 2025, 2, 1–8.
- Shortliffe, E.H.; Sepúlveda, M.J. Clinical decision support in the era of AI. J. Am. Med. Assoc. 2018, 320, 2199–2200.
- Sapkota, R.; Shrestha, R.; Rijal, M.; et al. LangChain vs. LangGraph vs. LangSmith: Taxonomies of agentic AI toolchains for end-to-end orchestration. TechRxiv preprint 2025, in press.
- Mandulapalli, S.; Hernandez, E.; Jordan, W.; et al. Development of agentic workflows with LangGraph for software development life cycle automation. In Proceedings of the 10th North American Conference on Industrial Engineering and Operations Management, Orlando, FL, USA, 17–19 June 2025; pp. 45–54.
- Malakouti, S.M. Leveraging SHapley additive explanations (SHAP) and fuzzy logic for efficient rainfall forecasts. Sci. Rep. 2025, 15, 36499.
- Napa, K.K.; Govindarajan, R.; Sathya, S.; et al. Comparative analysis of explainable machine learning models for cardiovascular risk stratification using clinical data and shapley additive explanations. Intell.-Based Med. 2025, 12, 100286.
- de Menezes-Júnior, L.A.A.; Silva de Moura, S.; Cardoso Carraro, J.C.; et al. Framingham score adapted: A valid alternative for estimating cardiovascular risk in epidemiological studies. BMC Cardiovasc. Disord. 2025, 25, 187.
- Mineeva, O.; Li, C.; Giulianini, F.; et al. Development and validation of novel residual risk scores for patients with ASCVD. JACC Adv. 2025, 4, 102162.
- Li, Y.; Sun, Q.; Akman, A.; et al. Explainable AI for healthcare. In Handbook on Smart Health; SAGE Publications: Thousand Oaks, CA, USA, 2025; pp. 632–652.
- Noor, A.A.; Manzoor, A.; Qureshi, M.D.M.; et al. Unveiling explainable AI in healthcare: Current trends, challenges, and future directions. WIREs Data Min. Knowl. Discov. 2025, 15, e70018.
- Carriero, A.; de Hond, A.; Cappers, B.; et al. Explainable AI in healthcare: To explain, to predict, or to describe? Diagn. Progn. Res. 2025, 9, 29.
- van Leersum, C.M.; Maathuis, C. Human-centred explainable AI decision-making in healthcare. J. Responsible Technol. 2025, 21, 100108.
- Hassan, R.; Nguyen, N.; Finserås, S.R.; et al. Unlocking the black box: Enhancing human-AI collaboration in high-stakes healthcare scenarios through explainable AI. Technol. Forecast. Soc. Change 2025, 219, 124265.
- Alkhanbouli, R.; Almadhaani, H.M.A.; Alhosani, F.; et al. The role of explainable artificial intelligence in disease prediction: A systematic literature review and future research directions. BMC Med. Inform. Decis. Mak. 2025, 25, 110.
- Zhang, W.; Zeng, L.; Xiao, Y.; et al. AgentOrchestra: Orchestrating Multi-Agent Intelligence with the Tool-Environment-Agent (TEA) Protocol. arXiv preprint 2025, arXiv:2506.12508.
- Pelluru, K. LangChain and LangGraph in production: Architectures for multi-agent LLM systems. J. Data Digit. Innov. 2025, 2, 1–9.
- Sharma, S.; Singh, M.; McDaid, L.; et al. XAI-based data visualization in multimodal medical data. bioRxiv preprint 2025. DOI: https://doi.org/10.1101/2025.07.11.664302

Download
