SQL agent with memory

Run this part only once This section: downloads the example zip file from https://www.sqlitetutorial.net/sqlite-sample-database/ extracts the archive (it contains only a single file) saves the extracted chinook.db SQLite database locally Now you can use chat to "talk" to your data!

Workflow Structure (10 nodes)
100%
Manual Trigger
When clicking "Test workflow"
Http Request
Get chinook.zip example
Compression
Extract zip file
Read Write File
Save chinook.db locally
Langchain.chat Trigger
Chat Trigger
Read Write File
Load local chinook.db
Set
Combine chat input with the binary
Langchain.lm Chat Open Ai
OpenAI Chat Model
Langchain.agent
AI Agent
Langchain.memory Buffer Window
Window Buffer Memory
Node Types:
default
trigger
http
transform
Requires credentials

Prerequisites

Required Credentials (1)

OpenAI

Used by: OpenAI Chat Model

Docs

Complexity

Moderate

Some experience helpful. Multiple integrations or logic.

Setup time: ~20 min
Score: 28/100
4 Integrations

When to Use This Workflow

Real-time Response

React instantly when events happen - new orders, form submissions, or API calls.

Zero delay between trigger and action for time-sensitive workflows.

Time Savings

Replace repetitive manual tasks with reliable automation.

Reclaim hours every week for higher-value work.

Error Reduction

Eliminate human error from routine processes with consistent automation.

Improve accuracy and reliability across your workflows.

workflow.json
{
  "id": "AQJ6QnF2yVdCWMnx",
  "meta": {
    "instanceId": "fb924c73af8f703905bc09c9ee8076f48c17b596ed05b18c0ff86915ef8a7c4a",
    "templateCredsSetupCompleted": true
  },
  "name": "SQL agent with memory",
  "tags": [],
  "nodes": [
    {
      "id": "3544950e-4d8e-46ca-8f56-61c152a5cae3",
      "name": "Window Buffer Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        1220,
        500
      ],
      "parameters": {
        "contextWindowLength": 10
      },
...

Workflow Details

Nodes
13
Trigger
Event
Source
awesome
Added
Dec 4, 2025

Need Help?

Check out the official n8n documentation for detailed guides.

Related Workflows

Generate SQL queries from schema only - AI-powered

Run this part only once This section: loads a list of all tables from the database hosted on [db4free](https://db4free....

Lmchatopenai
Memorybufferwindow
Mysql
Readwritefile
29 nodesEvent
Curated

Build a Tax Code Assistant with Qdrant, Mistral.ai and OpenAI

Step 1. Download the Tax Code PDF [Read more about handling Zip Files](https://docs.n8n.io/integrations/builtin/core-nod...

Embeddingsmistralcloud
Documentdefaultdataloader
Textsplitterrecursivecharactertextsplitter
Http-request
38 nodesEvent
Curated

🔥📈🤖 AI Agent for n8n Creators Leaderboard - Find Popular Workflows

AI Agent for n8n Creator Leaderboard Stats https://github.com/teds-tech-talks/n8n-community-leaderboard

Http-request
Lmchatopenai
Executeworkflow
Chat
43 nodesEvent
Curated

Chat with Postgresql Database

👨‍🎤 Setup 1. Add your postgresql and OpenAI credentials. 2. Click Chat button and start asking questions to your datab...

Chat
Agent
Lmchatopenai
Postgrestool
11 nodesEvent
Curated

MongoDB Agent

AI Agent powered by OpenAI and MongoDB This flow is designed to work as an AI autonomous agent that can get chat message...

Lmchatopenai
Mongodbtool
Memorybufferwindow
Chat
8 nodesEvent
Curated

Chat with GitHub OpenAPI Specification using RAG (Pinecone and OpenAI)

Indexing content in the vector database This part of the workflow is responsible for extracting content, generating embe...

Http-request
Vectorstorepinecone
Documentdefaultdataloader
Textsplitterrecursivecharactertextsplitter
17 nodesEvent
Curated