{
  "name": "Research US legal regulations with CourtListener, LegiScan, OpenRouter and web search",
  "nodes": [
    {
      "id": "05ae5f0c-e4bc-4d62-a587-a87338a28f8e",
      "name": "Court Listener Discovery",
      "type": "n8n-nodes-base.httpRequestTool",
      "position": [
        816,
        496
      ]
    },
    {
      "id": "ecfc05f2-4305-4b4d-9f31-76ddea0a4340",
      "name": "Google Search Discovery",
      "type": "@n8n/n8n-nodes-langchain.toolHttpRequest",
      "position": [
        368,
        496
      ]
    },
    {
      "id": "09bdaf84-2695-4f0d-a9ed-0ace7e37527d",
      "name": "LegiScan Discovery",
      "type": "n8n-nodes-base.httpRequestTool",
      "position": [
        512,
        496
      ]
    },
    {
      "id": "10cd7049-4495-44d8-abaf-e23e5212c9a3",
      "name": "Court Listener Retrieveal",
      "type": "n8n-nodes-base.httpRequestTool",
      "position": [
        2224,
        496
      ]
    },
    {
      "id": "761fbb8b-0afc-44c5-9f8e-fa09f630934a",
      "name": "Think Tool Prioritization",
      "type": "@n8n/n8n-nodes-langchain.toolThink",
      "position": [
        1392,
        496
      ]
    },
    {
      "id": "a38d1b00-948b-451d-b6ab-c8890508f8cf",
      "name": "LegiScan Retrieval",
      "type": "n8n-nodes-base.httpRequestTool",
      "position": [
        2096,
        496
      ]
    },
    {
      "id": "865b9800-88c7-4114-a018-236b5c18298b",
      "name": "DocumentCloud Retrieval",
      "type": "n8n-nodes-base.httpRequestTool",
      "position": [
        2352,
        496
      ]
    },
    {
      "id": "4da35866-71e3-4bc5-afa9-37a6854d8ba1",
      "name": "Jina URL Text Extraction",
      "type": "n8n-nodes-base.jinaAiTool",
      "position": [
        1952,
        496
      ]
    },
    {
      "id": "82349c07-ce6f-4ae1-94de-da7309a507b7",
      "name": "Think Tool Analysis",
      "type": "@n8n/n8n-nodes-langchain.toolThink",
      "position": [
        3120,
        512
      ]
    },
    {
      "id": "1c55a7b6-46e2-4579-b6d0-ab7ef04d305b",
      "name": "Step 5: Verification",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        3680,
        240
      ]
    },
    {
      "id": "3e678562-4d1c-42ea-8fb5-3171aebf0ec6",
      "name": "Structured Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        3824,
        512
      ]
    },
    {
      "id": "9d5b8503-cb5e-4236-9248-ffb9368d4902",
      "name": "If hallucinations present",
      "type": "n8n-nodes-base.if",
      "position": [
        4144,
        240
      ]
    },
    {
      "id": "9b61eec6-09ef-4697-9cc0-fc17cf3b3cdc",
      "name": "Think Tool Analysis1",
      "type": "@n8n/n8n-nodes-langchain.toolThink",
      "position": [
        4656,
        512
      ]
    },
    {
      "id": "d2dc98b7-2572-4000-bfcf-10e957cd51f5",
      "name": "Set Report",
      "type": "n8n-nodes-base.set",
      "position": [
        3504,
        240
      ]
    },
    {
      "id": "55a18db3-d5bc-423a-ab3e-70557411ba05",
      "name": "Set Output",
      "type": "n8n-nodes-base.set",
      "position": [
        4832,
        240
      ]
    },
    {
      "id": "3802cd56-6381-4b60-9d88-286cd801ae9d",
      "name": "Retry if Tools Not Used",
      "type": "n8n-nodes-base.if",
      "position": [
        784,
        240
      ]
    },
    {
      "id": "423a5281-89d2-49da-a2f9-8e3a434056be",
      "name": "Retry if Tools Not Used1",
      "type": "n8n-nodes-base.if",
      "position": [
        2224,
        240
      ]
    },
    {
      "id": "95aec7d7-a6da-4ecf-a996-b3e1c33362d1",
      "name": "Retry if Response Empty",
      "type": "n8n-nodes-base.if",
      "position": [
        1504,
        240
      ]
    },
    {
      "id": "fe4ca7f3-c372-4194-b37a-4fec37dc45de",
      "name": "Retry if Response Empty1",
      "type": "n8n-nodes-base.if",
      "position": [
        3280,
        240
      ]
    },
    {
      "id": "ff9633b7-bb51-4c7b-862d-94583e0fdf86",
      "name": "Step 1: Discovery",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        384,
        240
      ]
    },
    {
      "id": "743bad4c-949e-450f-9a27-2d9bd8e04aff",
      "name": "Auto Fallback",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "position": [
        224,
        496
      ]
    },
    {
      "id": "d08257a9-51c2-4a3b-8478-f7cc858fe0c0",
      "name": "Auto Fallback1",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "position": [
        1248,
        496
      ]
    },
    {
      "id": "6586b64f-126c-4546-92e5-4ca40fc2f39c",
      "name": "Step 2: Prioritization",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        1200,
        240
      ]
    },
    {
      "id": "cc278656-cdbb-41aa-845b-17ecf23e57eb",
      "name": "Auto Fallback2",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "position": [
        1808,
        496
      ]
    },
    {
      "id": "bf2e1b99-1c7b-46d6-be52-e602fc74b860",
      "name": "Step 3: Retrieval",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        1904,
        240
      ]
    },
    {
      "id": "6cd8e053-713a-48cb-85f2-ecce5c344256",
      "name": "Auto Fallback3",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "position": [
        2976,
        512
      ]
    },
    {
      "id": "1ec98802-8617-4816-8c22-2f785c2131e4",
      "name": "Step 4: Report Writing",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        2960,
        240
      ]
    },
    {
      "id": "08607ef2-2ca2-48cd-8c7b-e88b80c4303f",
      "name": "Auto Fallback4",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "position": [
        3696,
        512
      ]
    },
    {
      "id": "b754e32c-7411-42fd-a32c-04845d7f03d7",
      "name": "Auto Fallback5",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "position": [
        4384,
        512
      ]
    },
    {
      "id": "f2833edb-c79d-40f0-a92e-627406d3ba16",
      "name": "Step 6: Fixing Hallucinations",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        4352,
        240
      ]
    },
    {
      "id": "fa83043e-f9c8-4c0c-845e-d002577a3c6b",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        0
      ],
      "parameters": {
        "width": 2656,
        "height": 800,
        "content": "## Research & Tool Use\nThis section of the workflow focuses on finding the information that the next section will use to write and verify its report"
      }
    },
    {
      "id": "87532eeb-50a7-4ae3-bc8a-389d234d5315",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2736,
        0
      ],
      "parameters": {
        "width": 2320,
        "height": 800,
        "content": "## Report Writing & Verification\nThis section of the workflow focuses on writing the user-facing report and ensuring it is accurate and free from hallucinations"
      }
    },
    {
      "id": "43e75cc9-9b65-45d7-919a-d713f3c063f9",
      "name": "If Empty Output",
      "type": "n8n-nodes-base.if",
      "position": [
        4640,
        240
      ]
    },
    {
      "id": "3ad4fc38-631c-4d6f-af57-bba54e2dd414",
      "name": "If Empty Output1",
      "type": "n8n-nodes-base.if",
      "position": [
        3968,
        240
      ]
    },
    {
      "id": "27d55619-9178-4f6c-a5e1-6bb2fe9de94b",
      "name": "Plural Retrieval",
      "type": "n8n-nodes-base.httpRequestTool",
      "position": [
        2480,
        496
      ]
    },
    {
      "id": "7e40db3a-8b17-4c0f-9fc7-062d86e46882",
      "name": "Plural Discovery1",
      "type": "n8n-nodes-base.httpRequestTool",
      "position": [
        672,
        496
      ]
    },
    {
      "id": "a64f86b3-bdf6-4fba-b9a5-3e61abae8668",
      "name": "Qwen3",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "position": [
        96,
        496
      ]
    },
    {
      "id": "a7d85394-dbf5-4387-b7d3-a05ee710a7b8",
      "name": "Qwen4",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "position": [
        1664,
        496
      ]
    },
    {
      "id": "8d1a23b5-8ad6-4ae4-8220-9a5acdde7caa",
      "name": "Sonnet 4.5",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "position": [
        1104,
        496
      ]
    },
    {
      "id": "814bb796-5e3a-40c9-b7f3-5494adcbd112",
      "name": "Sonnet 4.",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "position": [
        3568,
        512
      ]
    },
    {
      "id": "c886df5a-bc6d-4ca8-8d33-a9c42efe42a3",
      "name": "Opus",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "position": [
        2848,
        512
      ]
    },
    {
      "id": "c54d933e-c733-4e74-afa0-61ff29849cbe",
      "name": "Opus1",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "position": [
        4256,
        512
      ]
    },
    {
      "id": "18da61d4-5a79-4147-8e9f-2f57c405cfba",
      "name": "Document Cloud Discovery",
      "type": "n8n-nodes-base.httpRequestTool",
      "position": [
        960,
        496
      ]
    },
    {
      "id": "82bdd3ed-48b6-420c-a503-544daf908b30",
      "name": "Trigger legal research request (Webhook)",
      "type": "n8n-nodes-base.webhook",
      "position": [
        96,
        240
      ]
    },
    {
      "id": "43b75f2e-4cca-4e65-940f-0ac781703f60",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        16,
        -656
      ],
      "parameters": {
        "width": 816,
        "height": 592,
        "content": "## Research US regulations using AI agents with web search and report generation\n\n## How it works\n\nThis workflow accepts a research request via webhook or from another workflow.\nIt performs structured"
      }
    }
  ],
  "connections": {
    "Opus": {
      "ai_languageModel": [
        [
          {
            "node": "Step 4: Report Writing",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Opus1": {
      "ai_languageModel": [
        [
          {
            "node": "Step 6: Fixing Hallucinations",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Qwen3": {
      "ai_languageModel": [
        [
          {
            "node": "Step 1: Discovery",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Qwen4": {
      "ai_languageModel": [
        [
          {
            "node": "Step 3: Retrieval",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Sonnet 4.": {
      "ai_languageModel": [
        [
          {
            "node": "Step 5: Verification",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Set Report": {
      "main": [
        [
          {
            "node": "Step 5: Verification",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Sonnet 4.5": {
      "ai_languageModel": [
        [
          {
            "node": "Step 2: Prioritization",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Auto Fallback": {
      "ai_languageModel": [
        [
          {
            "node": "Step 1: Discovery",
            "type": "ai_languageModel",
            "index": 1
          }
        ]
      ]
    },
    "Auto Fallback1": {
      "ai_languageModel": [
        [
          {
            "node": "Step 2: Prioritization",
            "type": "ai_languageModel",
            "index": 1
          }
        ]
      ]
    },
    "Auto Fallback2": {
      "ai_languageModel": [
        [
          {
            "node": "Step 3: Retrieval",
            "type": "ai_languageModel",
            "index": 1
          }
        ]
      ]
    },
    "Auto Fallback3": {
      "ai_languageModel": [
        [
          {
            "node": "Step 4: Report Writing",
            "type": "ai_languageModel",
            "index": 1
          }
        ]
      ]
    },
    "Auto Fallback4": {
      "ai_languageModel": [
        [
          {
            "node": "Step 5: Verification",
            "type": "ai_languageModel",
            "index": 1
          },
          {
            "node": "Structured Output Parser",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Auto Fallback5": {
      "ai_languageModel": [
        [
          {
            "node": "Step 6: Fixing Hallucinations",
            "type": "ai_languageModel",
            "index": 1
          }
        ]
      ]
    },
    "If Empty Output": {
      "main": [
        [
          {
            "node": "Step 6: Fixing Hallucinations",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Set Report",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If Empty Output1": {
      "main": [
        [
          {
            "node": "Step 5: Verification",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "If hallucinations present",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Plural Retrieval": {
      "ai_tool": [
        [
          {
            "node": "Step 3: Retrieval",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Plural Discovery1": {
      "ai_tool": [
        [
          {
            "node": "Step 1: Discovery",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Step 1: Discovery": {
      "main": [
        [
          {
            "node": "Retry if Tools Not Used",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Step 3: Retrieval": {
      "main": [
        [
          {
            "node": "Retry if Tools Not Used1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "LegiScan Discovery": {
      "ai_tool": [
        [
          {
            "node": "Step 1: Discovery",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "LegiScan Retrieval": {
      "ai_tool": [
        [
          {
            "node": "Step 3: Retrieval",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Think Tool Analysis": {
      "ai_tool": [
        [
          {
            "node": "Step 4: Report Writing",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Step 5: Verification": {
      "main": [
        [
          {
            "node": "If Empty Output1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Think Tool Analysis1": {
      "ai_tool": [
        [
          {
            "node": "Step 6: Fixing Hallucinations",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Step 2: Prioritization": {
      "main": [
        [
          {
            "node": "Retry if Response Empty",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Step 4: Report Writing": {
      "main": [
        [
          {
            "node": "Retry if Response Empty1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "DocumentCloud Retrieval": {
      "ai_tool": [
        [
          {
            "node": "Step 3: Retrieval",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Google Search Discovery": {
      "ai_tool": [
        [
          {
            "node": "Step 1: Discovery",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Retry if Response Empty": {
      "main": [
        [
          {
            "node": "Step 2: Prioritization",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Step 3: Retrieval",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Retry if Tools Not Used": {
      "main": [
        [
          {
            "node": "Step 1: Discovery",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Step 2: Prioritization",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Court Listener Discovery": {
      "ai_tool": [
        [
          {
            "node": "Step 1: Discovery",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Document Cloud Discovery": {
      "ai_tool": [
        [
          {
            "node": "Step 1: Discovery",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Jina URL Text Extraction": {
      "ai_tool": [
        [
          {
            "node": "Step 3: Retrieval",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Retry if Response Empty1": {
      "main": [
        [
          {
            "node": "Step 4: Report Writing",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Set Report",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Retry if Tools Not Used1": {
      "main": [
        [
          {
            "node": "Step 3: Retrieval",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Step 4: Report Writing",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Step 5: Verification",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Court Listener Retrieveal": {
      "ai_tool": [
        [
          {
            "node": "Step 3: Retrieval",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "If hallucinations present": {
      "main": [
        [
          {
            "node": "Step 6: Fixing Hallucinations",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Set Output",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Think Tool Prioritization": {
      "ai_tool": [
        [
          {
            "node": "Step 2: Prioritization",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Step 6: Fixing Hallucinations": {
      "main": [
        [
          {
            "node": "If Empty Output",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Trigger legal research request (Webhook)": {
      "main": [
        [
          {
            "node": "Step 1: Discovery",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}