Preprint
Article

This version is not peer-reviewed.

A Hybrid Agentic RAG Architecture with Knowledge Graphs and Text-to-SQL for Automating Citizen Services in a Public Scientific Institution

Submitted:

11 October 2026

Posted:

12 October 2026

You are already at the latest version

Abstract
Large language models (LLMs) can produce plausible but incorrect content, a risk that is unacceptable when public institutions disclose scientific and legal information. This study presents and evaluates a hybrid agentic retrieval-augmented generation (RAG) system that automates first-level responses to citizen information requests at the Marine Institute of Peru (IMARPE). A baseline analysis of 196 requests showed a mean response time of 12 business days, above the 10-day legal limit, and identified 26.9% of them as routine, data-extractable queries. The system, developed under CRISP-DM, uses LangGraph to route each query to a LightRAG knowledge graph (Neo4j) built from institutional yearbooks, to a Text-to-SQL agent that queries the IMARSIS relational database through the Model Context Protocol (MCP), or to both, with Gemini 2.5 Flash as the foundation model and a referral protocol for out-of-scope requests. Five institutional domain experts rated 30 test cases, with mean scores of 4.45/5 for factual accuracy, 4.10/5 for completeness, and 4.57/5 for clarity. Mean end-to-end software latency was 20.43 s (maximum 49.20 s), and 30 pilot users rated usability at 80.42 on the System Usability Scale (Cronbach’s α = 0.96). These preliminary, single-site results indicate that combining graph-based and SQL-based grounding is feasible for routine citizen-information services; comparison with simpler baselines remains pending.
Keywords: 
;  ;  ;  ;  ;  ;  ;  ;  

1. Introduction

The emergence of generative artificial intelligence and large language models (LLMs) has opened new opportunities to modernize interactions between the State and its citizens [1,2]. However, deploying these technologies in institutional settings, where technical accuracy, legal grounding, and data transparency are non-negotiable, faces a critical barrier: the propensity of LLMs to produce “hallucinations”, that is, fluent but factually incorrect or unsubstantiated content [3].
Public-administration research has examined the determinants of chatbot adoption in government agencies [4], the results reported by the agencies that use them [2], and their impact on public service provision as perceived by citizens and service providers [5]. Analyses of the governance of generative AI likewise identify hallucination and inaccuracy among its principal risks [6]. Together, these studies indicate that the value of a citizen-facing assistant depends not only on its conversational fluency but, above all, on the verifiability of the information it delivers.
In Peru, public entities must answer citizen information requests within 10 business days under Law No. 27806 on Transparency and Access to Public Information [7]. However, the administrative load generated by a high volume of routine inquiries creates operational bottlenecks that can lead to non-compliance. At the Marine Institute of Peru (IMARPE), the state institution responsible for fisheries and oceanographic research, records for August–December 2025 (n = 196 requests) showed a mean response time of 12 business days, above the legal limit. Analysis of these records found that 26.9% of the requests were low-complexity routine queries that required only the extraction of data already available in institutional yearbooks or in the biological database IMARSIS [8].
Deploying a generic LLM chatbot to address this bottleneck would introduce unacceptable risks: a system that fabricates fisheries statistics or taxonomic classifications could create legal liabilities and erode public trust. Retrieval-augmented generation (RAG) [9] addresses this problem by conditioning the model’s output on passages retrieved from a controlled knowledge corpus, which grounds factual content and reduces hallucinations.
This risk is amplified in scientific institutions, whose repositories contain verifiable quantitative claims such as biomass statistics, taxonomic records, and oceanographic time series. Misreporting such data would not only misinform citizens but could also affect fisheries-policy decisions with ecological and legal consequences. This domain-specific characteristic motivates both the choice of case study and the architectural decisions adopted in this work.
Nevertheless, classical RAG architectures based on flat vector search are insufficient for IMARPE’s heterogeneous and scientifically dense knowledge corpus, which combines unstructured narrative documents (multi-year PDF yearbooks with complex tables) with structured relational data (IMARSIS) [10]. This dual nature calls for a bimodal, agentic approach.
This work presents the design, implementation, and evaluation of a hybrid agentic RAG system that integrates LightRAG [11], a graph-augmented retrieval framework backed by Neo4j, with a Text-to-SQL agent operating through the Model Context Protocol (MCP) [12], orchestrated by LangGraph [13]. The system acts as an automated first-level (Level-1) filter that answers routine inquiries immediately and redirects complex requests to the formal channel handled by staff, with the aim of reducing the administrative load that delays compliance with legal response deadlines.
The system was deployed on the institution’s Standard Transparency Portal (PTE) and evaluated through three key performance indicators (KPIs): end-to-end response latency (KPI-01), response quality assessed by an expert panel (KPI-02), and usability (KPI-03). The main contributions of this work are: (i) a bimodal agentic architecture that routes each citizen query to graph-based retrieval over scientific documents, to schema-aware Text-to-SQL over a live relational database, or to both; (ii) a credential-isolation design based on MCP that keeps database access within the institutional network; (iii) a referral protocol that redirects out-of-scope or sensitive requests to the formal access-to-information channel instead of generating unsupported answers; and (iv) a preliminary evaluation in a real public scientific institution that combines expert judgment, latency measurement, and a usability study.
The remainder of this article is organized as follows. Section 2 reviews related work on LLM limitations, RAG architectures, graph-augmented retrieval, and Text-to-SQL. Section 3 describes the materials and methods, including the operational baseline, data sources, comparative selection of architectures and models, system architecture, and evaluation framework. Section 4 reports the results for the three KPIs. Section 5 discusses the findings, ethical considerations, limitations, and future work, and Section 6 presents the conclusions.

3. Materials and Methods

3.1. Operational Context and Baseline Analysis

Following the business-understanding phase of the CRISP-DM framework [40], historical public-information-access records were analyzed quantitatively to characterize operational demand and establish the baseline that motivates the proposed architecture.
A non-probabilistic convenience sample of n = 196 requests submitted between August and December 2025 was examined and classified by technical and legal complexity. As shown in Figure 1, 26.9% of the requests were classified as frequent, routine queries of low-to-medium complexity, which required only the extraction of existing data, such as figures from institutional yearbooks or taxonomic records from the IMARSIS database, without interpretive human analysis. The remaining 73.1% were complex requests (e.g., personnel settlements, legal resolutions, and technical case files). The five-month window was treated as representative under the assumption that the volume and composition of requests are approximately stable throughout the year; this assumption is discussed as a limitation in Section 5.4.
Despite their operational simplicity, routine requests enter the same sequential processing queue as complex case files, creating a bottleneck that delays the whole process. The mean response time in the sample was 12 business days, above the 10-day maximum established by Law No. 27806 [7]. Figure 2 shows the dispersion of response times across the sampled requests; a substantial share of the requests exceeded the legal threshold.
These baseline findings motivate the proposed hybrid RAG assistant: by resolving routine queries immediately at the point of entry, the system can deliver information to citizens within seconds (KPI-01) and has the potential to keep these requests out of the formal administrative queue, which would allow staff to concentrate on the 73.1% of complex case files. Whether this deflection translates into measurable improvements in legal compliance requires longitudinal monitoring after sustained deployment (Section 5.6).

3.2. Knowledge Sources and Dataset

The system’s knowledge base draws on two primary sources that differ in data structure and integration strategy (Table 1).
The documentary corpus includes all scientific-technological yearbooks for the 2010–2025 period, which ensures thematic relevance and temporal coverage. IMARSIS is queried in real time and no static copy is maintained, so the most recent data are always retrieved. The scientific nature of the corpus imposes an additional requirement that favours graph-augmented retrieval over flat vector search: frequent queries at research institutions are relational, for example, comparing the evolution of anchovy biomass across yearbooks or contrasting a narrative taxonomic record with its numerical counterpart in IMARSIS. This multi-hop, cross-document reasoning distinguishes the present use case from RAG applications in conventional administrative entities.

3.3. Methodological Framework

To select the engineering framework, three data-science methodologies were compared: KDD (Knowledge Discovery in Databases), SEMMA (Sample, Explore, Modify, Model, Assess), and CRISP-DM (Cross-Industry Standard Process for Data Mining), as summarized in Table 2.
CRISP-DM was selected as the guiding methodology. KDD remains appropriate when the data are already structured and the goal is pattern extraction, as in the authors’ citizen-security application [38]; the present problem, however, starts from an operational service gap and ends in a deployed system, two stages that CRISP-DM addresses explicitly. It remains widely adopted in data-science practice and has recently been extended to new settings, such as the assessment of agent-based simulation models [43]. Its explicit business-understanding phase framed the technical solution around a concrete operational problem (the 12-day mean response time), and its iterative coupling between data preparation and modelling was essential because the quality of the assistant depends directly on corpus preprocessing (yearbook cleaning and chunking strategy) rather than on coding alone. The six phases were executed as follows: (1) business understanding (baseline analysis, Section 3.1); (2) data understanding (characterization of the knowledge sources, Section 3.2); (3) data preparation (ETL pipeline, Section 3.4); (4) modelling (architecture and component selection, Section 3.5, Section 3.6 and Section 3.7); (5) evaluation (expert panel, latency, and usability, Section 3.9); and (6) deployment (rollout on institutional servers, Section 3.8).

