A Streamlit in Snowflake (SiS) application powered by Snowflake Intelligence Agents to automatically detect, analyze, validate, and deploy query performance improvements.
- Performance Collection Agent: Scans
QUERY_HISTORYfor slow queries and uses LLM to suggest DDL improvements. - Performance Validation Agent: Creates a zero-copy clone of the target database, applies the fix, and runs the query to verify performance gains.
- Production Implementation Agent: Deploys the validated fix to production and handles rollback (revert) if needed.
- Streamlit UI: Provides the interface for the user to trigger these agents and view logs.
Run the following SQL scripts in your Snowflake account (e.g., via Snowsight Worksheets) in order:
sql/setup/01_infrastructure.sql- Creates Database, Schema, Tables.sql/procedures/02_analysis_tools.sql- Creates Analysis tools.sql/procedures/03_validation_tools.sql- Creates Validation logic (Cloning).sql/procedures/04_deployment_tools.sql- Creates Deployment/Revert logic.sql/setup/05_agents.sql- (Optional*) Defines the Cortex Agents.
> Note: Step 5 requires Snowflake Cortex Agents (Project Polaris) enabled in your account. The Streamlit app simulates the agent behavior by calling tools directly if the Agent Service is not fully configured.
- Open Snowsight -> Streamlit.
- Create a New Streamlit App.
- Select the
PERFORMANCE_OPTI_APPdatabase andCOREschema (created in step 1). - Paste the contents of
streamlit/app.pyinto the editor. - Run the app.
- Analysis: Go to the "Analysis" tab and click "Run Performance Scan". The agent will identify slow queries.
- Validation: Go to the "Validation" tab. Select a recommendation. The agent will clone your DB, apply the fix, and test it.
- Deployment: Go to the "Deployment" tab. Deploy validated fixes to production. You can also Revert changes here.