Composable Prompt Modularization in Text-to-SQL Agents: A Practical Approach - Gonçalves, Daniele Carnaúba; Neves, Bárbara S.; Ferrufino, Paulina Irene Velasquez; Costa, Davi Uchoa Cavalcante; Venceslau, Amanda; Franco, Wellington; Macêdo, José Antônio; Holanda, Raimir (Anais do Simpósio Brasileiro de Banco de Dados (SBBD); 2026: Anais do XLI Simpósio Brasileiro de Bancos de Dados, 2026)
Text-to-SQL agents often rely on monolithic prompts that combine instructions and examples into a single block, making them difficult to maintain, less interpretable, and more prone to structural errors. To address these limitations, this work proposes a Composable Prompt Modularization approach that decomposes prompts into semantic components for question classification and Text-to-SQL generation, leveraging large language models within a modular prompting pipeline. We conduct a case study involving an intelligent assistant for the public sector. The results show that the modular architecture is a competitive alternative to monolithic prompting, achieving up to 95.39% execution accuracy and strong structural alignment, with average component-matching scores of 0.954. The findings reveal a trade-off between prompting strategies: while the monolithic prompt is slightly more efficient when fewer examples are available (Top-k = 3), the modular approach makes better use of additional context, improving execution accuracy by 0.66 percentage points at Top-k = 5 (94.74% vs. 94.08%). In the context of public transparency, where the availability of information enables citizens to interpret, validate, and audit data, the modular approach appears particularly well-suited.