This study did not involve the recruitment of human participants, access to identifiable patient records, or experiments involving animals. The protocol was developed and evaluated exclusively using publicly available and fully anonymized datasets for methodological validation. No personal health information was accessed or processed. Therefore, approval from an Institutional Review Board (IRB) or Research Ethics Committee was not required. The protocol was developed in accordance with applicable data protection principles, including the Brazilian General Data Protection Law (LGPD), to support future applications involving clinical data.
Dataset selection and preprocessing
The proposed protocol was evaluated using publicly available and fully anonymized clinical datasets comprising structured Electronic Health Records (EHRs), clinical question-answering data, and medical imaging datasets for methodological validation. Before integration into the platform, the datasets underwent standardized preprocessing procedures, including data normalization, removal of inconsistent or incomplete records, mapping to HL7 FHIR resources, text cleaning, segmentation into retrieval chunks, and embedding generation for vector indexing. These preprocessing steps ensured semantic consistency across heterogeneous data sources, facilitating interoperability and enabling the reproducibility of the proposed workflow while maintaining compliance with applicable data privacy principles.
The datasets were obtained from publicly available benchmark repositories commonly used in artificial intelligence and digital health research. They were selected to represent heterogeneous clinical information, including structured Electronic Health Records (EHRs), unstructured clinical narratives, clinical question-answering tasks, and medical imaging metadata. Rather than evaluating a specific clinical cohort, the protocol focuses on demonstrating a reproducible implementation workflow that can be adapted to different healthcare datasets. The diversity of these benchmark datasets enables validation of the interoperability pipeline, Retrieval-Augmented Generation (RAG), and multi-agent reasoning framework across multiple clinical data modalities.
Experimental environment configuration
The experimental environment was configured to evaluate the interoperable platform under controlled and reproducible conditions. The architecture comprises data ingestion modules, interoperability layers, large language models (LLMs), and evaluation components organized into a single processing pipeline for medical data analysis. Figure 1 illustrates the complete workflow, from clinical data ingestion to the generation of diagnostic outputs.

Figure 1: Overall system workflow illustrating the processing pipeline from raw clinical data to disease status output. The process begins with Electronic Health Records (EHR) ingestion, followed by data filtering and preprocessing to extract disease-sensitive information. A structured prompt design stage integrates expert knowledge, disease definitions, and hyperparameters, enabling effective interaction with the Large Language Model (LLM). The LLM performs text inference to generate context-aware responses, which are subsequently evaluated through clinical rules to determine the final disease status. The workflow highlights the integration of data preprocessing, knowledge-driven prompting, and AI-based inference to support clinical decision-making. Please click here to view a larger version of this figure.
Healthcare interoperability architecture
The backend infrastructure adopts a modular architecture based on RESTful APIs to support communication among the platform components (Figure 2). This architecture accommodates heterogeneous clinical information, including structured Electronic Health Records (EHRs), physician notes, and metadata derived from medical imaging systems. Because these data originate from multiple sources and formats, interoperability is achieved through standardized data models, particularly the Fast Healthcare Interoperability Resources (FHIR) framework15,16,17..The adoption of FHIR supports structured information exchange while preserving scalability and flexibility in distributed healthcare environments. HL7-based communication mechanisms were also incorporated to facilitate integration with legacy clinical systems, which remain widely used in healthcare institutions16,17.

Figure 2: System architecture of the proposed interoperable platform. The web interface communicates with the backend through a Flask API using HTTP POST/GET requests. The API manages routing, query processing, and interaction with both structured and unstructured data sources. A MySQL database stores structured clinical data, while a FAISS-based vector store supports similarity search for retrieval operations. The LLaMA-based pipeline processes textual inputs and generates responses using vector representations, enabling Retrieval-Augmented Generation (RAG). The architecture highlights the integration of web services, database management, vector retrieval, and large language model inference in a unified system. Please click here to view a larger version of this figure.
Multi-agent workflow configuration
The multi-agent architecture is organized into specialized functional agents responsible for distinct stages of the workflow. A preprocessing agent performs data normalization and FHIR mapping, followed by a retrieval agent responsible for semantic search within the vector database. A reasoning agent integrates the retrieved context with the LLM to generate responses, while a validation agent verifies output consistency and formatting before the final response is returned. Agent coordination follows a sequential orchestration strategy in which the output of each agent serves as the input for the subsequent stage, ensuring a reproducible and modular implementation.
Clinical data integration
The data integration layer aggregates information from multiple clinical sources and prepares it for downstream processing. Preprocessing includes data normalization, tokenization, and entity alignment to improve semantic consistency across heterogeneous datasets. Because clinical information varies in structure and quality, these operations help reduce noise and facilitate interaction with AI models. Structured mapping strategies were also applied to harmonize different data formats and maintain compatibility with the processing pipeline, as illustrated in Figure 315,16,17.

