Setting up Agents to query your Snowflake Database
This guide will walk you through configuring Agents to query your Snowflake Database. Before following this guide, ensure that you have set up your Snowflake tools already by following the instructions [here](Snowflake Tools setup.md) .
To configure these agents, you will require the following components added to your project
- Snowflake SQL Query Tool
- Snowflake Metadata Retrieval Tool
- Memory object
- LLM model
Metadata Retrieval Agent
The Metadata Retrieval Agent will be a scheduled Agent to retrieve the Metadata associated with the Snowflake Database, and populate a Memory object.
SQL Query Agent
The SQL Query Agent will use the Metadata retrieved from the Memory object to allow the user to query their Database.
Agent Setups
Metadata Retrieval Agent
The Agent setup should have a LLM, Memory block, and Metadata Retrieval tool.
- Add the LLM to the Agent
- Add the Metadata Retrieval tool to the LLM
- Add the Memory block to the Agent
The following connections are needed:
- Input line to LLM
- LLM line to Output
- Memory line to Output
Schedule the Agent by
- Selecting the gear icon on the Input block
- Turning on Schedule Execution
- Providing a time range to repeat metadata retrieval. This would be based on how often you expect your data to change.
Metadata Retrieval Agent
The Agent setup should have a LLM, Memory block (same as previous), and SQL Query tool.
- Add the LLM to the Agent
- Add the SQL Query tool to the LLM
- Add the Memory block to the Agent
The following connections are needed:
- Input line to LLM
- LLM line to Output
- Memory line to LLM
Query the LLM by asking it questions relevant to your Database. Ensure that the Metadata agent has been run at least once before running queries, as it is required to populate any information about the database in the Memory block.