{
  "name": "Bug Bounty Pipeline",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "start-scan",
        "responseMode": "onReceived",
        "responseData": "allEntries"
      },
      "name": "Webhook Trigger",
      "type": "n8n-nodes-base.webhook",
      "position": [
        250,
        300
      ]
    },
    {
      "parameters": {
        "url": "http://localhost:8001/task",
        "method": "POST",
        "jsonBody": "={{ JSON.stringify({ task: 'Perform reconnaissance on ' + $json.target, context: { target: $json.target } }) }}",
        "options": {}
      },
      "name": "Recon Agent",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        500,
        300
      ]
    },
    {
      "parameters": {
        "url": "http://localhost:8002/task",
        "method": "POST",
        "jsonBody": "={{ JSON.stringify({ task: 'Scan for vulnerabilities', context: $json }) }}",
        "options": {}
      },
      "name": "VulnScanner Agent",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        750,
        300
      ]
    },
    {
      "parameters": {
        "conditions": {
          "string": [
            {
              "value1": "={{ $json.tool_calls[0]?.result?.status }}",
              "value2": "pending_approval"
            }
          ]
        }
      },
      "name": "Needs Approval?",
      "type": "n8n-nodes-base.if",
      "position": [
        1000,
        300
      ]
    },
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "approve-action",
        "responseMode": "onReceived"
      },
      "name": "Wait for Approval",
      "type": "n8n-nodes-base.webhook",
      "position": [
        1000,
        500
      ]
    },
    {
      "parameters": {
        "url": "http://localhost:8000/approval/grant",
        "method": "POST",
        "jsonBody": "={{ JSON.stringify({ approval_id: $json.approval_id }) }}",
        "options": {}
      },
      "name": "Grant Approval",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1250,
        500
      ]
    },
    {
      "parameters": {
        "url": "http://localhost:8003/task",
        "method": "POST",
        "jsonBody": "={{ JSON.stringify({ task: 'Generate vulnerability report', context: $json }) }}",
        "options": {}
      },
      "name": "Reporter Agent",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1250,
        300
      ]
    },
    {
      "parameters": {
        "respondWith": "json",
        "responseBody": "={{ $json }}"
      },
      "name": "Return Report",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        1500,
        300
      ]
    }
  ],
  "connections": {
    "Webhook Trigger": {
      "main": [
        [
          {
            "node": "Recon Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Recon Agent": {
      "main": [
        [
          {
            "node": "VulnScanner Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "VulnScanner Agent": {
      "main": [
        [
          {
            "node": "Needs Approval?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Needs Approval?": {
      "main": [
        [
          {
            "node": "Wait for Approval",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Reporter Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait for Approval": {
      "main": [
        [
          {
            "node": "Grant Approval",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Grant Approval": {
      "main": [
        [
          {
            "node": "VulnScanner Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Reporter Agent": {
      "main": [
        [
          {
            "node": "Return Report",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}