Figure 3: Detailed example of the multi-agent clinical reasoning process. The figure illustrates how a clinical query is analyzed through multiple stages, including complexity assessment, specialist recruitment, collaborative discussion, and final decision-making. This process demonstrates the system’s ability to dynamically adapt reasoning strategies based on query complexity, improving both efficiency and diagnostic accuracy in clinical decision support scenarios. Please click here to view a larger version of this figure.
Configure the Retrieval-Augmented Generation pipeline
Retrieval-Augmented Generation (RAG) is incorporated to provide context-aware analysis by combining information retrieval with the generative capabilities of large language models. User queries are converted into vector representations using embedding models and matched against the vector database using semantic similarity search to retrieve the most relevant contextual passages. The retrieved documents are then combined with the original query before inference by the LLM. This strategy helps provide contextual information during response generation and has been associated with improved factual consistency and reduced hallucination in knowledge-intensive applications, including healthcare18,19. Figure 1 and Figure 3 illustrate the overall retrieval workflow and the corresponding reasoning process.
For each user request, the final prompt is dynamically constructed by combining the original query with the most relevant contextual passages retrieved from the vector database. The retrieved information is incorporated as contextual evidence before inference, allowing the language model to generate responses grounded in the retrieved healthcare knowledge while preserving semantic consistency and reducing unsupported generations.
Prompt engineering and multi-agent reasoning
The protocol incorporates structured prompting strategies to improve contextual interpretation during response generation. These prompting techniques, together with advanced inference mechanisms, help guide the reasoning process in complex clinical scenarios and are consistent with recent developments reported in the literature20.
The architecture includes a multi-agent framework composed of specialized modules that perform distinct functions within the processing pipeline, including data validation, context filtering, clinical reasoning support, and output verification. The modular organization allows tasks to be executed sequentially or in parallel, providing flexibility for different processing requirements (Figure 4). Distributing these activities across multiple agents reduces reliance on a single language model and supports a more robust processing workflow. This architectural strategy is consistent with recent developments in distributed artificial intelligence and intelligent system design21,22.

Figure 4: Multi-agent decision framework for clinical reasoning. The process begins with a user query, which is evaluated by an agent checker responsible for assessing query complexity. For complex cases, the system dynamically recruits a multi-disciplinary team (MDT) of specialized agents that engage in iterative discussion rounds to analyze the problem and synthesize knowledge before producing a final decision. For simpler cases, the query is handled by a primary care clinician (PCC) agent, enabling faster response generation. This adaptive architecture balances efficiency and analytical depth, improving decision quality and system scalability in healthcare applications. Please click here to view a larger version of this figure.
Performance evaluation
System performance was evaluated using complementary metrics that capture both linguistic quality and semantic consistency of the generated outputs. BLEU was applied to measure syntactic similarity based on n-gram overlap23, whereas ROUGE assessed recall and content coverage, particularly in summarization and information extraction tasks24. Semantic similarity was evaluated with BERTScore, which uses contextual embeddings derived from transformer-based models to compare generated and reference texts25. Additional analyses included perplexity and cosine similarity to examine model confidence and semantic coherence, respectively26,27.
The selected evaluation metrics provide complementary perspectives on system performance by combining lexical and semantic analyses. This combination is particularly relevant in healthcare applications, where contextual interpretation is as important as lexical similarity. The platform was evaluated in a controlled computational environment that supports both cloud-based and local deployment. Local execution of LLMs was included as an option to support data privacy requirements and reduce reliance on external services when processing sensitive clinical information. This deployment strategy is compatible with data protection frameworks and can be adapted to different operational environments4.