Designing an Architecture of a Multi-Agentic AI-Powered Virtual Assistant Using LLMs and RAG for a Medical Clinic
Abstract
1. Introduction
- Domain-constrained RAG-based Q&A. We implement a retrieval pipeline that limits the assistant’s knowledge base exclusively to curated medical clinic data, with a response evaluation layer to ensure reliability.
- Lab result interpretation from PDFs. We integrate document parsing and LLM reasoning to analyze patient laboratory reports, extract relevant metrics and provide patient-friendly explanations.
- NL-based appointment management. We develop a dialogue-driven scheduling interface enabling end-to-end appointment handling without manual intervention.
- Agentic orchestration. We propose an agentic framework to dynamically select and chain specialized tools (retrieval, PDF parsing, scheduling) based on the user’s intent.
- Performance evaluation. Benchmarking of the system’s capabilities is provided using metrics for accuracy in simulated patient interaction scenarios.
2. Literature Review
2.1. Previous Works
- (1)
- They emphasize surface-level lexical overlap (n-gram matching) and thus fail to recognize answers that are clinically correct but use different wording, synonyms or paraphrases. In Ref. [13], it is shown that BLEU and ROUGE often fail to penalize critical errors, e.g., misclassifying “benign” vs. “malignant”, even when lexical overlap remains high.
- (2)
- They lack semantic nuance: they miss subtle meaning and often fail to account for the quality of reasoning or how well the answer is supported by evidence, uncertainty expression, partial correctness or adherence to clinical guidelines. Moreover, Ref. [14] highlights that LLMs which score well under BLEU/accuracy often underperform when examined for more demanding facets of medical knowledge (comparison, verification, discrimination). A review of evaluation methods in the medical LLM literature finds that few works reliably include physician ratings or guideline concordance, and those that do report that BLEU/ROUGE often fail to capture what experts consider most important (safety, clarity, appropriateness) [15].
2.2. Research Gap and Our Contribution
3. Research Methodology
4. Results
4.1. Technical Feasibility of the Orchestrator-Based Architecture
- -
- The use of overlapping chunking ensures that contextual meaning is preserved across adjacent passages. As a result, the assistant is able to provide more coherent and accurate answers, maintaining the continuity of medical information that is often spread across lengthy or complex documents.
- -
- The model chosen, when testing with Gemini 2.0 Flash Lite, the performance is poor not only for the main orchestrator agent, but also for the LLM guardrails which are either returning an evaluation that is not making complete sense or it fails to stick to the structured output.
- -
- Prompt engineering, the use of a structured prompt format proves important in guiding the system to produce trustworthy outputs, ensuring both linguistic consistency and domain-appropriate responses. A particularly effective element of this design is the strict requirement that the assistant generate answers exclusively based on the information extracted from the clinic’s website, rather than memory when generating answers. This constraint significantly reduced the risk of hallucinations and reinforced the importance of controlled orchestration in healthcare, where unsupported or fabricated medical information could have serious consequences.
- -
- Testing shows that these strict control mechanisms involve certain trade-offs: while they enhance reliability and ensured adherence to established rules, they sometimes constrain the natural flow of conversation, causing the assistant to appear less adaptable when faced with open-ended or ambiguous queries. This highlights the ongoing challenge of designing prompts that both preserve medical accuracy and provide a smooth, user-friendly conversational experience.
4.2. Evaluation Metrics and Performance Insights
- A vs. B (2.5 RAG vs. 2.5 No RAG): This comparison isolates the effect of retrieval augmentation within the same model generation.
- A vs. C (2.5 RAG vs. 2.0 RAG): This comparison captures the impact of the model version upgrade under identical retrieval settings.
- B vs. C (2.5 No RAG vs. 2.0 RAG): This comparison primarily reflects the differences driven by the model version when RAG is either entirely absent (in the case of B) or present in the older model (C).
4.3. Limitations
5. Conclusions
- (a)
- The study shows that employing a multi-agent architecture is an effective way to balance retrieval, reasoning and safe response generation. By delegating distinct responsibilities, such as knowledge retrieval, report interpretation and scheduling, to specialized agents, the system was able to handle diverse clinical support tasks with greater dependability. Evaluation metrics confirmed that this modular approach reduced risks such as hallucination and insufficient source anchoring and also ensured that outputs remained interpretable and aligned with medical requirements.
- (b)
- The findings highlight strong potential for deploying such assistants in real clinical environments, provided robust safeguards are in place. Human oversight remains essential to validate outputs in complex or ambiguous cases, while disclaimers ensure that patients clearly understand the assistant’s supportive, not diagnostic, role. Continuous monitoring through evaluation dashboards and automated checks is equally important for maintaining trust, accuracy and clinical relevance over time.
- (c)
- Several limitations need to be addressed before large-scale deployment. Domain adaptation proved difficult, with subtle clinical nuances occasionally oversimplified. Appointment scheduling required precise entity extraction and rigid formatting, which was vulnerable to ambiguous phrasing despite the use of strict prompting. Furthermore, the system’s accuracy depends on periodic re-scraping and updating of knowledge sources, creating a maintenance burden that threatens scalability without automated update mechanisms.
- (d)
- The assistant illustrates how AI can strengthen patient communication and streamline administrative processes, offering tangible benefits in clinical workflows. At the same time, it reinforces the necessity of ethical safeguards, transparent design and continuous evaluation to ensure safe integration into healthcare contexts. Importantly, such systems should be understood as augmenting professional practice rather than replacing it, providing reliable support in routine tasks while leaving clinical responsibility firmly with medical experts.
Author Contributions
Funding
Institutional Review Board Statement
Informed Consent Statement
Data Availability Statement
Acknowledgments
Conflicts of Interest
References
- Zaman, G.; Radu, A.C.; Răpan, I.; Berghea, F. New wave of disruptive technologies in the healthcare system. Econ. Comput. Econ. Cybern. Stud. Res. 2021, 55, 117–133. [Google Scholar] [CrossRef] [Scilit]
- Sezgin, E. Redefining Virtual Assistants in Health Care: The Future with Large Language Models. J. Med. Internet Res. 2024, 26, e53225. [Google Scholar] [CrossRef] [Scilit]
- Al Kuwaiti, A.; Nazer, K.; Al-Reedy, A.; Al-Shehri, S.; Al-Muhanna, A.; Subbarayalu, A.V.; Al Muhanna, D.; Al-Muhanna, F.A. A Review of the Role of Artificial Intelligence in Healthcare. J. Pers. Med. 2023, 13, 951. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Chow, J.C.L.; Li, K. Developing Effective Frameworks for Large Language Model–Based Medical Chatbots: Insights from Radiotherapy Education with ChatGPT. JMIR Cancer 2025, 11, e66633. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Rau, S.; Rau, A.; Nattenmüller, J.; Fink, A.; Bamberg, F.; Reisert, M.; Russe, M.F. A retrieval-augmented chatbot based on GPT-4 provides appropriate differential diagnosis in gastrointestinal radiology: A proof of concept study. Eur. Radiol. Exp. 2024, 8, 60. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Steybe, D.; Poxleitner, P.; Aljohani, S.; Herlofson, B.B.; Nicolatou-Galitis, O.; Patel, V.; Fedele, S.; Kwon, T.-G.; Fusco, V.; Pichardo, S.E.; et al. Evaluation of a context-aware chatbot using retrieval-augmented generation for answering clinical questions on medication-related osteonecrosis of the jaw. J. Cranio-Maxillofac. Surg. 2025, 53, 355–360. [Google Scholar] [CrossRef] [Scilit]
- Bora, A.; Cuayáhuitl, H. Systematic Analysis of Retrieval-Augmented Generation-Based LLMs for Medical Chatbot Applications. Mach. Learn. Knowl. Extr. 2024, 6, 2355–2374. [Google Scholar] [CrossRef] [Scilit]
- Borkowski, A. Multiagent AI Systems in Health Care: Envisioning Next-Generation Intelligence. Fed. Pract. 2025, 42, 188. [Google Scholar] [CrossRef] [Scilit]
- Wu, J.; Zhu, J.; Qi, Y.; Chen, J.; Xu, M.; Menolascina, F.; Grau, V. Medical Graph RAG: Towards Safe Medical Large Language Model via Graph Retrieval-Augmented Generation. arXiv 2024, arXiv:2408.04187. [Google Scholar] [CrossRef] [Scilit]
- Amirshahi, S.; Bigdeli, A.; Clarke, C.L.A.; Ghenai, A. Evaluating the Robustness of Retrieval-Augmented Generation to Adversarial Evidence in the Health Domain. arXiv 2025, arXiv:2509.03787. [Google Scholar] [CrossRef] [Scilit]
- Busch, F.; Kaibel, L.; Nguyen, H.; Lemke, T.; Ziegelmayer, S.; Graf, M.; Marka, A.W.; Endrös, L.; Prucker, P.; Spitzl, D.; et al. Evaluation of a Retrieval-Augmented Generation-Powered Chatbot for Pre-CT Informed Consent: A Prospective Comparative Study. J. Imaging Inform. Med. 2025, 38, 4312–4323. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Dong, W.; Shen, S.; Han, Y.; Tan, T.; Wu, J.; Xu, H. Generative Models in Medical Visual Question Answering: A Survey. Appl. Sci. 2025, 15, 2983. [Google Scholar] [CrossRef] [Scilit]
- Zhou, Y.; Liu, X.; Ning, C.; Wu, J. MultifacetEval: Multifaceted Evaluation to Probe LLMs in Mastering Medical Knowledge. arXiv 2024, arXiv:2406.02919. [Google Scholar] [CrossRef] [Scilit]
- Lee, J.; Park, S.; Shin, J.; Cho, B. Analyzing evaluation methods for large language models in the medical field: A scoping review. BMC Med. Informatics Decis. Mak. 2024, 24, 366. [Google Scholar] [CrossRef] [Scilit]
- Ho, X.; Huang, J.; Boudin, F.; Aizawa, A. LLM-as-a-Judge: Reassessing the Performance of LLMs in Extractive QA. arXiv 2025, arXiv:2504.11972. [Google Scholar] [CrossRef] [Scilit]
- Zhang, M.; Shen, Y.; Li, Z.; Sha, H.; Hu, B.; Wang, Y.; Huang, C.; Liu, S.; Tong, J.; Jiang, C.; et al. LLMEval-Med: A Real-world Clinical Benchmark for Medical LLMs with Physician Validation. arXiv 2025, arXiv:2506.04078. [Google Scholar] [CrossRef] [Scilit]
- LASA Team; Xu, W.; Chan, H.P.; Li, L.; Aljunied, M.; Yuan, R.; Wang, J.; Xiao, C.; Chen, G.; Liu, C. Lingshu: A Generalist Foundation Model for Unified Multimodal Medical Understanding and Reasoning. arXiv 2025, arXiv:2506.07044. [Google Scholar] [CrossRef] [Scilit]
- Kim, Y.; Jeong, H.; Park, C.; Park, E.; Zhang, H.; Liu, X.; Lee, H.; McDuff, D.; Ghassemi, M.; Breazeal, C. Tiered Agentic Oversight: A Hierarchical Multi-Agent System for AI Safety in Healthcare. arXiv 2025, arXiv:2506.12482. [Google Scholar] [CrossRef] [Scilit]
- Gorenshtein, A.; Omar, M.; Glicksberg, B.S.; Nadkarni, G.N.; Klang, E. AI Agents in Clinical Medicine: A Systematic Review. medRxiv 2025. [Google Scholar] [CrossRef] [Scilit]
- Nweke, I.P.; Ogadah, C.O.; Koshechkin, K.; Oluwasegun, P.M. Multi-Agent AI Systems in Healthcare: A Systematic Review Enhancing Clinical Decision-Making. Asian J. Med. Princ. Clin. Pract. 2025, 8, 273–285. [Google Scholar] [CrossRef] [Scilit]
- Li, J.; Zhou, Z.; Lyu, H.; Wang, Z. Large language models-powered clinical decision support: Enhancing or replacing human expertise? Intell. Med. 2025, 5, 1–4. [Google Scholar] [CrossRef] [Scilit]
- Zhao, X.; Liu, S.; Yang, S.-Y.; Miao, C. MedRAG: Enhancing Retrieval-augmented Generation with Knowledge Graph-Elicited Reasoning for Healthcare Copilot. arXiv 2025, arXiv:2502.04413. [Google Scholar] [CrossRef] [Scilit]
- Li, X.; Chen, W.; Ren, H.; Oh, Y.; Cao, Y.; Sharaf, E.; Luo, J.; Zhou, H.-Y.; Sun, L.; Liu, T.; et al. Bridging Medical Imaging and Reports: Learning Radiologist’s Nuances via Fine-Grained Multi-Modal Alignment. Res. Sq. 2025. preprint. [Google Scholar] [CrossRef] [Scilit]
- Krones, F.; Marikkar, U.; Parsons, G.; Szmul, A.; Mahdi, A. Review of multimodal machine learning approaches in healthcare. Inf. Fusion 2025, 114, 102690. [Google Scholar] [CrossRef] [Scilit]
- Singhal, K.; Azizi, S.; Tu, T.; Mahdavi, S.S.; Wei, J.; Chung, H.W.; Scales, N.; Tanwani, A.; Cole-Lewis, H.; Pfohl, S.; et al. Large Language Models Encode Clinical Knowledge. arXiv 2022, arXiv:2212.13138. [Google Scholar] [CrossRef] [Scilit]
- Reimers, N.; Gurevych, I. Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks. arXiv 2019, arXiv:1908.10084. [Google Scholar] [CrossRef] [Scilit]