3.4. Data Engineering Pipeline

Data preparation for the yearbook corpus followed a three-stage extract–transform–load (ETL) pipeline designed to maximize the semantic quality of the indexed content (Figure 3).
Stage 1 – Structural extraction. PDF files were converted to Markdown with a vision-language parsing service (LlamaParse). Rule-based text extractors (e.g., pypdf) read text line by line and perform poorly on borderless tables and embedded charts, whereas vision-language parsers analyze each page as an image to identify structural boundaries, table layouts, and heading hierarchies before generating text; recent optical-compression OCR models illustrate the same research direction [44]. Markdown was chosen because it preserves the document hierarchy (H1–H3 headings), which allows the chunking subsystem to respect the logical structure of scientific documents, and because its table syntax preserves row–column relationships that are lost in plain text.
Stage 2 – Semantic curation (LLM denoising). Gemini 2.5 Flash was used as a semantic filter to repair context disrupted by OCR artefacts, correct typographical errors, and normalize date and unit formats across the corpus. Raw text was processed with a sliding-window strategy in blocks of approximately 20,000 characters, split at paragraph boundaries to avoid breaking sentences. Contextual metadata tags (e.g., [YEAR: 2024]) were injected at the start of each block to preserve temporal context, and a dedicated system prompt instructed the model to reconstruct Markdown tables broken or malformed during extraction. An exponential-backoff retry mechanism handled transient API interruptions and rate limits.
Stage 3 – Knowledge-graph construction. The curated Markdown content was ingested by LightRAG, which performs LLM-based entity and relation extraction, entity profiling, and deduplication. The resulting graph was stored in Neo4j, supporting both low-level (entity-centred) and high-level (relation- and theme-centred) retrieval.
For IMARSIS, a simplified, semantically annotated DDL schema was built, with comments describing JOIN relationships and column semantics. This enriched schema is injected into the LLM’s context window at each Text-to-SQL call to reduce identifier errors in the generated SQL (the schema-selection procedure is described in Section 3.7.6).

3.5. Comparative Selection of RAG Architectures

Ten RAG paradigms described in the literature were compared against three institutional constraints: scientific accuracy, operational cost, and feasibility of deployment within a public entity (Table 3). This comparison is qualitative and based on the characteristics reported in the literature; it was not accompanied by an experimental benchmark of each paradigm on the IMARPE corpus.
The analysis indicated that LightRAG offered the best balance among the three constraints: it provides the contextual richness of a knowledge graph for multi-hop reasoning while keeping indexing costs viable for a state entity. Naïve RAG was discarded because of its limited ability to answer questions that require a global view of a document: IMARPE’s reports often require relating data on one page (e.g., biomass estimates) to conclusions many pages later, and purely vector-based retrieval tends to fragment these connections. Complex graph architectures (GraphRAG and NodeRAG) were ruled out because building their indexes requires a large number of LLM calls or substantial engineering effort, which is incompatible with the institution’s constrained budget. LightRAG builds a simpler entity–relation graph that is cheaper to index and update, and its dual-level retrieval covers both pointed queries (e.g., “What was the fishing quota in 2023?”, resolved through low-level, entity-centred retrieval) and abstract queries (e.g., “How has biomass evolved over the last decade?”, resolved through high-level, relation-centred retrieval).

3.6. Foundational Model Selection

Because IMARPE lacks on-premise GPU infrastructure, the architecture relies on a model-as-a-service (MaaS) API. Candidate models were compared using the LLM-Stats leaderboard (January 2026) [45] against three public-sector criteria: operational cost, context-window size, and reasoning performance, the latter measured by the GPQA benchmark [46] (Table 4).
The cost–benefit analysis identified two main barriers. First, the frontier models GPT-5.2 Pro and Claude Opus 4.5 achieve the highest reasoning scores among the candidates (GPQA ≥ 87.0%), but their output costs ($168.00 and $25.00 per million tokens, respectively) are difficult to sustain for a high-volume citizen-facing service. Gemini 3 Pro offers the same 1,048,576-token context window as Gemini 2.5 Flash, but at 6.7 times its input cost and 4.8 times its output cost. Second, the lowest-cost models, DeepSeek-V3.2 and MiMo-V2-Flash, have smaller context windows (131,072 and 256,000 tokens, respectively), which limit the volume of curation blocks, schema documentation, and retrieved evidence that can be processed in a single call.
Gemini 2.5 Flash was selected for three reasons: (a) its 1,048,576-token context window accommodates the curation blocks, the enriched DDL schema, and large sets of retrieved graph context within a single call, reducing the need to truncate evidence during synthesis; (b) its input cost of $0.30 per million tokens, which is 70 times lower than that of GPT-5.2 Pro and approximately 17 times lower than that of Claude Opus 4.5, supports long-term fiscal sustainability; and (c) its native support for function calling and structured outputs, which is required for MCP-based Text-to-SQL operation because the agent must translate natural language into SQL and invoke the IMARSIS tools exposed by the MCP server. Although positioned as a high-efficiency model, its reported GPQA score of 82.8% indicates reasoning capability adequate for the data-extraction, table-interpretation, and synthesis tasks required by the assistant.

3.7. Supporting Technology Stack

To implement the selected LightRAG architecture, four additional component categories were compared: embedding models, PDF parsing tools, graph-database engines, and re-ranking models.

3.7.1. Embedding Model

The embedding component maps the content of scientific documents into high-dimensional vectors. Leading models from the Massive Text Embedding Benchmark (MTEB) leaderboard [47] were compared, considering multilingual capability and deployment modality (Table 5).
gemini-embedding-001 was selected for three reasons: (a) competitive performance, ranking fourth among the models considered, with 3072-dimensional embeddings that provide fine semantic granularity for distinguishing related biological concepts; (b) hardware constraints, since the top-ranked open model (KaLM-Embedding-Gemma3, 12B parameters) requires dedicated GPU infrastructure for efficient local inference, whereas an API-based model avoids this capital expenditure; and (c) ecosystem integration, since using the same provider as the generator model (Gemini 2.5 Flash) simplifies credential and billing management.

3.7.2. Document Parsing Tool

IMARPE’s scientific yearbooks are structurally complex, with borderless tables, embedded charts, and multi-column text. Rule-based parsers (e.g., pypdf) do not extract this content reliably and introduce noise that can propagate into downstream answers. Four parsing tools were compared (Table 6).
LlamaParse was selected because, among the tools compared, it is the one that uses a generative vision-language model (VLM) to interpret each page before extraction, which allows complex tables to be reconstructed directly in Markdown while preserving the row–column relationships of biomass data, a critical requirement for factual accuracy.

3.7.3. Graph Database Engine

LightRAG requires two types of storage: a vector index for semantic retrieval and a graph structure for the relations between entities. Four graph-storage solutions were compared in terms of scalability, persistence, and licensing cost (Table 7).
Neo4j Community Edition was selected for three reasons: (a) persistence and scalability, since, unlike NetworkX, which operates in memory and must be rebuilt after each restart, Neo4j stores the graph on disk, which allows the yearbook knowledge graph to grow incrementally; (b) integration, since Neo4j is supported as a graph-storage backend by LightRAG and its Cypher query language facilitates the inspection and auditing of extracted entities and relations; and (c) zero licensing cost, since the Community Edition provides the core database engine free of charge, unlike managed alternatives such as Amazon Neptune.

3.7.4. Re-ranking Module

In a dense scientific corpus, vector search frequently retrieves passages that share keywords with the query but are irrelevant in context (false positives). A re-ranking stage was therefore implemented to score the relevance of retrieved passages before passing them to the LLM. Re-ranking models were compared for multilingual and technical retrieval (Table 8).
Jina Reranker v3 was selected for three reasons: (a) its 8192-token context window, which allows long passages typical of technical reports to be re-scored without the truncation that Cohere Rerank v3.5 (4096 tokens) or mxbai (512 tokens) would impose, whereas BGE-Reranker-v2-m3, which offers the same window, requires local GPU hardware; (b) its high rating for code and technical retrieval (Table 8), which is relevant because the corpus contains Markdown tables; and (c) its cost efficiency relative to Cohere, together with a free usage tier.

3.7.5. System Architecture

