Currently, when users ask natural language questions in Spotfire Copilot 2.1 that trigger SQL query generation via the orchestrator, any syntactic or semantic error in the resulting SQL leads to a failed execution with no recovery path. The user is forced to rephrase the original prompt and reinitiate the process—often multiple times—without clear feedback, resulting in frustration, inefficiency, and trial-and-error cycles.
Suggestion:
Implement an internal loopback mechanism within the orchestrator where, upon detecting a query error (caught via exception handling or query validator), the failed SQL is automatically routed to a specialized internal “SQL Repair Agent.”
This agent should:
Analyze the SQL error message.
Review the original user intent (from prior prompt or context window).
Regenerate a corrected SQL query version using either templated logic, GPT with error-aware prompts, or fine-tuned fallback models.
Retry execution transparently or provide an inline “Fix & Retry” suggestion.