| Step | Description |
|---|---|
| Step 1: System design |
|
| Step 2: Data collection and preprocessing | The second step involves collecting and preparing the knowledge base that supports the chatbot’s responses. Since the chatbot will be used to support a medical clinic, the data sources include medical articles, laboratory test descriptions and information on medical conditions extracted from the clinic’s website. The clinic’s website contains scientific articles written in Romanian, posted in an official capacity by the clinic, with the aim to respond to patient’s questions or inform on specific topics. The appointment schedule was built by extracting the names and the focus area of real doctors from the website, information publicly available which was later used to create the appointments on a mocked availability. The following stages are defined:
|
| Step 3: Implementation | The implementation also follows several stages:
# Build the LLM agent chain with tools, memory and output parsing llm_chain = LLMChain(llm = llm, prompt = prompt_custom) agent = ZeroShotAgent(llm_chain = llm_chain, tools = tools, verbose = True) output_parser = OutputFixingParser.from_llm(llm, parser = StrOutputParser()) agent_executor = AgentExecutor.from_agent_and_tools( agent = agent, tools = tools, memory = memory, handle_parsing_errors = True, return_intermediate_steps = True, verbose = True, output_parser = output_parser) # Set up Streamlit callbacks for real-time interaction callback_handler = StreamlitCallbackHandler(st.container(), expand_new_thoughts = False) config = RunnableConfig(callbacks = [callback_handler]) # Run the agent and process the final output response = agent_executor.invoke({“input”: prompt}, config = config) last_output = extract_last_tool_output(response) if last_output: response_text = clean_response(last_output) elif response and “output” in response: response_text = clean_response(response.get(“output”)) if response else None |
| Step 4: Prompt engineering | The orchestration relies on a zero-shot reasoning approach, which allows the agent to respond to user queries without requiring pre-defined examples for each case. The model used for all the prompts is Gemini 2.5 Flash, released by Google. While the choice of model is important to the performance of the system, the design of the prompts ultimately guides the direction of the conversation. Prompts are very important in this use case and they are used not only for task classification but also for the evaluation of responses through an LLM-as-a-judge mechanism that generates metrics on answer quality. Each model presents specific characteristics and as such, prompt engineering requires iterative testing and refinement. Despite the existence of general guidelines, this process is not strictly rule-based but rather experimental, involving continuous validation across diverse scenarios. As a best practice, the main prompt includes guidance via several structured elements:
**Role:** You are an advanced AI assistant agent for a medical clinic. **Task:** Your primary goal is to accurately understand the user’s current request, **considering the ongoing conversation stored in {chat_history}**, and select the single most appropriate tool to fulfill it. You must then use the tool’s output to formulate a helpful, human-readable final answer. **Available Tools & Selection Priority:** … **Tool Selection Logic:** … **CRITICAL FORMATTING RULES:** 1. You **MUST** strictly follow the Thought/Action/Action Input/Observation sequence. 2. **EVERY** ‘Thought:’ **MUST** be immediately followed by an ‘Action:’ and ‘Action Input:’. **NO EXCEPTIONS**, except for the final ‘Thought:’ before the ‘Final Answer:’. 3. **ALWAYS** use a tool first. Do **NOT** answer from memory. 4. Use **plain text only** for SQL queries in ‘Action Input:’. **NEVER** use markdown, backticks (′), or code blocks. **FINAL ANSWER FORMATTING RULES:** 1. Format the ‘Final Answer:’ clearly and concisely for the user. 2. Use bullet points (‘-’) for lists (e.g., appointments, doctors, services). 3. Appointment details in the final answer should ideally include: Date, Time, Doctor Name, Service Name, Location Name. Patient name might be omitted if context implies it’s the user asking about their own appointments. 4. Explanations from ‘retrieval_qa’ should be informative but **always include a disclaimer recommending consultation with a healthcare professional** for definitive medical advice or diagnosis. **Previous Conversation:** {chat_history} **(Now, begin processing the latest input below based on the history and your rules)** |
| Step 5: Assessment | The evaluation of the proposed system is conducted through an Evaluation Dashboard, designed to monitor, log and analyze chatbot conversations by providing filtering, visualization and analytic functionalities that facilitated both qualitative and quantitative assessments. The assitant provides: (1) Integration of five qualitative metrics, implemented using the “LLM-as-a-judge” approach. Each generated answer is automatically evaluated and visualized on the dashboard, with scores distributed across five possible levels. The metrics included:
(3) Sentiment analysis of both questions and responses-using an LLM-based judgment framework, each interaction is labeled with a sentiment category, scored numerically and accompanied by an explanatory rationale from the model. The results are displayed in tabular format with four columns: User Question, Sentiment Label, Score and Model Justification. This analysis offered deeper insights into the emotional dynamics of conversations, which can be essential for patient-centered applications in healthcare. (4) Standard NLP metrics-to complement qualitative measures, standard benchmarking metrics are applied to interactions where ground truth answers are available. These include:
|
| English | Romanian | Judge |
|---|---|---|
| Are benign brain tumors serious? | Sunt tumorile cerebrale benigne grave? | Verdict: OK Explanation: Corrected Romanian: - |
| Are bone cysts serious? | Sunt chisturile osoase grave? | Verdict: OK Explanation: Corrected Romanian: - |
| Are cold sores a herpes virus? | **Este herpesul labial (cold sores) un virus herpetic?** | Verdict: ERROR Explanation: The parenthetical “(cold sores)” is redundant and unnecessary, making the translation less natural and professional. “Herpesul labial” is the standard and well-understood term in Romanian for cold sores. Corrected Romanian: Este herpesul labial un virus herpetic? |
| Are floaters in eye serious? | **Sunt corpi flotanți în ochi gravi?** | Verdict: ERROR Explanation: The term “corpi flotanți” is technically correct but less idiomatic for “floaters” in a patient’s question; “musculițe zburătoare” is the more common and natural term. Additionally, “gravi” (masculine plural) refers directly to the “corpi,” whereas “grave” (feminine plural) would be more appropriate when referring to “musculițele zburătoare” and the implied seriousness of the condition. Corrected Romanian: Sunt grave musculițele zburătoare din ochi? |
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2026 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license.
Share and Cite
Tanasă, A.-M.; Oprea, S.-V.; Bâra, A. Designing an Architecture of a Multi-Agentic AI-Powered Virtual Assistant Using LLMs and RAG for a Medical Clinic. Electronics 2026, 15, 334. https://doi.org/10.3390/electronics15020334
Tanasă A-M, Oprea S-V, Bâra A. Designing an Architecture of a Multi-Agentic AI-Powered Virtual Assistant Using LLMs and RAG for a Medical Clinic. Electronics. 2026; 15(2):334. https://doi.org/10.3390/electronics15020334
Chicago/Turabian StyleTanasă, Andreea-Maria, Simona-Vasilica Oprea, and Adela Bâra. 2026. "Designing an Architecture of a Multi-Agentic AI-Powered Virtual Assistant Using LLMs and RAG for a Medical Clinic" Electronics 15, no. 2: 334. https://doi.org/10.3390/electronics15020334
APA StyleTanasă, A.-M., Oprea, S.-V., & Bâra, A. (2026). Designing an Architecture of a Multi-Agentic AI-Powered Virtual Assistant Using LLMs and RAG for a Medical Clinic. Electronics, 15(2), 334. https://doi.org/10.3390/electronics15020334