The final system implements a bimodal agentic architecture orchestrated with LangGraph (Figure 4) and implemented in Python 3.10. It comprises four asynchronous nodes and a referral protocol.
Router node. Gemini 2.5 Flash acts as a semantic classifier that receives the citizen’s query and selects one of four routes: conceptual, narrative, or relational queries activate the LightRAG module (RAG_ONLY); statistical, numerical, or species-specific queries activate the MCP Text-to-SQL agent (SQL_ONLY); queries requiring both narrative and quantitative grounding activate both pathways concurrently (BOTH); and out-of-scope or sensitive queries are sent directly to the referral protocol (NONE).
LightRAG module (unstructured knowledge). Answers queries against the Neo4j knowledge graph built from the yearbook corpus. Entity-specific queries use low-level retrieval of entities and their attributes, whereas abstract or correlational queries use high-level retrieval over relations and themes, enabling cross-document reasoning. Retrieved passages are re-ranked (Section 3.7.4) before synthesis.
MCP Text-to-SQL agent (structured knowledge). Handles queries that require quantitative data. The enriched DDL schema is injected into the context of Gemini 2.5 Flash, which generates a SQL statement that the MCP server executes against the live Oracle IMARSIS database over a client–server channel based on Server-Sent Events (SSE). Database credentials reside only in the MCP server within the institutional network and are never included in requests sent to the Gemini API.
Synthesizer node. Merges the outputs of the active pathways (narrative text and tabular data) into a single natural-language response. Prompt-engineering patterns [48] instruct the model to answer only from the retrieved evidence.
Intelligent referral protocol. When the router classifies a query as out of scope or sensitive, or when the retrieval modules return insufficient context, the system does not generate an answer. Instead, it displays a standardized institutional message (“To guarantee your right to access information, please submit your request through the following link”) together with a button linking to the SAIP (Public Information Access Service) form, so that the citizen always retains access to the formal request channel.

3.7.6. Relational Schema Selection (Pareto Analysis)

Because the full IMARSIS schema contains hundreds of tables, injecting all table definitions into the LLM’s context would be inefficient and error-prone. A selection criterion inspired by the Pareto principle was therefore applied, under the working assumption that a small subset of tables (approximately 10–15%) supports more than 90% of transactional and business queries. To identify this transactional core, three diagnostic scripts were run against the Oracle data dictionary to measure referential integrity (most-referenced master tables), storage volume (disk footprint), and transactional activity (row counts). Table 9, Table 10 and Table 11 summarize the results.
Cross-referencing these three metrics with qualitative business criteria isolated the core schema, composed of large fact tables (SP_VIAJE, SP_ACTIVIDAD, and SP_ESPECIE) and their dimension tables (QI_TAXON, QI_EMBARCACION, QI_LUGAR, QI_ARTE_PESCA, and QI_FABRICA). Audit tables, temporary tables (prefix TMP_), and non-essential materialized views were excluded to reduce token consumption and improve the agent’s precision. Beyond extracting the raw DDL statements, a Markdown context document was curated manually to serve as the agent’s reference on data structure: physical storage clauses (PCTFREE, TABLESPACE, and STORAGE) that add noise were removed, natural-language comments were added for ambiguous columns (e.g., clarifying that TAXON_ID identifies the biological species), and implicit JOIN relationships not declared as formal constraints were documented in text.

3.7.7. SQL Execution Safety and Database Access Control

Because the Text-to-SQL agent executes model-generated statements against a live institutional database, isolating credentials does not by itself make execution safe. The deployed version applies four safeguards. First, credential isolation: the Oracle credentials reside only in the MCP server inside the institutional network, are injected as runtime environment variables (Section 3.8), and are never transmitted to the Gemini API. Second, schema scoping: the model receives only the curated core schema (Section 3.7.6), from which audit tables, temporary tables, and non-essential materialized views are excluded. Third, controlled failure: graph failures and database timeouts are captured by the API’s exception handling, which returns a controlled response instead of a server error (Section 3.8). Fourth, scope restriction: queries classified as out of scope or sensitive are sent to the referral protocol (NONE route) and do not reach the SQL agent.
Schema scoping restricts what the model is shown but does not, on its own, prevent a generated statement from referencing other database objects; that guarantee depends on database-level privileges. Production deployments of LLM-generated SQL should therefore also restrict the MCP database account to read-only access on the approved tables, accept only single SELECT statements after syntactic validation, enforce execution timeouts and row limits, and log every generated statement for audit, in line with the security risks identified for MCP-based tool execution [28]. A formal assessment of these controls, including adversarial prompt-injection testing, was not part of the present evaluation (Section 5.4).

3.8. Deployment Architecture

All agentic logic was encapsulated in a RESTful API built with Flask, exposing a /query endpoint that accepts JSON requests, handles concurrency through async/await, and returns the processed response. Exception handling ensures that, in the event of a graph failure or database timeout, the API returns a controlled response instead of a server error (HTTP 500).
The backend (Flask API and LangGraph) and the persistence service (Neo4j) were containerized as independent services with Docker Compose, which provides an identical execution environment across development and operational testing and avoids Python dependency conflicts. Deployment was carried out on a Windows Server 2022 instance in the institution’s on-premise infrastructure. Because LLM inference is delegated to the Gemini API, the local server requires only moderate resources (4 vCPUs and 16 GB of RAM). API credentials (Gemini API keys and Oracle database credentials) are injected as runtime environment variables rather than embedded in the source code, in accordance with institutional cybersecurity standards.
For citizen interaction, a React-based chat component was developed. It was embedded not on the institution’s home page but in the Public Information Access section of the Standard Transparency Portal (PTE), so that the assistant acts as a Level-1 filter that can resolve a query in real time before a manual case file is created. The interface renders Markdown, so that statistical tables returned by the SQL agent are displayed legibly; shows loading indicators during asynchronous processing; and keeps the conversation history in the browser’s local storage to prevent context loss when the page is reloaded.

3.9. Evaluation Framework

A mixed-methods evaluation protocol was designed to measure the technical quality of the responses generated by the hybrid architecture and the operational performance and usability of the deployed assistant. The evaluation was structured around three KPIs.
KPI-01 – Response latency (efficiency). End-to-end processing time from query submission to response rendering. A latency below 120 s per query was set as the operational acceptance threshold. Because this measure refers to software processing time, it is not directly comparable with the 12-business-day administrative baseline, which includes human handling, document routing, and approvals (Section 5.1).
KPI-02 – Response quality (technical quality). Five domain specialists from IMARPE, who were aware that the responses had been generated by the system, separately evaluated 30 predefined test interactions (Golden Set) using a three-dimensional rubric inspired by the quality aspects targeted by RAGAS [49]: factual accuracy (are the data exact and free of fabricated content?), completeness (does the response fully answer the query?), and clarity and usefulness (is the language accessible to a non-technical citizen?). Each dimension was scored on a 1–5 Likert scale.
KPI-03 – Usability. Measured with the System Usability Scale (SUS) [50], a standardized 10-item questionnaire administered to 30 users (institutional staff, scientists, and pilot citizens) immediately after a free 5-min interaction session with the deployed widget. Internal consistency was assessed with Cronbach’s alpha [51,52]. Scores were interpreted with the acceptability ranges of Bangor et al. [53], in which scores above 70 are considered acceptable, and with the curved grading scale of Sauro and Lewis [54].

3.9.1. Golden Set Design

To support an objective technical evaluation, a reference Golden Set of questions and expected answers was constructed. Source queries were drawn from the institution’s Public Information Access Request (SAIP) registry for the August–December 2025 period. A purposive, non-probabilistic sample of 30 questions was selected, discarding trivial administrative queries and prioritizing four scenario types: (1) frequent institutional queries, (2) retrieval of exact statistical data, (3) synthesis of technical reports, and (4) exception handling and referral.
The Golden Set was not intended to represent exhaustively the knowledge contained in 15 years of yearbooks, but to cover the main intents of citizen queries. Its size (n = 30) was defined on coverage grounds rather than for probabilistic inference: in usability research, a modest number of test cases or evaluators reveals a large share of the existing problems [55]. For reference, the baseline period contained 53 routine requests; because the Golden Set was not drawn randomly from them, it is not intended to estimate population-level performance. Following a purposive sampling strategy [56], the Golden Set was distributed across the thematic domains observed in real demand, namely biomass, landings, taxonomic occurrences, and financial information, so that retrieval effectiveness is assessed on the scenarios the system faces in production. The Golden Set was organized by scenario type rather than by execution route, and ambiguous or adversarial queries were not included as a separate category; route-level results are therefore descriptive (Section 5.4).

3.9.2. Expert Panel Procedure

The panel consisted of five domain specialists from the institution. Its size was determined by the availability of senior specialists and by the criterion of technical saturation; for the assessment of factual accuracy in a specialized domain, a small panel of highly qualified experts allows an exhaustive review of every Golden Set response. The 30 Golden Set questions were executed against the assistant’s backend, and the results were compiled into a structured form containing each question and the AI-generated answer. Each expert scored the responses independently.
The instrument had two sections. In Section A (interaction-level evaluation), the experts scored each of the 30 responses on a 5-point Likert scale (1 = very poor/entirely incorrect; 5 = excellent/entirely correct) for each of the three rubric dimensions. Section B (global qualitative evaluation) consisted of three items answered after scoring all responses: the degree to which institutional expectations were met, opportunities for interface improvement, and the level of confidence (1–10) in deploying the assistant as the first point of citizen contact.

