{
  "meta": {
    "templateCredsSetupCompleted": false
  },
  "name": "Chat With Your Documents \u2014 AI Agent (Claude + Google Docs + Google Sheets)",
  "tags": [],
  "nodes": [
    {
      "id": "63b382c1-5b49-4b82-89af-e818e45e105b",
      "name": "Talk To Your Agent",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "notes": "Opens the built-in chat window. Click 'Chat' at the bottom of the canvas to start asking questions. Swap this for a Slack / Telegram / Webhook trigger if you want the agent somewhere else.",
      "position": [
        576,
        176
      ],
      "parameters": {
        "options": {}
      },
      "notesInFlow": false,
      "typeVersion": 1.4
    },
    {
      "id": "54155eb0-d567-48e4-a193-a844dd3021e5",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "notes": "The brain. It decides on its own which tool to call. The System Message (in Options) tells it to always read the document/sheet before answering \u2014 edit it to change its behaviour or tone.",
      "position": [
        816,
        176
      ],
      "parameters": {
        "options": {
          "systemMessage": "You are a helpful assistant that answers questions about the user's own documents and data.\n\nYou have access to these tools:\n- \"Read Google Doc\": fetches the full text of the connected Google Document.\n- \"Read Google Sheet\": returns the rows of the connected Google Sheet.\n\nRules:\n1. ALWAYS call a tool before answering a question about the document or the data. Never answer from memory or from general knowledge.\n2. Base your answer only on what the tool returns. If the answer is not in there, say so plainly instead of guessing.\n3. Quote the relevant passage or row when it helps the user trust the answer.\n4. Keep answers short and concrete. Use bullet points for lists of facts.\n5. If the user asks something unrelated to the document or data, answer normally without calling a tool."
        }
      },
      "notesInFlow": false,
      "typeVersion": 3.1
    },
    {
      "id": "fc2c44d9-3e00-4388-a5ac-695c19add9ec",
      "name": "Claude",
      "type": "@n8n/n8n-nodes-langchain.lmChatAnthropic",
      "notes": "The model that powers the agent. Needs an Anthropic API key. Any other chat model (OpenAI, Gemini, Ollama, ...) can be swapped in here \u2014 just make sure it supports tool calling.",
      "position": [
        784,
        560
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "claude-sonnet-5",
          "cachedResultName": "Claude Sonnet 5"
        },
        "options": {}
      },
      "notesInFlow": false,
      "typeVersion": 1.5
    },
    {
      "id": "72eceb97-23e9-4512-b2ab-d8985b88a5e0",
      "name": "Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "notes": "Remembers the last 10 messages, so follow-up questions like 'and what about the second one?' work. Memory lives in RAM: it resets when n8n restarts.",
      "position": [
        976,
        560
      ],
      "parameters": {
        "contextWindowLength": 10
      },
      "notesInFlow": false,
      "typeVersion": 1.4
    },
    {
      "id": "0568bb8b-c8fc-42ee-be8c-5181577ca489",
      "name": "Read Google Doc",
      "type": "n8n-nodes-base.googleDocsTool",
      "notes": "Paste your Google Doc URL (or its ID) in 'Doc URL or ID'. The agent calls this by itself. Want the agent to choose the document instead? Replace the value with an AI-filled parameter (the \u2728 icon next to the field).",
      "position": [
        1216,
        560
      ],
      "parameters": {
        "operation": "get",
        "documentURL": "YOUR_GOOGLE_DOC_ID_OR_URL",
        "descriptionType": "manual",
        "toolDescription": "Reads the full text of the user's Google Document. Call this whenever the user asks anything about the document, its content, wording, sections or what it says."
      },
      "notesInFlow": false,
      "typeVersion": 2
    },
    {
      "id": "594c0e83-b0b6-48b4-9935-66323c258510",
      "name": "Read Google Sheet",
      "type": "n8n-nodes-base.googleSheetsTool",
      "notes": "Select your spreadsheet + tab. Operation is 'Get Row(s)', so the agent receives the rows as JSON. Keep the sheet small-ish: every row is sent to the model and costs tokens.",
      "position": [
        1424,
        560
      ],
      "parameters": {
        "options": {},
        "sheetName": {
          "__rl": true,
          "mode": "name",
          "value": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "id",
          "value": "YOUR_GOOGLE_SHEET_ID"
        },
        "descriptionType": "manual",
        "toolDescription": "Returns all rows of the user's Google Sheet as JSON. Call this whenever the user asks about the data, numbers, records, rows or columns in the spreadsheet."
      },
      "notesInFlow": false,
      "typeVersion": 4.7
    },
    {
      "id": "9d56a0b2-caac-4c93-9ce6-39c426ac83a6",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        544,
        0
      ],
      "parameters": {
        "color": 7,
        "width": 520,
        "height": 348,
        "content": "## 1. Ask a question\nThe chat trigger opens a chat window on the canvas and hands your question to the agent, which loops until it can answer."
      },
      "typeVersion": 1
    },
    {
      "id": "c33f4e26-d417-47b2-9e2b-cff7091d3dd7",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        720,
        384
      ],
      "parameters": {
        "color": 7,
        "width": 400,
        "height": 340,
        "content": "## 2. Brain and memory\nClaude does the reasoning and Memory keeps the conversation coherent. These connect to the slots under the agent."
      },
      "typeVersion": 1
    },
    {
      "id": "d0888c32-cff9-404b-891b-9576a5363d5a",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1168,
        384
      ],
      "parameters": {
        "color": 7,
        "width": 400,
        "height": 340,
        "content": "## 3. Your sources\nEach tool is a place the agent can read from. It decides on its own which one a question needs."
      },
      "typeVersion": 1
    },
    {
      "id": "717a1689-b969-4d34-83d8-31a8d0b4a920",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        0
      ],
      "parameters": {
        "width": 500,
        "height": 932,
        "content": "## \ud83d\udcac Chat With Your Own Documents\n\nAsk a question in plain language and the agent reads your Google Doc and Google Sheet to answer it. No vector database, no embeddings, no re-indexing when the source changes.\n\n### How it works\n1. You type a question in the built-in chat window.\n2. The agent decides which source it needs.\n3. It reads the Doc and/or the Sheet live, on every question.\n4. It answers only from what it found, and says so when the answer is not there.\n5. Memory keeps the last 10 messages, so follow-up questions work.\n\n### Setup\n1. Create credentials for Anthropic, Google Docs and Google Sheets. Docs and Sheets each need their own credential, even for the same account.\n2. Replace `YOUR_GOOGLE_DOC_ID_OR_URL` with your document URL.\n3. Pick your spreadsheet and tab in *Read Google Sheet*.\n4. Make sure the connected Google account can actually open both files.\n5. Click **Chat** at the bottom of the canvas and ask something.\n\n### Customization\nOnly need one source? Delete the node you do not want and remove its line from the System Message. Nothing else breaks. Add more tools (Notion, Drive, HTTP Request) to the same slot.\n\nKeep sources to a few pages or a few hundred rows: everything read is sent to the model."
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "binaryMode": "separate",
    "availableInMCP": false,
    "executionOrder": "v1"
  },
  "connections": {
    "Claude": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Read Google Doc": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Read Google Sheet": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Talk To Your Agent": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}