{
  "id": "xh1yv1lvCFV3sHhH",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Create Your First AI Agent",
  "tags": [],
  "nodes": [
    {
      "id": "c5a03f02-86fa-42d4-83fd-7966b49f56ff",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        0,
        0
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 2.1
    },
    {
      "id": "5334a310-007f-43a7-9f85-f26c7928f5fd",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1472,
        -32
      ],
      "parameters": {
        "width": 1072,
        "height": 1152,
        "content": "# Overview\n\nThis **n8n** workflow listens for incoming chat messages, uses **Google Gemini (PaLM)** via **LangChain** to process or reply, optionally reads a **Google Docs** file if mentioned, and logs both the user input and the AI-generated response into chat.\n\n## Features\n- Triggered when a chat message is received\n- Uses Google Gemini (PaLM/Gemini Pro) via LangChain Agent\n- Optionally processes a Google Docs document\n- Modular design \u2013 easy to customize\n\n## \u2705 Requirements\n\n### Tools & Services Needed\n- `n8n` instance (self-hosted or n8n.cloud)\n- Google Gemini API (PaLM or Gemini Pro)\n- Google Sheets and Google Docs access\n- OAuth2 credentials for Google APIs configured in n8n\n\n\n## \ud83d\ude80 How to Use This Workflow\n### 1. Configure Webhook Chat Trigger\n**Node:** `When chat message received`\n- This node captures the user input message\n\n### 2. (Optional) Handle Google Docs Input\n\n**Node:** `Get a document in Google Docs`\n- If the user's message includes a link or ID of a Google Doc, this node retrieves and simplifies it\n- The LangChain Agent can call this automatically when it detects a document reference\n\n### 3. Generate AI Response\n\n**Node:** `Google Gemini Chat Model`\n- LangChain routes message through the Gemini model\n- It generates a smart, contextual response, optionally using tools (e.g., Docs reader)\n\n## \ud83d\ude4b For Help & Community\n\n- \ud83d\udc7e Discord: [n8n channel](https://discord.gg/9SDFKGnh2Y)\n- \ud83c\udf10 Website: [devcodejourney.com](https://devcodejourney.com)\n- \ud83d\udd17 LinkedIn: [Connect with Shakil](https://www.linkedin.com/in/shakilpg/)\n- \ud83d\udcf1 WhatsApp Channel: [Join Now](https://whatsapp.com/channel/0029Vb5l6JuDTkK5BRORNn0B)\n- \ud83d\udcac Direct Chat: [Message Now](https://wa.me/8801316320957)"
      },
      "typeVersion": 1
    },
    {
      "id": "092b6a15-91e6-4ee9-8be7-fc45d3fd7d0c",
      "name": "Gemini",
      "type": "@n8n/n8n-nodes-langchain.googleGeminiTool",
      "position": [
        144,
        272
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "models/gemini-2.5-flash",
          "cachedResultName": "models/gemini-2.5-flash"
        },
        "options": {},
        "messages": {
          "values": [
            {
              "role": "model",
              "content": "Give me user user-friendly reply. Don't give me a robotic type relay."
            }
          ]
        }
      },
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "ffb50b58-3388-4504-b711-bf1b5c12bdbf",
      "name": "Docs",
      "type": "n8n-nodes-base.googleDocsTool",
      "position": [
        272,
        272
      ],
      "parameters": {
        "simple": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Simplify', ``, 'boolean') }}",
        "operation": "get",
        "documentURL": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Doc_ID_or_URL', ``, 'string') }}"
      },
      "credentials": {
        "googleDocsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "b0f6e69c-c23b-4a6d-add0-5f7f181c0174",
      "name": "Request",
      "type": "n8n-nodes-base.httpRequestTool",
      "position": [
        32,
        272
      ],
      "parameters": {
        "url": "https://google.cm/",
        "options": {}
      },
      "typeVersion": 4.2
    },
    {
      "id": "32a851d3-2e78-4be9-907d-81a6303399b0",
      "name": "Gemini Chat",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        -160,
        272
      ],
      "parameters": {
        "options": {}
      },
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "315446fa-9dbe-474e-870f-719e616f1d15",
      "name": "Chat message",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "position": [
        -304,
        0
      ],
      "parameters": {
        "public": true,
        "options": {},
        "initialMessages": "Hi Nani! \ud83d\udc4b"
      },
      "typeVersion": 1.1
    },
    {
      "id": "0be1fa1e-e723-42bc-8374-7500f994180e",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        256
      ],
      "parameters": {
        "color": 7,
        "width": 448,
        "height": 336,
        "content": "\n\n\n\n\n\n\n\n\n\n\n\n---\n### Tools you can change/add another tool as your wish but need this modal API key and give some data what you want to give replay type"
      },
      "typeVersion": 1
    },
    {
      "id": "6691a7df-166f-4061-9409-6c2fe2d6d3c2",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -240,
        256
      ],
      "parameters": {
        "color": 7,
        "width": 224,
        "height": 336,
        "content": "\n\n\n\n\n\n\n\n\n\n\n---\n### chat modal you can change/add another modal as your wish but need this modal API key"
      },
      "typeVersion": 1
    },
    {
      "id": "35dfef59-06e5-4542-87cd-83ad6b60fcb7",
      "cid": "Ikx1Y2FzIFBleXJpbiI",
      "name": "Sticky Note12",
      "type": "n8n-nodes-base.stickyNote",
      "notes": "\u00a9 2025 Lucas Peyrin",
      "creator": "Lucas Peyrin",
      "position": [
        -368,
        -96
      ],
      "parameters": {
        "color": 7,
        "width": 268,
        "height": 236,
        "content": "Activate this workflow and share the public chat URL to let others talk to your AI Agent!"
      },
      "typeVersion": 1
    },
    {
      "id": "499298ba-6976-4e30-b045-7cce8d20c4ee",
      "cid": "Ikx1Y2FzIFBleXJpbiI",
      "name": "Sticky Note13",
      "type": "n8n-nodes-base.stickyNote",
      "notes": "\u00a9 2025 Lucas Peyrin",
      "creator": "Lucas Peyrin",
      "position": [
        -80,
        -208
      ],
      "parameters": {
        "color": 7,
        "width": 396,
        "height": 348,
        "content": "## Your AI agent can:\n1. **Receive** messages from the chat\n2. **Select** the right tools (e.g., weather, news, email)\n3. **Respond** with live, helpful answers\n\n\nAdjust your agent\u2019s **System Message** thinking, behavior, and replies.\n\n\n\n\n\n\n\n\n\n\n"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "callerPolicy": "workflowsFromSameOwner",
    "availableInMCP": false,
    "executionOrder": "v1"
  },
  "versionId": "a1f24637-344d-4441-86b6-c452a01aef65",
  "connections": {
    "Docs": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Gemini": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Request": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        []
      ]
    },
    "Gemini Chat": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Chat message": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}