{
  "name": "Autonomous Agent - Document Processing - Artifact Download",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "GET",
        "path": "autonomous-agent/document-processing/executions/:executionId/artifacts/:artifactId",
        "responseMode": "responseNode",
        "options": {}
      },
      "id": "75386282-2647-4437-b715-eefaf254440e",
      "name": "Artifact Webhook",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        120,
        300
      ]
    },
    {
      "parameters": {
        "jsCode": "const params = $json.params ?? {};\nif (!params.executionId || !params.artifactId) throw new Error('executionId and artifactId are required');\nreturn [{json:{execution_id:String(params.executionId),artifact_id:String(params.artifactId)}}];"
      },
      "id": "f34c56da-3668-45a8-92bd-c2f1d60b88c8",
      "name": "Validate Artifact Request",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        360,
        300
      ]
    },
    {
      "parameters": {
        "operation": "download",
        "executionId": "={{$json.execution_id}}",
        "artifactId": "={{$json.artifact_id}}",
        "outputBinaryField": "data",
        "downloadFileName": "",
        "downloadMimeType": ""
      },
      "id": "7c13e29b-2f7a-49e1-9c7b-138969de2605",
      "name": "Download Execution Artifact",
      "type": "n8n-nodes-autonomous-agent.autonomousAgentArtifact",
      "typeVersion": 1,
      "position": [
        610,
        300
      ],
      "credentials": {
        "autonomousAgentApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "respondWith": "binary",
        "responseDataSource": "set",
        "inputFieldName": "data",
        "options": {}
      },
      "id": "26a76173-d2fd-480d-9262-b1f538f5a499",
      "name": "Return Artifact Binary",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.4,
      "position": [
        860,
        300
      ]
    }
  ],
  "connections": {
    "Artifact Webhook": {
      "main": [
        [
          {
            "node": "Validate Artifact Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Validate Artifact Request": {
      "main": [
        [
          {
            "node": "Download Execution Artifact",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download Execution Artifact": {
      "main": [
        [
          {
            "node": "Return Artifact Binary",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1",
    "saveManualExecutions": true,
    "saveExecutionProgress": true
  },
  "versionId": "3b725c1f-291d-4223-9231-afa2485629fb",
  "meta": {
    "templateCredsSetupCompleted": false
  },
  "tags": []
}