3.9.3. User Acceptance Testing

A separate user acceptance test validated the assistant in its real environment. Thirty users (administrative staff, scientists, and pilot citizens) were given access to the deployed web widget and asked to perform free queries related to their information needs during a 5-min session. After the session, participants completed the SUS questionnaire, which alternates positively and negatively worded statements to reduce acquiescence bias.
Internal consistency was quantified with Cronbach’s alpha [51], as defined in Equation (1):
α = (k / (k − 1)) × [1 − (Σσ²ᵢ / σ²ₜ)]
where k is the number of items (10), Σσ²ᵢ is the sum of the item variances, and σ²ₜ is the variance of the total score.

4. Results

4.1. Response Quality (KPI-02): Expert Panel Evaluation

The 30 Golden Set interactions were evaluated on three dimensions by the five specialists, yielding 90 item-level scores (30 test cases × 3 dimensions, each averaged across the five experts). Figure 5 shows the mean score per dimension, and Table 12 summarizes the results.
The system achieved a mean factual-accuracy score of 4.45/5, indicating that the combination of the MCP SQL agent and the LightRAG knowledge graph retrieved exact numerical data in most test cases. Completeness reached 4.10/5, and clarity and usefulness obtained the highest score (4.57/5), indicating that technical content was conveyed in language accessible to non-technical citizens. Overall, 81 of the 90 item-level scores (90.0%) were at or above 4.0.
The remaining 9 item-level scores (10.0%) were concentrated in questions 7, 15, 20, 23, and 24 and reflect three failure modes. First, referral by design (questions 7, 20, and 23) produced the lowest completeness scores (2.2–2.8): the fallback is activated when the requested information lies outside the indexed corpus or is sensitive (e.g., budgets or acoustic-survey biomass), and although this behaviour protects legal compliance, the experts rated these responses as incomplete from the standpoint of immediate information needs. Second, a predictive-modelling limitation (question 15) produced the lowest accuracy score of the study (2.6/5) for an anchovy-catch projection: the system generated a static linear projection for the next five years, which is inappropriate for a highly variable resource. This shows that, although the SQL pathway retrieves historical data accurately, the LLM cannot replace a dedicated statistical model for forecasting. Third, truncation of a large result set (question 24) reduced completeness (3.4/5) for a multi-port disaggregated breakdown that approached the token limit: the SQL agent returned the aggregate total but omitted the detailed breakdown.
Overall, in the evaluated cases the architecture tended to omit information or redirect the citizen rather than fabricate data; the one clearly inadequate answer (question 15) arose from extrapolation beyond the retrieved data rather than from retrieval. In the global evaluation (Section B), all five experts reported that the system met or exceeded their expectations for citizen service, and the mean confidence score for deploying it as the first official point of contact was 8.6/10.

4.2. Usability (KPI-03): System Usability Scale

The SUS questionnaire was administered to 30 users after the free interaction session. Cronbach’s alpha was 0.96, indicating high internal consistency of the responses [52].
The global SUS score was 80.42/100. This value is above the acceptability threshold of 70 proposed by Bangor et al. [53] and corresponds to grade A− (78.9–80.7; 85th–89th percentile) on the curved grading scale of Sauro and Lewis [54]. The low scores on the negatively worded items (1.67–1.87; Figure 6) indicate that participants did not perceive the system as unnecessarily complex, inconsistent, or difficult to learn. These results suggest that the architectural complexity of graph retrieval and MCP-based SQL execution is not exposed to the end user.

4.3. Response Latency (KPI-01)

End-to-end processing times measured across the 30 Golden Set test cases yielded a mean latency of 20.43 s per query, ranging from 3.20 s (an out-of-scope query filtered through the NONE route) to 49.20 s (question 30, a 15-year cross-variable report that required both pathways through the BOTH route).
Mean latency differed by the execution route assigned by the LangGraph router:
  • NONE (out-of-scope or sensitive queries): mean of 3.58 s.
  • SQL_ONLY (relational queries to IMARSIS): mean of 16.17 s, covering SQL generation, execution through MCP, and response formatting.
  • RAG_ONLY (unstructured queries to the Neo4j knowledge graph): mean of 23.06 s, covering dual-level graph retrieval and context synthesis.
  • BOTH (hybrid narrative and quantitative synthesis): mean of 39.75 s, reflecting the concurrent execution of both retrieval pathways before final synthesis.
In all 30 test cases, processing latency remained below the 120 s acceptance threshold defined for KPI-01. Table 13 contrasts the characteristics of the traditional manual process with those of the hybrid RAG system.

4.4. Validation of the Intelligent Referral Mechanism

During the expert evaluation, 10.0% of the Golden Set cases (3 of 30; questions 7, 20, and 23) activated the referral protocol. In all three cases, the system correctly identified that the requested information lay outside the indexed corpus or constituted a sensitive request, and the redirection message and the SAIP form button were rendered correctly. The referral mechanism therefore preserved the citizen’s access to the formal request channel in every case in which an autonomous answer was not provided.

5. Discussion

5.1. Interpretation of the Results

The results support the feasibility of the hybrid RAG system in the evaluated setting across the three KPIs; in the absence of a comparative baseline, however, they do not establish its superiority over simpler architectures. The factual-accuracy score of 4.45/5 suggests that the grounding strategy can limit the hallucination problem, a principal barrier to LLM adoption in public-sector contexts [3,6]. The dual-grounding strategy, in which narrative answers are grounded in the LightRAG knowledge graph and numerical answers in the result sets of SQL queries executed against the live IMARSIS database, reduces the opportunity for fabricated statistics, because figures are taken from retrieved records rather than from the model’s parametric knowledge. This is consistent with the view that knowledge graphs and structured sources complement LLMs by supplying explicit, verifiable facts [19,20]. However, the synthesis step remains generative, and question 15 shows that errors can still arise when the model extrapolates beyond the retrieved data.
Recent public-administration studies have moved from analysing the adoption of government chatbots to examining their results and their impact on public service provision [2,4,5]. The present evaluation contributes evidence of this kind for a public scientific institution by combining expert-rated answer quality, measured latency, and usability in a real deployment.
The SUS score of 80.42/100 with α = 0.96 indicates that the system’s technical sophistication did not translate into perceived complexity for the participants. Because the usability sample included institutional staff and scientists in addition to pilot citizens, this result should be interpreted as preliminary evidence of acceptability rather than as a measure of the experience of the general public (Section 5.4).
Regarding latency, the comparison between 12 business days and a mean of 20.43 s does not equate two identical processes: the administrative workflow includes signatures, document routing, and human handoffs, whereas the measured latency refers only to software processing. The relevant effect is demand deflection: by answering routine queries, which accounted for 26.9% of the baseline sample, at the entry point of the transparency portal, the system has the potential to prevent these requests from entering the formal administrative queue and free staff time for complex case files. The magnitude of this effect on legal compliance must be confirmed through longitudinal monitoring.

5.2. Architectural Advantages over Naïve RAG

The literature-based comparison (Section 3.5) suggests that naïve RAG, although inexpensive, is structurally insufficient for IMARPE’s corpus. The “lost in the middle” phenomenon [17] is particularly detrimental for queries that require synthesis across multi-year yearbooks spanning hundreds of pages. LightRAG’s dual-level retrieval addresses this by modelling the relations between entities explicitly in a graph. The Text-to-SQL component adds a capability that graph-based RAG alone does not provide: real-time access to relational transactional data, which allows quantitative queries to be answered from the database itself. Because no experimental comparison with a naïve RAG baseline or with an ablated system was performed, the relative contribution of each component remains to be quantified (Section 5.4 and Section 5.6).

5.3. Ethical and Legal Considerations: The Referral Architecture

The intelligent referral protocol is a central ethical design decision. In public-sector AI systems, the absence of an answer is preferable to an incorrect one. By constraining the system to redirect requests that it cannot answer from its sources, rather than generating unsupported content, the design follows the principle of responsible AI by design and responds to the governance concerns raised for generative AI [6]. The MCP-based design additionally ensures that IMARSIS Oracle credentials are never included in requests sent to the Gemini API, addressing the data-governance requirements of a state institution [35]. Credential isolation, however, does not by itself guarantee the safe execution of model-generated SQL; the complementary safeguards and their current scope are described in Section 3.7.7.

5.4. Limitations

