AI agent to chat with Snowflake database
Ready for 3.0What this workflow does
This AI workflow has 20 nodes and runs when a chat message arrives (plus 2 other triggers). Along the way it connects OpenAI Chat Model and Snowflake.
How it runs
Trigger: When a chat message arrives (plus 2 other triggers).
- AI Agent: runs an AI agent, with model: OpenAI Chat Model; 3 tools (DB Schema, Retrieve Data, Get table definition); memory: Simple Memory
- Execute SQL (Snowflake): run a query
- Snowflake: run a query
- Aggregate: combines items into one
- Return Error (Edit Fields (Set)): sets or maps fields
- Aggregate: combines items into one
- Error page (Edit Fields (Set)): sets 1 field: html
- If: checks a condition and branches into true / false
- Set HTML (Edit Fields (Set)): sets 1 field: html
- Respond to Webhook: sends the response back to the webhook caller
…plus 2 more steps. See the full node list below.
Services it uses
Before you upgrade to n8n 3.0
Nothing in this workflow is removed in n8n 3.0, so it should import and run after the upgrade.
Rarely used nodes in this template: n8n-nodes-base.snowflakeTool
Nodes used (13)
- Chat Trigger
@n8n/n8n-nodes-langchain.chatTrigger - AI Agent
@n8n/n8n-nodes-langchain.agent - OpenAI Chat Model
@n8n/n8n-nodes-langchain.lmChatOpenAi - Simple Memory
@n8n/n8n-nodes-langchain.memoryBufferWindow - Snowflake Tool
n8n-nodes-base.snowflakeTool - Webhook
n8n-nodes-base.webhook - Edit Fields (Set)
n8n-nodes-base.set - Respond to Webhook
n8n-nodes-base.respondToWebhook - Snowflake
n8n-nodes-base.snowflake - Aggregate
n8n-nodes-base.aggregate - Execute Workflow Trigger
n8n-nodes-base.executeWorkflowTrigger - Call n8n Workflow Tool
@n8n/n8n-nodes-langchain.toolWorkflow - If
n8n-nodes-base.if
From the author
Video Guide I prepared a detailed guide showcasing the process of building an AI agent that interacts with a Snowflake database using n8n. This setup enables conversational querying, secure execution of SQL queries, and dynamic report generation with rich…