构建您的第一个AI代理
中级
这是一个Personal Productivity, AI Chatbot领域的自动化工作流,包含 14 个节点。主要使用 Agent, HttpRequestTool, RssFeedReadTool, ChatTrigger, LmChatGoogleGemini 等节点。 构建您的第一个AI代理
前置要求
- •可能需要目标 API 的认证凭证
- •Google Gemini API Key
使用的节点 (14)
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"meta": {
"creator": "Lucas Peyrin",
"instanceId": "e409ea34548a2afe2dffba31130cd1cf2e98ebe2afaeed2a63caf2a0582d1da0",
"fingerprint": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjcmVhdG9yIjoiIiwiaXNzIjoibjhuIiwiaWF0IjoxNzUzMTg2MDc5fQ.gRNpFsXu1gvbRjF8go3KFo3jb2QzVaW8xxpHyokvtL0"
},
"nodes": [
{
"id": "304155b6-fa12-4b99-972c-4f209010f6b3",
"cid": "Ikx1Y2FzIFBleXJpbiI",
"name": "介绍说明",
"type": "n8n-nodes-base.stickyNote",
"notes": "© 2025 Lucas Peyrin",
"creator": "Lucas Peyrin",
"position": [
-128,
-16
],
"parameters": {
"width": 392,
"height": 524,
"content": "## 🚀 立即试用!"
},
"typeVersion": 1
},
{
"id": "2041cd29-7c6f-4a96-a9a6-ea6b45e0e075",
"cid": "Ikx1Y2FzIFBleXJpbiI",
"name": "便签12",
"type": "n8n-nodes-base.stickyNote",
"notes": "© 2025 Lucas Peyrin",
"creator": "Lucas Peyrin",
"position": [
336,
-16
],
"parameters": {
"color": 7,
"width": 316,
"height": 412,
"content": "## 💬 聊天界面"
},
"typeVersion": 1
},
{
"id": "786635f6-6fe8-429a-95de-179c6006c33b",
"cid": "Ikx1Y2FzIFBleXJpbiI",
"name": "便签13",
"type": "n8n-nodes-base.stickyNote",
"notes": "© 2025 Lucas Peyrin",
"creator": "Lucas Peyrin",
"position": [
720,
-16
],
"parameters": {
"color": 7,
"width": 620,
"height": 364,
"content": "## 🤖 您的 AI Agent"
},
"typeVersion": 1
},
{
"id": "a6dcf475-a714-41b6-8317-a4280bfc5709",
"cid": "Ikx1Y2FzIFBleXJpbiI",
"name": "便签 15",
"type": "n8n-nodes-base.stickyNote",
"notes": "© 2025 Lucas Peyrin",
"creator": "Lucas Peyrin",
"position": [
720,
544
],
"parameters": {
"color": 7,
"width": 324,
"height": 276,
"content": "此节点让您的代理记住最近的几条消息以保持话题连贯。通过 **上下文窗口长度** 设置进行调整。"
},
"typeVersion": 1
},
{
"id": "254547dd-a977-46a3-9ddb-7980600ef68f",
"cid": "Ikx1Y2FzIFBleXJpbiI",
"name": "便签16",
"type": "n8n-nodes-base.stickyNote",
"notes": "© 2025 Lucas Peyrin",
"creator": "Lucas Peyrin",
"position": [
1104,
544
],
"parameters": {
"color": 7,
"width": 436,
"height": 324,
"content": "这些工具让您的代理能够引入现实世界的数据。"
},
"typeVersion": 1
},
{
"id": "b2439d89-7411-4e78-a5cf-d69e83eb7156",
"cid": "Ikx1Y2FzIFBleXJpbiI",
"name": "便签17",
"type": "n8n-nodes-base.stickyNote",
"notes": "© 2025 Lucas Peyrin",
"width": 380,
"height": 380,
"creator": "Lucas Peyrin",
"position": [
336,
544
],
"parameters": {
"color": 3,
"width": 320,
"height": 528,
"content": "⚠️ 要使用 Gemini,您需要从 Google 获取一个 *免费* 的 API 密钥:"
},
"typeVersion": 1
},
{
"id": "34121307-276d-449c-8f05-f223358748a2",
"cid": "Ikx1Y2FzIFBleXJpbiI",
"name": "便签1",
"type": "n8n-nodes-base.stickyNote",
"notes": "© 2025 Lucas Peyrin",
"creator": "Lucas Peyrin",
"position": [
1552,
544
],
"parameters": {
"color": 7,
"width": 304,
"height": 320,
"content": "### ➕ 连接更多工具"
},
"typeVersion": 1
},
{
"id": "bdf6dfb4-4a4a-48f6-b53e-d246c81028f5",
"cid": "Ikx1Y2FzIFBleXJpbiI",
"name": "获取新闻",
"type": "n8n-nodes-base.rssFeedReadTool",
"notes": "© 2025 Lucas Peyrin",
"creator": "Lucas Peyrin",
"position": [
1376,
576
],
"parameters": {
"url": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('URL', `Use one of:\n- https://feeds.bbci.co.uk/news/world/rss.xml (BBC World – global headlines)\n- https://www.aljazeera.com/xml/rss/all.xml (Al Jazeera English – in‑depth global coverage)\n- http://rss.cnn.com/rss/edition_world.rss (CNN World – breaking news worldwide)\n- https://techcrunch.com/feed/ (TechCrunch – global tech & startup news)\n- http://news.ycombinator.com/rss (Hacker News – tech community headlines)\n- https://n8n.io/blog/rss (n8n Blog – updates & tutorials)\n- https://www.bonappetit.com/feed/recipes-rss-feed/rss (Bon Appétit – recent recipes list)\n- https://www.endsreport.com/rss/news-and-analysis (ENDS Report – environmental law & policy news)\n- https://medlineplus.gov/groupfeeds/new.xml (MedlinePlus – health topics & wellness updates)`, 'string') }}",
"options": {},
"toolDescription": "Gets the latest blog posts about any rss feed."
},
"typeVersion": 1.2
},
{
"id": "7bc90c6b-aae8-4956-9ee7-3993f0586a09",
"cid": "Ikx1Y2FzIFBleXJpbiI",
"name": "获取天气",
"type": "n8n-nodes-base.httpRequestTool",
"notes": "© 2025 Lucas Peyrin",
"creator": "Lucas Peyrin",
"position": [
1184,
576
],
"parameters": {
"url": "https://api.open-meteo.com/v1/forecast",
"options": {},
"sendQuery": true,
"queryParameters": {
"parameters": [
{
"name": "latitude",
"value": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('parameters0_Value', `Latitude of the location, e.g. 45.75 for Lyon. Do not ask the user just infer it automatically.`, 'string') }}"
},
{
"name": "longitude",
"value": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('parameters1_Value', `Longitude of the location, e.g. 4.85 for Lyon. Do not ask the user just infer it automatically.`, 'string') }}"
},
{
"name": "current",
"value": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('parameters2_Value', `Comma-separated list of current weather variables (no whitespace).\n\nExample: temperature_2m,windspeed_10m,rain.\n\nOptions: temperature_2m,relative_humidity_2m,apparent_temperature,is_day,precipitation,rain,showers,snowfall,weathercode,cloudcover_total,pressure_msl,surface_pressure,windspeed_10m,winddirection_10m,windgusts_10m.`, 'string') }}"
},
{
"name": "hourly",
"value": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('parameters3_Value', `Comma-separated list of hourly weather variables (no whitespace). Hourly is only useful to get one day's information. For weakly overview please use daily.\n\nExample: temperature_2m,precipitation.\n\nOptions: temperature_2m,relative_humidity_2m,dewpoint_2m,apparent_temperature,precipitation,rain,showers,snowfall,snow_depth,pressure_msl,surface_pressure,cloudcover_total,cloudcover_low,cloudcover_mid,cloudcover_high,windspeed_10m,winddirection_10m,windgusts_10m,visibility,is_day,sunshine_duration,soil_temperature,soil_moisture,PM10,PM2_5,carbon_monoxide,ozone,us_aqi,UV_index.`, 'string') }}"
},
{
"name": "daily",
"value": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('parameters4_Value', `Comma-separated list of daily weather variables (no whitespace).\n\nExample: temperature_2m_max,precipitation_sum.\n\nOptions: weathercode,temperature_2m_max,temperature_2m_min,apparent_temperature_max,apparent_temperature_min,precipitation_sum,rain_sum,showers_sum,snowfall_sum,precipitation_hours,sunrise,sunset,daylight_duration,sunshine_duration,pressure_msl_max,pressure_msl_min,surface_pressure_max,surface_pressure_min,windgusts_10m_max,windspeed_10m_max,winddirection_10m_dominant,shortwave_radiation_sum.`, 'string') }}"
},
{
"name": "start_date",
"value": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('parameters5_Value', `Start date in YYYY-MM-DD format. Example: 2025-07-15`, 'string') }}"
},
{
"name": "end_date",
"value": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('parameters6_Value', `End date in YYYY-MM-DD format. Must be after start_date. Example: 2025-07-18`, 'string') }}"
},
{
"name": "temperature_unit",
"value": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('parameters7_Value', `Unit for temperature. Options: celsius (default), fahrenheit.`, 'string') }}"
}
]
},
"toolDescription": "Get weather forecast anywhere, anytime. You can make requests by assuming most information, the only thing you need is the location (use the city name to infer lat and long automatically) and time period (assume today if not specified)"
},
"typeVersion": 4.2
},
{
"id": "0bc33a3d-df28-4f4e-9616-15b6f50db721",
"cid": "Ikx1Y2FzIFBleXJpbiI",
"name": "您的第一个 AI Agent",
"type": "@n8n/n8n-nodes-langchain.agent",
"notes": "© 2025 Lucas Peyrin",
"creator": "Lucas Peyrin",
"position": [
880,
224
],
"parameters": {
"options": {
"systemMessage": "=<role>\nYou are the n8n Demo AI Agent, a friendly and helpful assistant designed to showcase the power of AI agents within the n8n automation platform. Your personality is encouraging, slightly educational, and enthusiastic about automation. Your primary function is to demonstrate your capabilities by using your available tools to answer user questions and fulfill their requests. You are conversational.\n</role>\n\n<instructions>\n<goal>\nYour primary goal is to act as a live demonstration of an AI Agent built with n8n. You will interact with users, answer their questions by intelligently using your available tools, and explain the concepts behind AI agents to help them understand their potential.\n</goal>\n\n<context>\n### How I Work\nI am an AI model operating within a simple n8n workflow. This workflow gives me two key things:\n1. **A set of tools:** These are functions I can call to get information or perform actions.\n2. **Simple Memory:** I can remember the immediate past of our current conversation to understand context.\n\n### My Purpose\nMy main purpose is to be a showcase. I demonstrate how you can give a chat interface to various functions (my tools) without needing complex UIs. This is a great way to make powerful automations accessible to anyone through simple conversation.\n\n### My Tools Instructions\nYou must choose one of your available tools if the user's request matches its capability. You cannot perform these actions yourself; you must call the tool.\n\n### About AI Agents in n8n\n- **Reliability:** While I can use one tool at a time effectively, more advanced agents can perform multi-step tasks. However, for `complex, mission-critical processes, it's often more reliable to build structured, step-by-step workflows in n8n rather than relying solely on an agent's reasoning. Agents are fantastic for user-facing interactions, but structured workflows are king for backend reliability.\n- **Best Practices:** A good practice is to keep an agent's toolset focused, typically under 10-15 tools, to ensure reliability and prevent confusion.\n\n### Current Date & Time\n{{ $now }}\n</context>\n\n<output_format>\n- Respond in a friendly, conversational, and helpful tone.\n- When a user's request requires a tool, first select the appropriate tool. Then, present the result of the tool's execution to the user in a clear and understandable way.\n- Be proactive. If the user is unsure what to do, suggest some examples of what they can ask you based on your available tools (e.g., Talk about your tools and what you know about yourself).\n</output_format>\n</instructions>"
}
},
"typeVersion": 2.2
},
{
"id": "9d3ebd44-788b-47f7-989e-a122b16b2150",
"cid": "Ikx1Y2FzIFBleXJpbiI",
"name": "便签",
"type": "n8n-nodes-base.stickyNote",
"notes": "© 2025 Lucas Peyrin",
"creator": "Lucas Peyrin",
"position": [
336,
400
],
"parameters": {
"color": 7,
"width": 316,
"height": 80,
"content": "💡 稍后,您可以激活工作流并分享公共聊天 URL,让其他人(如客户)与您的 AI Agent 互动!"
},
"typeVersion": 1
},
{
"id": "320f3c68-7bcf-4e7a-8654-c66661afb7b7",
"cid": "Ikx1Y2FzIFBleXJpbiI",
"name": "连接您的模型",
"type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
"notes": "© 2025 Lucas Peyrin",
"creator": "Lucas Peyrin",
"position": [
448,
592
],
"parameters": {
"options": {
"temperature": 0
}
},
"typeVersion": 1
},
{
"id": "e0fa1490-62ba-4fd2-b3cb-4787a10258b6",
"cid": "Ikx1Y2FzIFBleXJpbiI",
"name": "示例聊天",
"type": "@n8n/n8n-nodes-langchain.chatTrigger",
"notes": "© 2025 Lucas Peyrin",
"creator": "Lucas Peyrin",
"position": [
448,
224
],
"webhookId": "e5616171-e3b5-4c39-81d4-67409f9fa60a",
"parameters": {
"public": true,
"options": {
"title": "Your first AI Agent 🚀",
"subtitle": "This is for demo purposes. Try me out !",
"responseMode": "lastNode",
"inputPlaceholder": "Type your message here...",
"showWelcomeScreen": false
},
"initialMessages": "Hi there! 👋"
},
"typeVersion": 1.1
},
{
"id": "92ac47ff-6dfc-4148-889e-8c49e6fc8f29",
"cid": "Ikx1Y2FzIFBleXJpbiI",
"name": "对话记忆",
"type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
"notes": "© 2025 Lucas Peyrin",
"creator": "Lucas Peyrin",
"position": [
832,
592
],
"parameters": {
"contextWindowLength": 30
},
"typeVersion": 1.3
}
],
"pinData": {},
"connections": {
"Get News": {
"ai_tool": [
[
{
"node": "Your First AI Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"Get Weather": {
"ai_tool": [
[
{
"node": "Your First AI Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"Example Chat": {
"main": [
[
{
"node": "Your First AI Agent",
"type": "main",
"index": 0
}
]
]
},
"Connect your model": {
"ai_languageModel": [
[
{
"node": "Your First AI Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Conversation Memory": {
"ai_memory": [
[
{
"node": "Your First AI Agent",
"type": "ai_memory",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
中级 - 个人效率, AI 聊天机器人
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
构建具有聊天界面和多种工具的交互式AI助手
构建具有聊天界面和多种工具的交互式AI助手
Crypto Tool
Date Time Tool
Agent
+9
17 节点Lucas Peyrin
个人效率
使用Gemini AI、天气和网页抓取创建多功能聊天机器人(入门套件)
使用Gemini AI、天气和网页抓取创建多功能聊天机器人(入门套件)
Gmail Tool
Agent
Http Request Tool
+7
23 节点Lucas Peyrin
个人效率
AI Retro Console 上传
多服务终端:通过Gemini AI访问Gmail、X、Telegram和新闻
Webhook
Gmail Tool
Twitter Tool
+10
14 节点Roni Bandini
个人效率
使用Gemini RAG管道构建文档专家聊天机器人
使用Gemini RAG管道构建文档专家聊天机器人
Set
Html
Filter
+16
48 节点Lucas Peyrin
内部知识库
🤖 使用 RAG、Gemini 和 Supabase 创建文档专家机器人
🤖 使用 RAG、Gemini 和 Supabase 创建文档专家机器人
Set
Html
Filter
+18
54 节点Lucas Peyrin
内部知识库
高级多代理AI个人助手(250+任务能力,WhatsApp + GPT)
高级多代理AI个人助手(250+任务能力,WhatsApp + GPT)
Set
Switch
Whats App
+26
213 节点Electrabot
个人效率
工作流信息
难度等级
中级
节点数量14
分类2
节点类型7
作者
Lucas Peyrin
@lucaspeyrinInnovative builder with a passion for crafting automation solutions that solve real-world challenges. From streamlining workflows to driving efficiency, my work empowers teams and individuals to achieve more with less effort. Experienced in developing scalable tools and strategies that deliver results with n8n, supabase and cline.
外部链接
在 n8n.io 查看 →
分享此工作流