Help Needed: Refactoring SQL Agent Code for Schema Validation in Multi-Agent Workflow

Thank you for your response! I truly appreciate your input. I’m working on dashboard automation where I send a query (in natural language) and a datasource as input. Based on this, I need to dynamically generate both SQL and HTML code to create widgets.

I’m using four agents for this process: one to generate SQL, another to execute it, a third to analyze the results and suggest suitable widgets, and a fourth to generate HTML, JavaScript, and CSS code for rendering the widgets.Additionally, I need the generated SQL to be stored for further reference in another task.

I’d love to hear your thoughts on this approach and any suggestions you might have for improving or optimizing it.

Thanks again for your help! Looking forward to hearing more of your insights.