This workflow follows the Chat Trigger → OpenAI recipe pattern — see all workflows that pair these two integrations.
The workflow JSON
Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →
{
"name": "RAG Chat Agent",
"nodes": [
{
"parameters": {},
"name": "Chat Trigger",
"type": "@n8n/n8n-nodes-langchain.chatTrigger",
"typeVersion": 1,
"position": [
250,
300
]
},
{
"parameters": {
"operation": "executeQuery",
"query": "SELECT chunk_text, metadata FROM article_chunks ORDER BY embedding <=> (SELECT embedding FROM article_chunks LIMIT 1) LIMIT 5"
},
"name": "Vector Search",
"type": "n8n-nodes-base.postgres",
"typeVersion": 1,
"position": [
500,
300
]
},
{
"parameters": {
"model": "gpt-4o-mini",
"messages": {
"values": [
{
"content": "You are an AI news assistant. Answer based on the provided context. Cite sources with URLs.\n\nContext: {{$json.context}}\n\nQuestion: {{$json.chatInput}}"
}
]
}
},
"name": "OpenAI Chat",
"type": "@n8n/n8n-nodes-langchain.openAi",
"typeVersion": 1,
"position": [
750,
300
]
}
],
"connections": {
"Chat Trigger": {
"main": [
[
{
"node": "Vector Search",
"type": "main",
"index": 0
}
]
]
},
"Vector Search": {
"main": [
[
{
"node": "OpenAI Chat",
"type": "main",
"index": 0
}
]
]
}
}
}
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
RAG Chat Agent. Uses chatTrigger, postgres, openAi. Chat trigger; 3 nodes.
Source: https://github.com/statnyk/ai-digest-rag/blob/f331ffcc6cc959966718c37e9241e5faec038e62/n8n-workflows/rag-chat-agent.json — original creator credit. Request a take-down →
Related workflows
Workflows that share integrations, category, or trigger type with this one. All free to copy and import.
This is the core AI agent used for queryverify.com.
HDW Lead Geländewagen. Uses chatTrigger, lmChatOpenAi, memoryBufferWindow, outputParserStructured. Chat trigger; 92 nodes.
Who’s it for Creators who want to create faceless videos automatically, while keeping human oversight and quality control.
The Best Linkedin Posting System. Uses httpRequest, lmChatOpenAi, agent, chatTrigger. Chat trigger; 49 nodes.
Community Node Disclaimer: This workflow uses KlickTipp community nodes.