{
  "name": "🛻 AI agent for logistics order processing with GPT-4o, Gmail and Google Sheet",
  "nodes": [
    {
      "id": "bc49829b-45f2-4910-9c37-907271982f14",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -140,
        320
      ],
      "parameters": {
        "width": 780,
        "height": 540,
        "content": "### 4. Do you need more details?\nFind a step-by-step guide in this tutorial\n![Guide](https://www.samirsaci.com/content/images/2025/03/Miniature-2.png)\n[🎥 Watch My Tutorial](https://www.youtube.com/wat"
      }
    },
    {
      "id": "40c6e16a-3b4f-4e28-b0a1-7066e0efab5d",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -460,
        -80
      ]
    },
    {
      "id": "e9cb7bb1-40e7-463e-8b3f-417602338e5c",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -520,
        120
      ]
    },
    {
      "id": "468bdb39-223f-4bae-8bdb-a72272ab57c3",
      "name": "Structured Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        -180,
        120
      ]
    },
    {
      "id": "667a8d43-1ce5-4ec8-871a-26007356a89e",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1000,
        -460
      ],
      "parameters": {
        "width": 380,
        "height": 720,
        "content": "### 1. Workflow Trigger with Gmail Trigger\nThe workflow is triggered by a new email received in your Gmail mailbox. \nIf the subject includes the string \"Inbound Order\" we proceed, if not we do nothing"
      }
    },
    {
      "id": "e1e2d95a-9bbd-4bd5-92ec-7a4835db21a2",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -600,
        -460
      ],
      "parameters": {
        "width": 660,
        "height": 720,
        "content": "### 2. AI Agent equipped with the query tool\nThe email body and subject are sent to the AI agent for parsing. The results include the **PO Number**, **expected delivery date** and all the order lines "
      }
    },
    {
      "id": "53375c17-a36c-431e-9ba6-07a9a84fc4c9",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        80,
        -460
      ],
      "parameters": {
        "width": 460,
        "height": 540,
        "content": "### 3. Store the orderlines in a Google Sheet\nThe table generated by the **code node** includes all the order lines with the **PO Number** and the **expected delivery date**. This **Google Sheet Node*"
      }
    },
    {
      "id": "776cfc0e-264b-44cc-b534-dc387b0c9fce",
      "name": "Store Purchase Order Lines",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        180,
        -80
      ]
    },
    {
      "id": "d5c52625-fef2-47a9-b2a4-bf005d8b9e05",
      "name": "Email Received",
      "type": "n8n-nodes-base.gmailTrigger",
      "position": [
        -980,
        -80
      ]
    },
    {
      "id": "6dc9e5cc-9ab3-469c-ad93-e0e7817ccbf7",
      "name": "Is PO?",
      "type": "n8n-nodes-base.if",
      "position": [
        -760,
        -80
      ]
    },
    {
      "id": "385db736-0867-46b9-9274-380e7c255fc4",
      "name": "Format Purchase Order Lines",
      "type": "n8n-nodes-base.code",
      "position": [
        -120,
        -80
      ]
    },
    {
      "id": "b2e39591-70be-4d7f-a5d4-1505741d6310",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1000,
        320
      ],
      "parameters": {
        "width": 780,
        "height": 720,
        "content": "### Test the workflow with this email!\n\n#### How?\n1. Send this email to the Gmail box you set up in your credentials.\n2. Click on Test workflow\n\n### Email\n**Email Subject:** Inbound Order PO45231 – Ex"
      }
    }
  ],
  "connections": {
    "Is PO?": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Format Purchase Order Lines",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Email Received": {
      "main": [
        [
          {
            "node": "Is PO?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "AI Agent",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Format Purchase Order Lines": {
      "main": [
        [
          {
            "node": "Store Purchase Order Lines",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}