This study has several limitations. First, the evaluation did not include an experimental baseline (e.g., an LLM without retrieval or a naïve vector-based RAG) or an ablation of the system’s components on the same Golden Set; the advantages of the selected architecture are therefore supported by the literature-based comparison and by the absolute scores obtained, not by a controlled comparison. Second, the five experts belong to IMARPE and were aware that the responses were generated by the system, and neither dispersion measures (e.g., standard deviations) nor inter-rater agreement statistics (e.g., Krippendorff’s α or the intraclass correlation coefficient) were reported; an evaluation by external experts blinded to the response source, with agreement statistics, would strengthen the validity of KPI-02. Third, the Golden Set (n = 30) was selected purposively and organized by scenario type rather than by execution route, so the number of cases per route (SQL_ONLY, RAG_ONLY, BOTH, and NONE) was not controlled, and ambiguous, adversarial, and out-of-domain queries were not tested as separate categories; the results should therefore be regarded as preliminary and specific to the evaluated corpus. In addition, the baseline analysis relies on a five-month convenience sample whose representativeness assumes stable demand throughout the year. Fourth, the usability sample combined institutional staff, scientists, and pilot citizens in short (5-min) sessions, which may not reflect the experience of the general public over sustained use. Fifth, the corpus is restricted to the 2010–2025 yearbooks and IMARSIS; queries about other institutional documents trigger the referral protocol and are not resolved autonomously. Sixth, the system cannot produce reliable stochastic or bio-economic projections (question 15) without a dedicated computation module. Seventh, the SQL-execution safeguards described in Section 3.7.7 were not subjected to a formal security assessment, such as adversarial prompt-injection testing. Finally, all results derive from a single deployment in one institution; generalization to other public entities would require corpus-specific ingestion and schema mapping, although the architectural pattern is, in principle, transferable.

5.5. Practical Implications for Public-Sector Digital Transformation

This work describes a reference implementation that may inform AI-assisted citizen service in resource-constrained public entities, subject to the validation steps outlined in Section 5.6. The local infrastructure requirements are modest (4 vCPUs and 16 GB of RAM), and the main variable cost is Gemini API token consumption ($0.30 per million input tokens and $2.50 per million output tokens). Containerized deployment with Docker Compose supports environment portability and reproducibility. Open-source components (LangGraph, LightRAG, and Neo4j Community Edition) minimize licensing costs, and MCP provides a provider-agnostic standard for integrating relational databases.

5.6. Future Work

Future work should prioritize: (a) an experimental comparison of the hybrid system against an LLM without retrieval, a naïve vector RAG, and single-pathway variants on an extended Golden Set (e.g., 50–100 queries balanced across the SQL_ONLY, RAG_ONLY, BOTH, and NONE routes and including ambiguous, adversarial, and out-of-domain queries), with external experts blinded to the response source and inter-rater agreement statistics reported together with the mean ± SD of each rubric dimension; (b) a statistical-analysis agent with computational libraries (e.g., pandas and SciPy) to support bio-economic projections, addressing the gap identified in question 15; (c) automatic pagination within the MCP client for high-volume disaggregated SQL queries (question 24); (d) a continuous LLMOps pipeline integrated with automated RAGAS evaluation [49] to monitor faithfulness and context precision after new yearbook ingestions or database updates; (e) longitudinal measurement of the system’s effect on institutional response times and legal compliance after sustained production use; and (f) a security assessment of the Text-to-SQL pathway, including a review of database-level privileges and adversarial prompt-injection testing.

6. Conclusions

This study indicates that a bimodal agentic RAG architecture that integrates a LightRAG knowledge graph with an MCP-based Text-to-SQL agent, orchestrated by LangGraph, is a feasible and cost-conscious option for automating first-level citizen information services in the public scientific institution evaluated. Because the evaluation was conducted at a single site, on a purposively selected Golden Set, and without an experimental baseline, the following conclusions are preliminary.
Regarding efficiency (KPI-01), the system responded to all test queries with a mean latency of 20.43 s (maximum 49.20 s), well below the 120 s acceptance threshold. This value measures software processing time and is not directly comparable with the 12-business-day mean of the formal administrative workflow, which exceeded the 10-day limit set by Law No. 27806. By answering routine queries, which accounted for 26.9% of the baseline requests, at the point of entry, the system has the potential to reduce administrative workload by deflecting these requests from the formal access-to-information workflow.
Regarding response quality (KPI-02), the hybrid architecture obtained a mean factual-accuracy score of 4.45/5 from a panel of five IMARPE domain experts on 30 test cases. Grounding numerical answers in SQL results and narrative answers in the knowledge graph is intended to reduce the risk of fabricated content, although extrapolation beyond the retrieved data remains a residual risk.
Regarding usability (KPI-03), the SUS score of 80.42/100 (Cronbach’s α = 0.96; n = 30) is above the acceptability threshold and corresponds to grade A− on the Sauro–Lewis curved scale, indicating that users without technical training could interact with the system easily.
The intelligent referral protocol complements these results: by redirecting requests that it cannot answer reliably to the formal SAIP channel, the system preserves the citizen’s right to access information. Subject to further validation, the architecture may serve as a reference design for public transparency offices in Peru and comparable contexts. In scientific institutions, where answers involve verifiable quantitative claims with consequences for public policy and natural-resource management, the combination of knowledge graphs for narrative content and deterministic SQL retrieval for quantitative data appears to be a promising design pattern that goes beyond routine administrative automation.
In summary, the evidence obtained in this study demonstrates, in the evaluated setting, a mean software latency of 20.43 s, a mean factual-accuracy score of 4.45/5 from domain experts, and a SUS score of 80.42, and it identifies routine, data-extractable queries (26.9% of the baseline sample) as the automation target. It does not yet demonstrate a reduction in the 12-business-day administrative response time, a reduction in staff workload, an improvement in compliance with Law No. 27806, or superiority over simpler retrieval architectures; these effects require the comparative and longitudinal studies outlined in Section 5.6.

Author Contributions

HVH, LOS, JPC, GAC: Writing-original draft, conceptualization, investigation, software, methodology, validation, project administration, supervision, funding acquisition; WE, OBP, JHLV, AMLF: Writing-review & editing, formal analysis, visualization; MC, JCLG, JVF, MRNC: Writing-review & editing, methodology. All authors have read and agreed to the published version of the manuscript

Funding

The author declared that financial support was received for this work and/or its publication. This research was supported by Universidad Nacional Mayor de San Marcos - RR_005446 2026-R and Project number C26200016i, project type PCONFIGI-INV 2026.

Institutional Review Board Statement

Ethical review and approval were waived for this study because it involved only the expert assessment of software-generated responses and an anonymous usability questionnaire, and no personal or sensitive data were collected from participants.

Data Availability Statement

The data presented in this study are available on request from the corresponding author. The data are not publicly available because they derive from institutional records and databases of IMARPE.

Acknowledgments

The authors thank IMARPE’s Transparency Office for facilitating access to institutional records and database connectivity, the domain-expert panel for their evaluation of the system’s responses, and the pilot user group for their participation in the usability evaluation.

Conflicts of Interest

The authors declare no conflicts of interest.

