🧑⚖️ AI法律助理代理 — 基于AI的法律问答与文档检索
中级
这是一个AI领域的自动化工作流,包含 11 个节点。主要使用 Telegram, Agent, TelegramTrigger, LmChatOpenAi, EmbeddingsOpenAi 等节点,结合人工智能技术实现智能自动化。 🧑⚖️ AI法律助理代理 — 基于AI的法律问答与文档检索
前置要求
- •Telegram Bot Token
- •OpenAI API Key
- •Pinecone API Key
使用的节点 (11)
分类
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"id": "rPicfavvntizpQkM",
"meta": {
"instanceId": "1c7b08fed4406d546caf4a44e8b942ca317e7e207bb9a5701955a1a6e1ce1843",
"templateCredsSetupCompleted": true
},
"name": "Legal Assistant Agent",
"tags": [],
"nodes": [
{
"id": "81b14e7a-0dde-4dd3-aa1b-943c1857903d",
"name": "AI Agent",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
220,
0
],
"parameters": {
"text": "={{ $json.message.text }}",
"options": {
"systemMessage": "You are a helpful legal assistant. Your task is to answer legal questions of the users by referring to the Pinecone Vector Database \"Legal Contract Library\" to get an accurate answer. \n#Rule\nDo not make up facts, if you do not have the right information, you may say so."
},
"promptType": "define"
},
"typeVersion": 2
},
{
"id": "53d344e5-773b-432a-8940-00a9b6814ee8",
"name": "OpenAI Chat Model",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
80,
240
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4o-mini"
},
"options": {}
},
"credentials": {
"openAiApi": {}
},
"typeVersion": 1.2
},
{
"id": "38b9de84-bfee-4d66-b22a-f95bcd78b9a6",
"name": "Embeddings OpenAI",
"type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
"position": [
520,
360
],
"parameters": {
"options": {}
},
"credentials": {
"openAiApi": {}
},
"typeVersion": 1.2
},
{
"id": "be801891-2ac9-4871-b54b-72491eb9b962",
"name": "Legal Contract Library",
"type": "@n8n/n8n-nodes-langchain.vectorStorePinecone",
"position": [
360,
240
],
"parameters": {
"mode": "retrieve-as-tool",
"options": {},
"toolName": "Redacted",
"pineconeIndex": {
"__rl": true,
"mode": "id",
"value": "Redacted"
},
"toolDescription": "Extract, contracts, legal policies and relevant regulatory documents here."
},
"credentials": {
"pineconeApi": {}
},
"typeVersion": 1.1
},
{
"id": "8cbbb27e-5c31-4c8e-93a1-7515b28649b6",
"name": "Telegram",
"type": "n8n-nodes-base.telegram",
"position": [
820,
0
],
"webhookId": "",
"parameters": {
"text": "={{ $json.output }}",
"chatId": "",
"additionalFields": {
"appendAttribution": false
}
},
"credentials": {
"telegramApi": {}
},
"typeVersion": 1.2
},
{
"id": "c664b9b0-cf1b-454c-b943-adcc3f0a8de5",
"name": "Telegram Trigger",
"type": "n8n-nodes-base.telegramTrigger",
"position": [
-200,
0
],
"webhookId": "",
"parameters": {
"updates": [
"message"
],
"additionalFields": {}
},
"credentials": {
"telegramApi": {}
},
"typeVersion": 1.2
},
{
"id": "f4fa00fd-5e18-4a81-8263-b3bf2d52cb9e",
"name": "Simple Memory1",
"type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
"position": [
240,
240
],
"parameters": {
"sessionKey": "={{ $('Telegram Trigger').item.json.message.chat.id }}",
"sessionIdType": "customKey",
"contextWindowLength": 10
},
"typeVersion": 1.3
},
{
"id": "f2aff94c-ad46-4759-90f0-368d420219e2",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
-340,
-160
],
"parameters": {
"width": 340,
"height": 700,
"content": "Telegram Message Trigger"
},
"typeVersion": 1
},
{
"id": "4eb385e9-5caf-46f3-97a3-bac95c210c78",
"name": "Sticky Note1",
"type": "n8n-nodes-base.stickyNote",
"position": [
20,
-160
],
"parameters": {
"color": 3,
"width": 720,
"height": 700,
"content": "Legal Asssistant AI Agent"
},
"typeVersion": 1
},
{
"id": "252a59c6-90aa-4ca4-9a4e-2905b69cc984",
"name": "Sticky Note2",
"type": "n8n-nodes-base.stickyNote",
"position": [
760,
-160
],
"parameters": {
"color": 4,
"width": 280,
"height": 700,
"content": "Telegram Output"
},
"typeVersion": 1
},
{
"id": "beaef1c7-48cb-4f35-a0d7-b5819a0e99fe",
"name": "Sticky Note3",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1180,
-160
],
"parameters": {
"color": 6,
"width": 820,
"height": 1180,
"content": "🧑⚖️ Legal Assistant Agent — AI-Powered Legal Q&A with Document Retrieval\nCategory: LegalTech / AI Agent / RAG / Chatbot\n\nDescription:\nThis no-code AI agent acts as a legal assistant chatbot that can answer user queries by retrieving information from a pre-indexed legal document library. It’s powered by OpenAI + Pinecone + Telegram and designed for law firms, compliance teams, or anyone who needs instant answers from contracts, policies, or regulatory documents.\n\nFor more of such builds and step-by-step video tutorial, check out:\nhttps://www.youtube.com/@Automatewithmarc\n\n🔍 How it Works:\n\nTelegram Trigger – Starts when a user sends a message via Telegram.\n\nAI Agent (GPT-4o) – Uses a retrieval-augmented generation (RAG) setup to understand the question and pull relevant context.\n\nPinecone Vector Store – Searches across a vectorized legal contract library for relevant clauses or documents.\n\nOpenAI Embeddings – Converts uploaded documents into vector embeddings for efficient search.\n\nMemory Buffer – Maintains conversation flow and context for follow-up questions.\n\nTelegram Response – Sends the final AI-generated answer directly to the user.\n\n🎯 Use Cases:\n\nIn-house legal teams automating internal policy Q&A\n\nLaw firms building client-facing legal bots\n\nStartups offering legal tech services with document-based queries\n\nCompliance teams monitoring contract terms and obligations\n\n✅ Key Features:\n\nReal-time legal Q&A via Telegram\n\nPinecone + OpenAI-powered vector search\n\nRetrieval-Augmented Generation (RAG) setup\n\nFactual, memory-aware assistant with fallback if info is unavailable\n\nFully customizable and extendable\n\n⚙️ Setup Instructions:\n\nConnect OpenAI, Pinecone, and Telegram credentials\n\nUpload your contracts or policy docs into Pinecone\n\nCustomize the system prompt or expand document sources as needed\n\nActivate and test via Telegram\n\nThis workflow is a solid foundation for any AI-powered legal assistant or chatbot solution—highly relevant for modern LegalOps and knowledge management teams."
},
"typeVersion": 1
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "0cec767c-2903-4bfb-999a-5668fcadd39d",
"connections": {
"81b14e7a-0dde-4dd3-aa1b-943c1857903d": {
"main": [
[
{
"node": "8cbbb27e-5c31-4c8e-93a1-7515b28649b6",
"type": "main",
"index": 0
}
]
]
},
"f4fa00fd-5e18-4a81-8263-b3bf2d52cb9e": {
"ai_memory": [
[
{
"node": "81b14e7a-0dde-4dd3-aa1b-943c1857903d",
"type": "ai_memory",
"index": 0
}
]
]
},
"c664b9b0-cf1b-454c-b943-adcc3f0a8de5": {
"main": [
[
{
"node": "81b14e7a-0dde-4dd3-aa1b-943c1857903d",
"type": "main",
"index": 0
}
]
]
},
"38b9de84-bfee-4d66-b22a-f95bcd78b9a6": {
"ai_embedding": [
[
{
"node": "be801891-2ac9-4871-b54b-72491eb9b962",
"type": "ai_embedding",
"index": 0
}
]
]
},
"53d344e5-773b-432a-8940-00a9b6814ee8": {
"ai_languageModel": [
[
{
"node": "81b14e7a-0dde-4dd3-aa1b-943c1857903d",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"be801891-2ac9-4871-b54b-72491eb9b962": {
"ai_tool": [
[
{
"node": "81b14e7a-0dde-4dd3-aa1b-943c1857903d",
"type": "ai_tool",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
中级 - 人工智能
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
GPT-5 RAG客户支持代理
使用GPT-5、Telegram和Pinecone构建客户支持RAG代理
Telegram
Agent
Telegram Trigger
+
Telegram
Agent
Telegram Trigger
11 节点Automate With Marc
客服机器人
使用GPT4-mini和Google Docs知识库创建Telegram客户支持
使用GPT4-mini和Google Docs知识库创建Telegram客户支持机器人
Telegram
Google Docs Tool
Agent
+
Telegram
Google Docs Tool
Agent
10 节点Automate With Marc
客户支持
Slack项目更新RAG代理
使用GPT和Pinecone向量RAG上下文自动回复Slack消息
Slack
Slack Trigger
Agent
+
Slack
Slack Trigger
Agent
11 节点Automate With Marc
AI RAG 检索增强
使用 GPT-5、Pinecone 和 Tavily 研究实现个性化销售自动跟进
使用 GPT-5、Pinecone 和 Tavily 研究实现个性化销售自动跟进
Gmail
Form Trigger
Agent
+
Gmail
Form Trigger
Agent
12 节点Automate With Marc
客户培育
组合式图像转视频助手
通过 Telegram、GPT-4.1 和 Seedance/Veo3 集成从图片生成视频
If
Wait
Telegram
+
If
Wait
Telegram
22 节点Automate With Marc
内容创作
构建与销售AI自动化与智能体
构建与销售AI自动化与智能体
If
Set
Wait
+
If
Set
Wait
74 节点NICKYAI
其他
工作流信息
难度等级
中级
节点数量11
分类1
节点类型8
作者
Automate With Marc
@marconiAutomating Start-Up and Business processes. Helping non-techies understand and leverage Agentic AI with easy to understand step-by-step tutorials. Check out my educational content: https://www.youtube.com/@Automatewithmarc
外部链接
在 n8n.io 查看 →
分享此工作流