n8n SQL Agent with Window Buffer Memory and OpenAI
detail.loadingPreview
Leverage n8n's LangChain integration to build a SQL agent with memory. This workflow uses OpenAI, a window buffer memory, and a local SQLite database to enable conversational querying.
🚀Ready to Deploy This Workflow?
About This Workflow
Overview
This n8n workflow demonstrates how to create a powerful SQL agent capable of understanding and querying a local SQLite database using natural language. It integrates with LangChain and OpenAI to provide an AI-driven experience. The workflow first sets up a local SQLite database (chinook.db) by downloading and extracting a sample file. Then, it configures a Chat Trigger to receive user queries, a Window Buffer Memory to maintain conversational context, and an OpenAI Chat Model to process requests. The AI Agent node, configured as a sqlAgent, interacts with the loaded SQLite database, allowing users to ask complex questions in plain English. The memory ensures that the agent can recall previous interactions, making the conversation more natural and effective.
Key Features
- Conversational SQL Querying: Interact with your SQLite database using natural language.
- AI-Powered Agent: Utilizes OpenAI's models for understanding and processing queries.
- Stateful Conversations: Employs
Window Buffer Memoryto retain context across multiple turns. - Local SQLite Database Integration: Works with a local
chinook.dbfile for data interaction. - Workflow Automation: Streamlines the setup and execution of an AI SQL agent.
How To Use
- Initial Setup: Execute the first part of the workflow (nodes:
Get chinook.zip example,Extract zip file,Save chinook.db locally) once to download and save thechinook.dbfile locally. - Trigger Chat: Interact with the
Chat Triggernode (or the webhook it generates) to send your questions. - Send Queries: Ask questions about the database, such as "Please describe the database" or "What are the revenues by genre?"
- Observe Responses: The AI Agent will process your query, interact with the SQLite database, and provide an answer, remembering previous conversation context.
Apps Used
Workflow JSON
{
"id": "6d489253-8958-49a2-a2cf-06fbbf4597e9",
"name": "n8n SQL Agent with Window Buffer Memory and OpenAI",
"nodes": 0,
"category": "AI & Machine Learning",
"status": "active",
"version": "1.0.0"
}Note: This is a sample preview. The full workflow JSON contains node configurations, credentials placeholders, and execution logic.
Get This Workflow
ID: 6d489253-8958...
About the Author
Crypto_Watcher
Web3 Developer
Automated trading bots and blockchain monitoring workflows.
Statistics
Verification Info
Related Workflows
Discover more workflows you might like
Telegram AI Langchain Bot with DALL-E 3 Image Generation
An n8n workflow that acts as a Telegram bot, powered by Langchain, for AI chat interactions and image generation using DALL-E 3.
Chat with Local LLMs via Ollama
Integrate and chat with your local Large Language Models using Ollama and n8n.
Visa Requirement Checker
A workflow to check visa requirements based on user input, leveraging Langchain, Cohere embeddings, Weaviate vector store, and Anthropic LLM.