References

  1. Adam, M.; Wessel, M.; Benlian, A. AI-Based Chatbots in Customer Service and Their Effects on User Compliance. Electron. Mark. 2021, 31, 427–445. [Google Scholar] [CrossRef]
  2. Chen, T.; Gascó-Hernandez, M. Uncovering the Results of AI Chatbot Use in the Public Sector: Evidence from US State Governments. Public Perform. Manag. Rev. 2025, 48, 1331–1356. [Google Scholar] [CrossRef]
  3. Ji, Z.; Lee, N.; Frieske, R.; Yu, T.; Su, D.; Xu, Y.; Ishii, E.; Bang, Y.J.; Madotto, A.; Fung, P. Survey of Hallucination in Natural Language Generation. ACM Comput. Surv. 2023, 55, 1–38. [Google Scholar] [CrossRef]
  4. Chen, T.; Gascó-Hernandez, M.; Esteve, M. The Adoption and Implementation of Artificial Intelligence Chatbots in Public Organizations: Evidence from U.S. State Governments. Am. Rev. Public Adm. 2024, 54, 255–270. [Google Scholar] [CrossRef]
  5. Larsen, A.G.; Følstad, A. The Impact of Chatbots on Public Service Provision: A Qualitative Interview Study with Citizens and Public Service Providers. Gov. Inf. Q. 2024, 41, 101927. [Google Scholar] [CrossRef]
  6. Taeihagh, A. Governance of Generative AI. Policy Soc. 2025, 44, 1–22. [Google Scholar] [CrossRef]
  7. Congreso de la República del Perú. Ley N.° 27806, Ley de Transparencia y Acceso a la Información Pública; Diario Oficial El Peruano: Lima, Peru, 2002; Available online: https://www.gob.pe/institucion/congreso-de-la-republica/normas-legales/118374-27806 (accessed on 1 January 2026).
  8. Instituto del Mar del Perú (IMARPE). Sistema de Información Científica del IMARPE (IMARSIS); IMARPE: Callao, Peru, 2003; Available online: https://www.imarpe.gob.pe (accessed on 1 January 2026).
  9. Lewis, P.; Perez, E.; Piktus, A.; Petroni, F.; Karpukhin, V.; Goyal, N.; Küttler, H.; Lewis, M.; Yih, W.; Rocktäschel, T.; et al. Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks. Adv. Neural Inf. Process. Syst. 2020, 33, 9459–9474. [Google Scholar]
  10. Gao, Y.; Xiong, Y.; Gao, X.; Jia, K.; Pan, J.; Bi, Y.; Dai, Y.; Sun, J.; Wang, M.; Wang, H. Retrieval-Augmented Generation for Large Language Models: A Survey. arXiv 2023, arXiv:2312.10997. [Google Scholar] [CrossRef]
  11. Guo, Z.; Xia, L.; Yu, Y.; Ao, T.; Huang, C. LightRAG: Simple and Fast Retrieval-Augmented Generation. arXiv 2024, arXiv:2410.05779. [Google Scholar] [CrossRef]
  12. Anthropic. Model Context Protocol (MCP) Specification. Available online: https://modelcontextprotocol.io (accessed on 1 January 2026).
  13. LangChain. LangGraph: Multi-Agent Workflows. Available online: https://langchain-ai.github.io/langgraph/ (accessed on 1 January 2026).
  14. Huang, L.; Yu, W.; Ma, W.; Zhong, W.; Feng, Z.; Wang, H.; Chen, Q.; Peng, W.; Feng, X.; Qin, B.; et al. A Survey on Hallucination in Large Language Models: Principles, Taxonomy, Challenges, and Open Questions. ACM Trans. Inf. Syst. 2025, 43, 1–55. [Google Scholar] [CrossRef]
  15. Kaddour, J.; Harris, J.; Mozes, M.; Bradley, H.; Raileanu, R.; McHardy, R. Challenges and Applications of Large Language Models. arXiv 2023, arXiv:2307.10169. [Google Scholar] [CrossRef]
  16. Sahu, N.; Baburajan, R.; Saravanane, N. TAXObot: A Chatbot for the Taxonomy of Marine Organisms. Expert Syst. Appl. 2026, 315, 131785. [Google Scholar] [CrossRef]
  17. Liu, N.F.; Lin, K.; Hewitt, J.; Paranjape, A.; Bevilacqua, M.; Petroni, F.; Liang, P. Lost in the Middle: How Language Models Use Long Contexts. Trans. Assoc. Comput. Linguist. 2024, 12, 157–173. [Google Scholar] [CrossRef]
  18. Hogan, A.; Blomqvist, E.; Cochez, M.; d’Amato, C.; de Melo, G.; Gutierrez, C.; et al. Knowledge Graphs. ACM Comput. Surv. 2021, 54, 1–37. [Google Scholar] [CrossRef]
  19. Pan, S.; Luo, L.; Wang, Y.; Chen, C.; Wang, J.; Wu, X. Unifying Large Language Models and Knowledge Graphs: A Roadmap. IEEE Trans. Knowl. Data Eng. 2024, 36, 3580–3599. [Google Scholar] [CrossRef]
  20. Peng, B.; Zhu, Y.; Liu, Y.; Bo, X.; Shi, H.; Hong, C.; Zhang, Y.; Tang, S. Graph Retrieval-Augmented Generation: A Survey. ACM Trans. Inf. Syst. 2025, 44, 1–52. [Google Scholar] [CrossRef]
  21. Edge, D.; Trinh, H.; Cheng, N.; Bradley, J.; Chao, A.; Mody, A.; Truitt, S.; Larson, J. From Local to Global: A Graph RAG Approach to Query-Focused Summarization. arXiv 2024, arXiv:2404.16130. [Google Scholar] [CrossRef]
  22. Xu, T.; Zheng, H.; Li, C.; Chen, H.; Liu, Y.; Chen, R.; Sun, L. NodeRAG: Structuring Graph-Based RAG with Heterogeneous Nodes. arXiv 2025, arXiv:2504.11544. [Google Scholar] [CrossRef]
  23. Asai, A.; Wu, Z.; Wang, Y.; Sil, A.; Hajishirzi, H. Self-RAG: Learning to Retrieve, Generate, and Critique through Self-Reflection. In Proceedings of the Twelfth International Conference on Learning Representations (ICLR 2024), Vienna, Austria, 7–11 May 2024. [Google Scholar]
  24. Sarthi, P.; Abdullah, S.; Tuli, A.; Khanna, S.; Goldie, A.; Manning, C.D. RAPTOR: Recursive Abstractive Processing for Tree-Organized Retrieval. In Proceedings of the Twelfth International Conference on Learning Representations (ICLR 2024), Vienna, Austria, 7–11 May 2024. [Google Scholar]
  25. Qin, B.; Hui, B.; Wang, L.; Yang, M.; Li, J.; et al. A Survey on Text-to-SQL Parsing: Concepts, Methods, and Future Directions. arXiv 2022, arXiv:2208.13629. [Google Scholar] [CrossRef]
  26. Rajkumar, N.; Li, R.; Bahdanau, D. Evaluating the Text-to-SQL Capabilities of Large Language Models. arXiv 2022, arXiv:2204.00498. [Google Scholar] [CrossRef]
  27. Hong, Z.; Yuan, Z.; Zhang, Q.; Chen, H.; Dong, J.; Huang, F.; Huang, X. Next-Generation Database Interfaces: A Survey of LLM-Based Text-to-SQL. IEEE Trans. Knowl. Data Eng. 2025, 37, 7328–7345. [Google Scholar] [CrossRef]
  28. Hou, X.; Zhao, Y.; Wang, S.; Wang, H. Model Context Protocol (MCP): Landscape, Security Threats, and Future Research Directions. arXiv 2025, arXiv:2503.23278. [Google Scholar] [CrossRef]
  29. Wang, J.; Duan, Z. Agent AI with LangGraph: A Modular Framework for Enhancing Machine Translation Using Large Language Models. arXiv 2024, arXiv:2412.03801. [Google Scholar] [CrossRef]
  30. Wu, Q.; Bansal, G.; Zhang, J.; Wu, Y.; Li, B.; Zhu, E.; et al. AutoGen: Enabling Next-Gen LLM Applications via Multi-Agent Conversation. arXiv 2023, arXiv:2308.08155. [Google Scholar] [CrossRef]
  31. Yao, S.; Zhao, J.; Yu, D.; Du, N.; Shafran, I.; Narasimhan, K.; Cao, Y. ReAct: Synergizing Reasoning and Acting in Language Models. In Proceedings of the Eleventh International Conference on Learning Representations (ICLR 2023), Kigali, Rwanda, 1–5 May 2023. [Google Scholar]
  32. U.S. Citizenship and Immigration Services. Meet Emma, Our Virtual Assistant. Available online: https://www.uscis.gov/emma (accessed on 1 January 2026).
  33. Mortaheb, M.; Khojastepour, M.A.; Chakradhar, S.T.; Ulukus, S. RAG-Check: Evaluating Multimodal Retrieval Augmented Generation Performance. arXiv 2025, arXiv:2501.03995. [Google Scholar] [CrossRef]
  34. Salemi, A.; Zamani, H. Evaluating Retrieval Quality in Retrieval-Augmented Generation. In Proceedings of the 47th International ACM SIGIR Conference on Research and Development in Information Retrieval, Washington, DC, USA, 14–18 July 2024; pp. 2395–2400. [Google Scholar] [CrossRef]
  35. Sun, L.; Huang, Y.; Wang, H.; Wu, S.; Zhang, Q.; Gao, C.; et al. TrustLLM: Trustworthiness in Large Language Models. arXiv 2024, arXiv:2401.05561. [Google Scholar] [CrossRef]
  36. Vega-Huerta, H.; Gutierrez-Mejía, F.; Calcina-Aguilar, B.; Benito-Pacheco, O.; De-la-Cruz-VdV, P.; Maquen-Niño, G.L.E.; Lázaro-Guillermo, J.C. ChatGPT-Based Conversational Artificial Intelligence System for Virtual University Admissions Office Client Attention. Ing. Syst. Inf. 2025, 30, 945–952. [Google Scholar] [CrossRef]
  37. Vega-Huerta, H.; Cardeña-Ccahuata, R.; De La Cruz Velez de Villa, P.; Cancho-Rodriguez, E.; Maquen-Niño, G.L.E. Integration of the Peruvian Citizen’s Public Information by Applying Web Scraping Under SCRUM Methodology. In Proceedings of the 9th Brazilian Technology Symposium (BTSym’23); Smart Innovation, Systems and Technologies; Springer: Cham, Switzerland, 2024; pp. 558–567. [Google Scholar] [CrossRef]
  38. Vega-Huerta, H.; Vilca Velasquez, J.; Anicama Espinoza, N.; Maquen-Niño, G.L.E.; Guerra-Grados, L.; Pantoja-Collantes, J.; Benito-Pacheco, O.; Lázaro-Guillermo, J.C.; Camara-Figueroa, A.; Cabrera-Díaz, J.; et al. Mobile Application Based on KDD to Predict High-Crime Areas and Promote Sustainability in Citizen Security in a District of Lima-Perú. Front. Comput. Sci. 2025, 7, 1585632. [Google Scholar] [CrossRef]
  39. Vega-Huerta, H.; Nalvarte-Almeida, E.; Adrianzén-Olano, I.; Benito-Pacheco, O.; Cabrera-Diaz, J.; Gil-Calvo, R.; Lázaro-Guillermo, J.C. Business Intelligence with Data Mart to Reduce Reporting and Indicator Generation Time. In Big Data: Modern Tools and Techniques; Studies in Big Data; Springer: Cham, Switzerland, 2026; Vol. 182, pp. 331–345. [Google Scholar] [CrossRef]
  40. Chapman, P.; Clinton, J.; Kerber, R.; Khabaza, T.; Reinartz, T.; Shearer, C.; Wirth, R. CRISP-DM 1.0: Step-by-Step Data Mining Guide; SPSS Inc.: Chicago, IL, USA, 2000. [Google Scholar]
  41. Fayyad, U.; Piatetsky-Shapiro, G.; Smyth, P. From Data Mining to Knowledge Discovery in Databases. AI Mag. 1996, 17, 37–54. [Google Scholar] [CrossRef]
  42. SAS Institute Inc. SAS Enterprise Miner Software: Usage and Reference; SAS Institute Inc.: Cary, NC, USA, 1997. [Google Scholar]
  43. Bemthuis, R.H.; Govers, R.R.; Asadi, A. A CRISP-DM-Based Methodology for Assessing Agent-Based Simulation Models Using Process Mining. J. Simul. 2025, 1–22. [Google Scholar] [CrossRef]
  44. Wei, H.; Sun, Y.; Li, Y. DeepSeek-OCR: Contexts Optical Compression. arXiv 2025, arXiv:2510.18234. [Google Scholar] [CrossRef]
  45. LLM-Stats. LLM Leaderboard: Comparison of AI Models. Available online: https://llm-stats.com (accessed on 1 January 2026).
  46. Rein, D.; Hou, B.L.; Stickland, A.C.; Petty, J.; Pang, R.Y.; Dirani, J.; Michael, J.; Bowman, S.R. GPQA: A Graduate-Level Google-Proof Q&A Benchmark. arXiv 2023, arXiv:2311.12022. [Google Scholar] [CrossRef]
  47. Muennighoff, N.; Tazi, N.; Magne, L.; Reimers, N. MTEB: Massive Text Embedding Benchmark. In Proceedings of the 17th Conference of the European Chapter of the Association for Computational Linguistics, Dubrovnik, Croatia, 2–6 May 2023; pp. 2014–2037. [Google Scholar] [CrossRef]
  48. White, J.; Fu, Q.; Hays, S.; Sandborn, M.; Olea, C.; Gilbert, H.; et al. A Prompt Pattern Catalog to Enhance Prompt Engineering with ChatGPT. In Proceedings of the 30th Conference on Pattern Languages of Programs (PLoP ’23); 2023; Article 5; pp. 1–31. [Google Scholar] [CrossRef]
  49. Es, S.; James, J.; Espinosa-Anke, L.; Schockaert, S. RAGAs: Automated Evaluation of Retrieval Augmented Generation. In Proceedings of the 18th Conference of the European Chapter of the Association for Computational Linguistics: System Demonstrations, St. Julian’s, Malta, 17–22 March 2024; pp. 150–158. [Google Scholar] [CrossRef]
  50. Brooke, J. SUS: A “Quick and Dirty” Usability Scale. In Usability Evaluation in Industry; Jordan, P.W., Thomas, B., Weerdmeester, B.A., McClelland, I.L., Eds.; Taylor & Francis: London, UK, 1996; pp. 189–194. [Google Scholar]
  51. Cronbach, L.J. Coefficient Alpha and the Internal Structure of Tests. Psychometrika 1951, 16, 297–334. [Google Scholar] [CrossRef]
  52. Nunnally, J.C.; Bernstein, I.H. Psychometric Theory, 3rd ed.; McGraw-Hill: New York, NY, USA, 1994. [Google Scholar]
  53. Bangor, A.; Kortum, P.T.; Miller, J.T. An Empirical Evaluation of the System Usability Scale. Int. J. Hum.–Comput. Interact. 2008, 24, 574–594. [Google Scholar] [CrossRef]
  54. Sauro, J.; Lewis, J.R. Quantifying the User Experience: Practical Statistics for User Research, 2nd ed.; Morgan Kaufmann: Cambridge, MA, USA, 2016. [Google Scholar]
  55. Nielsen, J.; Landauer, T.K. A Mathematical Model of the Finding of Usability Problems. In Proceedings of the INTERACT ’93 and CHI ’93 Conference on Human Factors in Computing Systems, Amsterdam, The Netherlands, 24–29 April 1993; pp. 206–213. [Google Scholar] [CrossRef]
  56. Patton, M.Q. Qualitative Research & Evaluation Methods: Integrating Theory and Practice, 4th ed.; SAGE Publications: Thousand Oaks, CA, USA, 2014. [Google Scholar]
