Talk to your SQLite database with a LangChain AI Agent 🧠💬
Needs changesWhat this workflow does
This AI workflow has 10 nodes and runs manually, when you click “Execute workflow” (plus 1 other trigger). Along the way it connects OpenAI Chat Model. It also calls sqlitetutorial.net over HTTP.
How it runs
Trigger: Manually, when you click “Execute workflow” (plus 1 other trigger).
- Get chinook.zip example (HTTP Request): calls sqlitetutorial.net
- Load local chinook.db (Read/Write Files from Disk): reads a file from disk
- Extract zip file (Compression): uses Compression
- Combine chat input with the binary (Edit Fields (Set)): sets or maps fields
- Save chinook.db locally (Read/Write Files from Disk): writes a file to disk
- AI Agent: runs an AI agent, with model: OpenAI Chat Model; memory: Window Buffer Memory
Services it uses
HTTP calls to: sqlitetutorial.net
Before you upgrade to n8n 3.0
1 thing in this workflow is removed in n8n 3.0. Fix it before you upgrade:
- AI Agent v1 (old agent modes) in AI Agent (v1.6): replace with Latest AI Agent node (Tools Agent). For SQL Agent, use a Postgres or MySQL tool with a recent AI Agent.
| Removed in 3.0 | Replace with |
|---|---|
| AI Agent v1 (old agent modes) AI Agent (v1.6) | Latest AI Agent node (Tools Agent). For SQL Agent, use a Postgres or MySQL tool with a recent AI Agent. |
Nodes used (9)
- Simple Memory
@n8n/n8n-nodes-langchain.memoryBufferWindow - OpenAI Chat Model
@n8n/n8n-nodes-langchain.lmChatOpenAi - Manual Trigger
n8n-nodes-base.manualTrigger - HTTP Request
n8n-nodes-base.httpRequest - Compression
n8n-nodes-base.compression - Read/Write Files from Disk
n8n-nodes-base.readWriteFile - Edit Fields (Set)
n8n-nodes-base.set - AI Agent
@n8n/n8n-nodes-langchain.agent - Chat Trigger
@n8n/n8n-nodes-langchain.chatTrigger
From the author
This n8n workflow demonstrates how to create an agent using LangChain and SQLite. The agent can understand natural language queries and interact with a SQLite database to provide accurate answers. 💪 🚀 Setup Run the top part of the workflow once. It…