This workflow follows the Agent → Chat Trigger 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": "ragflow-agent",
"nodes": [
{
"parameters": {
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.chatTrigger",
"typeVersion": 1.1,
"position": [
-1160,
-380
],
"id": "df11c50b-eadc-4cf0-a3dd-396912de72f4",
"name": "When chat message received"
},
{
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4o-mini"
},
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"typeVersion": 1.2,
"position": [
-912,
200
],
"id": "1602aa91-13d3-4a86-9fb2-24a029d4893b",
"name": "OpenAI Chat Model",
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"inputSource": "jsonExample",
"jsonExample": "{\n \"input\": \"find information about climate change with proper citations\",\n \"reason\": \"The request involves retrieving factual information with citations, which is the primary function of the RAGFlow Agent's document-grounded retrieval system.\",\n \"selectedAgent\": \"ragflow-agent\"\n}"
},
"type": "n8n-nodes-base.executeWorkflowTrigger",
"typeVersion": 1.1,
"position": [
-1160,
-20
],
"id": "6bc2e7f7-3d91-4401-9b67-c7ec4ddd4690",
"name": "When Executed by Another Workflow"
},
{
"parameters": {
"promptType": "define",
"text": "={{ $json.chatHistory && $json.chatHistory.length > 0 ? 'Previous conversation context:\\n' + $json.chatHistory.map(msg => msg.kwargs && msg.kwargs.content ? (msg.id && msg.id[2] === 'HumanMessage' ? 'User: ' : 'Assistant: ') + msg.kwargs.content : '').filter(text => text).join('\\n') + '\\n\\nCurrent request:\\n' + $json.input : $json.input }}",
"options": {
"systemMessage": "You are an AI assistant with access to RAGFlow, a document-grounded retrieval-augmented generation system. Your sole purpose is to assist users by retrieving and summarizing factual, citation-supported content from the RAGFlow knowledge base using the retrieve_knowledge tool.\n\n## HANDLING TOOL INQUIRIES\n\nWhen users ask \"what tools do you have?\" or similar questions about capabilities:\n- Reference the RAGFlow document retrieval and knowledge base capabilities documented below\n- Explain that you can retrieve and summarize citation-supported content from documents\n- Offer to help with specific knowledge retrieval or document-based question-answering tasks\n\nStrict Behavior Guidelines:\n\n No Prior Knowledge Use: You must never respond using your own knowledge or training data. All responses must be entirely based on the output of the retrieve_knowledge tool.\n\n Citations Required: Every response must include citations or source links provided by RAGFlow. These references should be clearly associated with the information presented.\n\n Fallback on No Result: If retrieve_knowledge returns no relevant content for a given query, respond politely and state:\n \"Sorry, I couldn't find any information on this topic in the available documents.\"\n Do not attempt to generate an answer independently.\n\n Faithful Summarization Only: Do not paraphrase or interpret retrieved content beyond what is clearly supported by the source. Maintain fidelity to the retrieved data.\n\n Tool Invocation: Always use the retrieve_knowledge tool before forming a response. Do not speculate or answer without tool output.\n\nYou are a transparent interface to trusted document-based information and should clearly reflect the limits and provenance of what you return.\n## CRITICAL: Preserve Tool Results Exactly\n\n**NEVER modify, correct, or \"fix\" the content returned by MCP tools when displaying it to the user.** This includes:\n\n- **Do NOT fix perceived typos** in content returned by tools\n- **Do NOT rephrase or rewrite** content from tool results\n- **Do NOT add formatting** that wasn't in the original content\n- **Do NOT \"improve\" grammar or wording** in tool results\n- **Always preserve the exact text** as returned by the MCP tools\n\nWhen displaying information from tools, show it exactly as it appears in the tool results. Your role is to present the information, not to edit or improve it. The user expects to see their actual data, not your interpretation of it."
}
},
"type": "@n8n/n8n-nodes-langchain.agent",
"typeVersion": 1.9,
"position": [
-940,
-20
],
"id": "a45a0bad-a704-4ba9-83b4-274fead0ad3f",
"name": "ragflow-agent"
},
{
"parameters": {
"sseEndpoint": "http://192.168.50.196:3015/sse"
},
"type": "@n8n/n8n-nodes-langchain.mcpClientTool",
"typeVersion": 1,
"position": [
-792,
200
],
"id": "730640cf-13b7-4908-8ce4-e6b6ddcb2af9",
"name": "all-tools"
}
],
"connections": {
"OpenAI Chat Model": {
"ai_languageModel": [
[
{
"node": "ragflow-agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"When Executed by Another Workflow": {
"main": [
[
{
"node": "ragflow-agent",
"type": "main",
"index": 0
}
]
]
},
"all-tools": {
"ai_tool": [
[
{
"node": "ragflow-agent",
"type": "ai_tool",
"index": 0
}
]
]
}
},
"active": true,
"settings": {
"executionOrder": "v1"
},
"versionId": "c15d712f-45ae-430a-94e2-1b3c7b8c505a",
"meta": {
"templateCredsSetupCompleted": true
},
"id": "297gKElp4LWZs47l",
"tags": []
}
Credentials you'll need
Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.
openAiApi
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
ragflow-agent. Uses chatTrigger, lmChatOpenAi, executeWorkflowTrigger, agent. Chat trigger; 5 nodes.
Source: https://github.com/dujonwalker/project-nova/blob/1cfff76201b1f929687d3d0b2e93aa82f4633418/n8n-workflows/ragflow_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.
flowise-agent. Uses chatTrigger, lmChatOpenAi, executeWorkflowTrigger, agent. Chat trigger; 5 nodes.
memos-agent. Uses chatTrigger, lmChatOpenAi, executeWorkflowTrigger, agent. Chat trigger; 5 nodes.
karakeep-agent. Uses chatTrigger, lmChatOpenAi, executeWorkflowTrigger, agent. Chat trigger; 5 nodes.
fetch-agent. Uses chatTrigger, lmChatOpenAi, mcpClientTool, executeWorkflowTrigger. Chat trigger; 5 nodes.
youtube-agent. Uses chatTrigger, lmChatOpenAi, mcpClientTool, executeWorkflowTrigger. Chat trigger; 5 nodes.