Figure 1. Distribution of request types at IMARPE’s Transparency Office (n = 196). Routine, data-extractable queries (26.9%) constitute the automation target of the system.
Figure 1. Distribution of request types at IMARPE’s Transparency Office (n = 196). Routine, data-extractable queries (26.9%) constitute the automation target of the system.
Preprints 237733 g001
Figure 2. Response times (in business days) for access-to-information requests during the baseline period (n = 196). The solid red line marks the 10-day legal limit established by Law No. 27806; the dashed orange line marks the sample mean.
Figure 2. Response times (in business days) for access-to-information requests during the baseline period (n = 196). The solid red line marks the 10-day legal limit established by Law No. 27806; the dashed orange line marks the sample mean.
Preprints 237733 g002
Figure 3. ETL pipeline for knowledge ingestion. Institutional PDFs are transformed through structural extraction, LLM-based semantic curation, and graph-augmented indexing into a queryable knowledge base.
Figure 3. ETL pipeline for knowledge ingestion. Institutional PDFs are transformed through structural extraction, LLM-based semantic curation, and graph-augmented indexing into a queryable knowledge base.
Preprints 237733 g003
Figure 4. Bimodal agentic architecture orchestrated with LangGraph. The router directs each query to the MCP Text-to-SQL agent (IMARSIS relational database), to the LightRAG knowledge-graph module (yearbook documents), or to both, and the synthesizer merges their outputs. The referral protocol for out-of-scope queries (NONE route) is described in the text and is not depicted.
Figure 4. Bimodal agentic architecture orchestrated with LangGraph. The router directs each query to the MCP Text-to-SQL agent (IMARSIS relational database), to the LightRAG knowledge-graph module (yearbook documents), or to both, and the synthesizer merges their outputs. The referral protocol for out-of-scope queries (NONE route) is described in the text and is not depicted.
Preprints 237733 g004
Figure 5. Mean expert-panel score per evaluation dimension (n = 5 specialists, 30 test cases). Factual accuracy: 4.45/5; completeness: 4.10/5; clarity and usefulness: 4.57/5. The dashed line marks the 4.0 threshold.
Figure 5. Mean expert-panel score per evaluation dimension (n = 5 specialists, 30 test cases). Factual accuracy: 4.45/5; completeness: 4.10/5; clarity and usefulness: 4.57/5. The dashed line marks the 4.0 threshold.
Preprints 237733 g005
Figure 6. Mean score per SUS item (n = 30 users). Positively worded items (Q1, Q3, Q5, Q7, and Q9) scored between 4.00 and 4.30, and negatively worded items (Q2, Q4, Q6, Q8, and Q10, marked with an asterisk) scored between 1.67 and 1.87. Global SUS score: 80.42/100.
Figure 6. Mean score per SUS item (n = 30 users). Positively worded items (Q1, Q3, Q5, Q7, and Q9) scored between 4.00 and 4.30, and negatively worded items (Q2, Q4, Q6, Q8, and Q10, marked with an asterisk) scored between 1.67 and 1.87. Global SUS score: 80.42/100.
Preprints 237733 g006
Table 1. Knowledge sources, their characteristics, and the corresponding integration strategy.
Table 1. Knowledge sources, their characteristics, and the corresponding integration strategy.
Source Description Format Integration strategy Structure
Scientific-technological yearbooks Annual consolidated reports on fisheries biomass, oceanographic research, and institutional management (2010–2025) PDF (digital/scanned) Vector ingestion: extraction to Markdown, LLM-based semantic curation, indexing into a knowledge graph via LightRAG + Neo4j Unstructured (narrative text + complex tables)
IMARSIS database Taxonomic catalog and biological records of marine species; hydroacoustic and catch statistics SQL / relational (Oracle 19c) Agentic querying: Text-to-SQL agent via the MCP protocol with enriched DDL schema injection Structured (rows and columns)
Table 2. Comparison of the data-science methodologies considered for the project.
Table 2. Comparison of the data-science methodologies considered for the project.
Methodology Primary focus Relevance to this project
KDD [41] Academic and technical (pattern extraction) Low: focuses purely on the technical layer, disregarding the bureaucratic problem of response delay.
SEMMA [42] Tools and algorithms (statistical modeling) Low: assumes data is already structured, which does not apply to the processing of heterogeneous PDF yearbooks.
CRISP-DM [40] [SELECTED] Industrial and solution-oriented High: directly connects the citizen’s problem with data extraction and mandates an interactive final deployment.
Table 3. Qualitative comparison of candidate RAG architectures. The selected architecture is marked [SELECTED].
Table 3. Qualitative comparison of candidate RAG architectures. The selected architecture is marked [SELECTED].
Architecture Paradigm Retrieval mechanism Key advantages Key limitations
Naïve RAG [9] Vector-based (baseline) Cosine-similarity search Low cost; simple implementation Loses global context; fails at multi-hop reasoning over long documents
Sentence Window Contextual Context-window expansion Improves local coherence Does not resolve complex multi-hop queries
Parent Document Hierarchical Retrieves the parent document of the matched chunk Preserves original context Data redundancy; high storage cost
HyDE Generative Generates hypothetical answers to guide search Improves vague queries High latency: requires double inference, doubling cost and time
RAPTOR [24] Recursive Hierarchical summary trees Excellent for global questions Prohibitive cost: tree indexing consumes excessive tokens
Self-RAG [23] Agentic Self-critique and re-query cycle Maximum theoretical quality Too slow for a real-time citizen chat
KG-RAG Traditional graph Triples in a rigid ontology High logical precision Requires costly manual ontology maintenance
GraphRAG (Microsoft) [21] Community graph Pre-computed global summaries Holistic corpus view High construction cost (large number of LLM calls for indexing)
LightRAG [11] [SELECTED] Hybrid (dual) Vector index + keyword graph (dual-level retrieval) Optimal balance: retrieves specific entity details and global relations at low cost Depends on extraction quality (mitigated by the LLM curation stage)
NodeRAG [22] Heterogeneous graph Typed-node search (7 node types) Maximum scientific precision Very high engineering complexity; exceeds project timeline and resources
Table 4. Large language models considered for foundation-model selection (data from LLM-Stats, January 2026 [45]). The selected model is marked [SELECTED].
Table 4. Large language models considered for foundation-model selection (data from LLM-Stats, January 2026 [45]). The selected model is marked [SELECTED].
Model Developer Context (tokens) Input cost ($/1M) Output cost ($/1M) GPQA (%)
GPT-5.2 Pro OpenAI 400,000 $21.00 $168.00 93.2%
Gemini 3 Pro Google 1,048,576 $2.00 $12.00 91.9%
Claude Opus 4.5 Anthropic 200,000 $5.00 $25.00 87.0%
DeepSeek-V3.2 DeepSeek AI 131,072 $0.28 $0.42 82.4%
MiMo-V2-Flash Xiaomi 256,000 $0.10 $0.30 83.7%
Gemini 2.5 Flash [SELECTED] Google 1,048,576 $0.30 $2.50 82.8%
Table 5. Embedding models considered, as ranked on the MTEB leaderboard (accessed January 2026).
Table 5. Embedding models considered, as ranked on the MTEB leaderboard (accessed January 2026).
Rank Model Provider Params Dim. Deployment Key strengths
#1 KaLM-Embedding-Gemma3 Community 12B 4096 Local (GPU) Maximum global precision; requires costly dedicated hardware
#2 llama-embed-nemotron NVIDIA 8B 4096 API (NIM) Excellent for long-passage retrieval
#3 Qwen3-Embedding Alibaba 8B 3072 Local/API State-of-the-art multilingual performance; variable latency
#4 gemini-embedding-001 [SELECTED] Google N/A 3072 API High dimensionality, native ecosystem integration, low cost
#5 Qwen3-Embedding-4B Alibaba 4B 2560 Local Lightweight option for small servers
Table 6. Comparison of PDF parsing tools.
Table 6. Comparison of PDF parsing tools.
Tool Type Table handling Chart handling Cost
PyPDF / pypdf2 Python library Poor (plain text) None Free
Unstructured Open source Good (heuristic) Medium Freemium
Docling (IBM) AI model / API Very good Medium Free (local)
LlamaParse [SELECTED] Vision-language (GenAI) Excellent (multimodal) High (describes images) Paid (cloud)
Table 7. Comparison of graph-database engines.
Table 7. Comparison of graph-database engines.
Database engine Type Persistence Native algorithms License / RAG integration
Neo4j [SELECTED] Native graph High (disk) Complete (GDS library) GPL (Community) / Industry standard
NetworkX Python library Low (in-memory) Basic Open source / Prototypes only, does not scale
FalkorDB Graph (Redis) Medium (RAM) Limited Open source / Fast, immature ecosystem
Amazon Neptune Managed graph High (cloud) Complete Pay-per-hour / High cost (Enterprise)
Table 8. Comparison of re-ranking models (indicative costs as listed by each provider at the time of selection).
Table 8. Comparison of re-ranking models (indicative costs as listed by each provider at the time of selection).
Model Provider Context window Code/technical retrieval Cost / 1M queries
Jina Reranker v3 [SELECTED] Jina AI 8,192 tokens Very high $0.02
Cohere Rerank v3.5 Cohere 4,096 tokens High $2.00
BGE-Reranker-v2-m3 BAAI 8,192 tokens Medium Requires GPU (hardware cost)
Mixedbread (mxbai) Open source 512 tokens Low Variable
Table 9. Top 10 tables by number of incoming foreign-key references (referential integrity).
Table 9. Top 10 tables by number of incoming foreign-key references (referential integrity).
Parent table Foreign-key references
QI_PARAMETRO 208
QI_PERSONAL 50
QI_TAXON 49
OP_VIAJE 34
QI_LUGAR 21
QI_EMBARCACION 19
OP_ACTIVIDAD 14
QI_TAXON_CLASIFICACION 13
QI_ARTE_PESCA 12
QI_MUESTREADOR 10
Table 10. Top 10 tables by storage size in MB (storage volume).
Table 10. Top 10 tables by storage size in MB (storage volume).
Table Size (MB)
SP_VIAJE 2,368
SP_ACTIVIDAD_CARA 1,155
SP_ESPECIE 995
SP_ACTIVIDAD 821
SP_EBIO 248
WX_PRECIO 86
SP_SEXO 76
SP_LONGITUD 72
TMP_EST_FINAL_PROP 64
BI_LONGITUD_ESPECIE 45
Table 11. Top 10 tables by row count (transactional activity).
Table 11. Top 10 tables by row count (transactional activity).
Table Row count
SP_ACTIVIDAD_CARA 19,878,367
SP_ESPECIE 14,649,360
SP_ACTIVIDAD 7,644,321
SP_VIAJE 7,588,226
SP_EBIO 2,068,956
WX_PRECIO 1,372,639
SP_LONGITUD 1,171,146
SP_SEXO 1,124,498
BI_LONGITUD_ESPECIE 796,950
TMP_EST_FINAL_PROP 729,471
Table 12. Summary of expert-evaluation results by dimension (n = 5 evaluators, 30 test cases, 90 item-level scores).
Table 12. Summary of expert-evaluation results by dimension (n = 5 evaluators, 30 test cases, 90 item-level scores).
Dimension Mean score (1–5) Item-level scores ≥ 4.0 Rating
Factual accuracy 4.45 27/30 (90.0%) Excellent
Completeness 4.10 25/30 (83.3%) Good–Excellent
Clarity and usefulness 4.57 29/30 (96.7%) Excellent
GLOBAL 4.37 81/90 (90.0%) Excellent
Table 13. Characteristics of the traditional manual process and of the hybrid RAG system across the evaluated dimensions.
Table 13. Characteristics of the traditional manual process and of the hybrid RAG system across the evaluated dimensions.
Metric Traditional process (baseline) Hybrid RAG system Observation
Response time (routine queries) 12 business days (average) 20.43 s mean (maximum 49.20 s) Not directly comparable (software processing time vs. administrative handling; see Section 5.1)
Factual accuracy Not standardized (operator-dependent) 4.45/5 (expert panel) Rubric-based expert assessment (Section 4.1)
Usability (SUS) N/A 80.42/100 (grade A−) First quantified measurement
Automation None (fully manual) Automated first-level response for in-scope routine queries Level-1 automation; complex requests remain manual
Scalability Limited by human capacity Inference delegated to a cloud API Not evaluated under load in this study
Hallucination risk Not measured Mitigated by design (RAG grounding + referral protocol) Not directly measured; one extrapolation error observed (question 15)
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.
Copyright: This open access article is published under a Creative Commons CC BY 4.0 license, which permit the free download, distribution, and reuse, provided that the author and preprint are cited in any reuse.