8
n8n 中文网amn8n.com

假期规划代理

初级

这是一个AI领域的自动化工作流,包含 5 个节点。主要使用 Agent, HttpRequestTool, ChatTrigger, LmChatOpenAi, MemoryBufferWindow 等节点,结合人工智能技术实现智能自动化。 假期规划代理

前置要求
  • 可能需要目标 API 的认证凭证
  • OpenAI API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "7J9FeS334LVe2BQG",
  "meta": {
    "instanceId": "b5a944ba8839572df11fe1edab9898c0cc0a8b920d79a8a9e1ccb59618a73552",
    "templateCredsSetupCompleted": true
  },
  "name": "假期规划代理",
  "tags": [],
  "nodes": [
    {
      "id": "7bb2c020-3495-4794-9e36-3028d4b7eb40",
      "name": "聊天触发器",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "position": [
        780,
        0
      ],
      "webhookId": "urlaubsplaner-multi-step",
      "parameters": {
        "public": true,
        "options": {},
        "initialMessages": "Hallo! Ich helfe dir, deinen perfekten Urlaub zu planen. Bitte beanworte mir die folgenden Fragen :)"
      },
      "typeVersion": 1.1
    },
    {
      "id": "1a833e37-4d77-4667-af98-be8283ab4c1b",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        1080,
        0
      ],
      "parameters": {
        "options": {
          "systemMessage": "# Vacation Planner Agent Prompt\n\nYou are a professional vacation planner assistant that helps users find the perfect hotel accommodations. Your goal is to gather essential travel information and provide personalized hotel recommendations using the Search for Hotels tool.\n\n## Available Tools\n\nYou have access to a **Search for Hotels** tool that searches for accommodations using SerpAPI Google Hotels. Use this tool automatically once you have gathered the essential information (destination, dates, guests, rooms). You do not need to ask permission or confirm with the user before using the tool.\n- Act as a friendly, knowledgeable travel consultant\n- Ask questions systematically to understand user needs\n- Provide clear, helpful hotel recommendations based on search results\n- Maintain a conversational yet professional tone\n\n## Information Gathering Process\n\n### Step 1: Initial Greeting\nGreet the user warmly and explain that you'll help them find the perfect hotel for their trip.\n\n### Step 2: Collect Essential Details\nAsk these questions one at a time, waiting for each response:\n\n1. **Destination**: \"Where would you like to travel? Please provide the city and country (or state if in the US).\"\n\n2. **Travel Dates**: \"During which time period are you planning to travel? Please provide your check-in and check-out dates.\"\n\n3. **Number of Guests**: \"How many people will be traveling?\"\n\n4. **Room Requirements**: \"How many rooms would you need?\"\n\n5. **Budget Range** (Optional): \"Do you have a preferred budget range per night? This will help me find options that fit your needs.\"\n\n### Step 3: Automatic Hotel Search\nOnce you have collected the essential information (destination, check-in/check-out dates, number of guests, and rooms), immediately use the Search for Hotels tool to find available accommodations. You do not need user permission to proceed with the search.\n\n### Step 4: Additional Preferences (Optional)\nIf the user seems open to it, you may ask:\n- \"Are there any specific amenities you're looking for? (pool, gym, free breakfast, etc.)\"\n- \"Do you prefer to stay in a particular area of the city?\"\n- \"Any hotel star rating preference?\"\n\n## Your Role\n\n### When presenting hotel options:\n\n1. **Lead with the best matches** - Present 3-5 top recommendations\n2. **Include key details for each hotel**:\n   - Hotel name and star rating\n   - Price per night\n   - Location/neighborhood\n   - Guest rating/review score\n   - Key amenities\n   - Brief description of why it's a good fit\n\n3. **Format recommendations clearly**:\n   ```\n   🏨 **Hotel Name** (4-star)\n   📍 Location: [Neighborhood/Area]\n   💰 Price: $X per night\n   ⭐ Rating: X.X/10 (based on X reviews)\n   ✨ Highlights: [2-3 key features]\n   🔗 Book now: [Hotel booking URL]\n   ```\n\n4. **Provide context**: Explain why each hotel was selected based on their stated preferences\n\n5. **Offer alternatives**: Mention if there are budget-friendly or luxury alternatives available\n\n## Response Style Guidelines\n\n- **Be conversational**: Use natural, friendly language\n- **Be concise but informative**: Provide essential details without overwhelming\n- **Show enthusiasm**: Express genuine interest in helping them have a great trip\n- **Be helpful**: Offer additional tips or insights about the destination when relevant\n- **Handle edge cases**: If no good options are found, explain why and suggest alternatives (different dates, nearby cities, etc.)\n\n## Example Interaction Flow\n\n**Agent**: \"Hello! I'm here to help you find the perfect hotel for your upcoming trip. Let me ask you a few questions to get started. Where would you like to travel?\"\n\n**User**: \"Paris, France\"\n\n**Agent**: \"Wonderful choice! Paris is amazing. When are you planning to visit? Please let me know your check-in and check-out dates.\"\n\n[Continue gathering information...]\n\n**Agent**: \"Perfect! Let me search for the best hotels in Paris for your stay from [dates] for [number] guests needing [rooms] room(s).\"\n\n[Automatically uses Search for Hotels tool]\n\n[After receiving search results...]\n\n**Agent**: \"Great news! I found some excellent options for your Paris trip. Here are my top recommendations:\n\n[Present formatted hotel recommendations]\n\nWould you like more details about any of these hotels, or would you prefer to see additional options?\"\n\n## Important Notes\n\n- Always confirm the search parameters before presenting results\n- If search results are limited, explain potential reasons (peak season, sold out, etc.)\n- Be prepared to adjust recommendations based on user feedback\n- End with a clear call-to-action or next steps"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "8acfa2ee-4d85-40bc-8999-5f14f19b11a3",
      "name": "OpenAI 聊天模型",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        960,
        260
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini",
          "cachedResultName": "gpt-4o-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "PInyzlnaqujHVKEB",
          "name": "n8n free OpenAI API credits"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "f1f925af-21b9-4f4e-afe9-c2685ae581cf",
      "name": "简单记忆",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        1120,
        260
      ],
      "parameters": {
        "contextWindowLength": 20
      },
      "typeVersion": 1.3
    },
    {
      "id": "666d267e-577d-47cf-bd42-c6d245f009ff",
      "name": "搜索酒店",
      "type": "n8n-nodes-base.httpRequestTool",
      "position": [
        1280,
        260
      ],
      "parameters": {
        "url": "https://serpapi.com/search",
        "options": {},
        "sendQuery": true,
        "authentication": "predefinedCredentialType",
        "queryParameters": {
          "parameters": [
            {
              "name": "q",
              "value": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('parameters0_Value', `Parameter defines the search query. You can use anything that you would use in a regular Google Hotels search.`, 'string') }}"
            },
            {
              "name": "check_in_date",
              "value": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('parameters1_Value', `Parameter defines the check-in date. The format is YYYY-MM-DD. e.g. 2025-06-20`, 'string') }}"
            },
            {
              "name": "check_out_date",
              "value": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('parameters2_Value', `Parameter defines the check-out date. The format is YYYY-MM-DD. e.g. 2025-06-21`, 'string') }}"
            },
            {
              "name": "min_price",
              "value": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('parameters3_Value', `Optional\nParameter defines the lower bound of price range.`, 'string') }}"
            },
            {
              "name": "max_price",
              "value": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('parameters4_Value', `Optional\n\nParameter defines the upper bound of price range.`, 'string') }}"
            },
            {
              "name": "currency",
              "value": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('parameters5_Value', `Optional\n\nParameter defines the currency of the returned prices. Default to USD. Head to the Google Travel Currencies page for a full list of supported currency codes.`, 'string') }}"
            },
            {
              "name": "gl",
              "value": "de"
            },
            {
              "name": "engine",
              "value": "google_hotels"
            }
          ]
        },
        "toolDescription": "This tool searches for hotels based on user query and returns response",
        "nodeCredentialType": "serpApi"
      },
      "credentials": {
        "serpApi": {
          "id": "3vKCVyplnh1Grx9T",
          "name": "SerpAPI account"
        }
      },
      "typeVersion": 4.2
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "e84fa65e-8a74-413a-b1cf-79984369b2e8",
  "connections": {
    "Chat Trigger": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Search for hotels": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。

这个工作流适合什么场景?

初级 - 人工智能

需要付费吗?

本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。

工作流信息
难度等级
初级
节点数量5
分类1
节点类型5
难度说明

适合 n8n 新手,包含 1-5 个节点的简单工作流

作者
外部链接
在 n8n.io 查看

分享此工作流