{
  "name": "Clara Pipeline A - Demo to v1",
  "nodes": [
    {
      "parameters": {},
      "id": "trigger-1",
      "name": "Manual Trigger",
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        250,
        300
      ]
    },
    {
      "parameters": {
        "values": {
          "string": [
            {
              "name": "account_id",
              "value": "ACC_001"
            }
          ]
        }
      },
      "id": "set-1",
      "name": "Set Account ID",
      "type": "n8n-nodes-base.set",
      "typeVersion": 1,
      "position": [
        450,
        300
      ]
    },
    {
      "parameters": {
        "command": "python /scripts/transcribe.py --input-dir /inputs/{{ $json.account_id }} --output-dir /outputs/accounts/{{ $json.account_id }}/v1"
      },
      "id": "exec-1",
      "name": "Transcribe Audio",
      "type": "n8n-nodes-base.executeCommand",
      "typeVersion": 1,
      "position": [
        650,
        300
      ]
    },
    {
      "parameters": {
        "command": "python /scripts/extract.py --transcript /outputs/accounts/{{ $json.account_id }}/v1/transcript.txt --chat /inputs/{{ $json.account_id }}/chat.txt --account-id {{ $json.account_id }} --output /outputs/accounts/{{ $json.account_id }}/v1/account_memo.json"
      },
      "id": "exec-2",
      "name": "Extract Account Memo",
      "type": "n8n-nodes-base.executeCommand",
      "typeVersion": 1,
      "position": [
        850,
        300
      ]
    },
    {
      "parameters": {
        "command": "python /scripts/generate_spec.py --memo /outputs/accounts/{{ $json.account_id }}/v1/account_memo.json --output /outputs/accounts/{{ $json.account_id }}/v1/agent_spec.json --version v1"
      },
      "id": "exec-3",
      "name": "Generate v1 Spec",
      "type": "n8n-nodes-base.executeCommand",
      "typeVersion": 1,
      "position": [
        1050,
        300
      ]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://api.retell.ai/create-agent",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "sendBody": true,
        "contentType": "json",
        "body": "={{ JSON.stringify({ \"agent_name\": $json.agent_name || \"Clara Agent\", \"voice_id\": \"11labs-Adrian\", \"language\": \"en-US\", \"response_engine\": {\"type\": \"retell-llm\"}, \"general_prompt\": $json.system_prompt }) }}"
      },
      "id": "http-1",
      "name": "Create Retell Agent",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 1,
      "position": [
        1250,
        300
      ]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://api.github.com/repos/{{ $env.GITHUB_REPO }}/issues",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "sendBody": true,
        "contentType": "json",
        "body": "={{ JSON.stringify({ \"title\": \"[\" + $json.account_id + \"] \" + $json.company_name + \" \u2014 Clara Agent Pipeline\", \"body\": \"## Account Details\\n| Field | Value |\\n|-------|-------|\\n| Account ID | \" + $json.account_id + \" |\\n| Company | \" + $json.company_name + \" |\\n| Created | \" + new Date().toISOString() + \" |\\n\\n## Pipeline Status\\n- [x] v1 Created (Demo)\\n- [ ] v2 Updated (Onboarding)\\n\", \"labels\": [\"clara-pipeline\", \"v1-created\"] }) }}"
      },
      "id": "http-2",
      "name": "Create GitHub Issue",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 1,
      "position": [
        1450,
        300
      ]
    },
    {
      "parameters": {
        "values": {
          "string": [
            {
              "name": "status",
              "value": "v1_created"
            }
          ]
        }
      },
      "id": "set-2",
      "name": "Set Complete Status",
      "type": "n8n-nodes-base.set",
      "typeVersion": 1,
      "position": [
        1650,
        300
      ]
    }
  ],
  "connections": {
    "Manual Trigger": {
      "main": [
        [
          {
            "node": "Set Account ID",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Account ID": {
      "main": [
        [
          {
            "node": "Transcribe Audio",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Transcribe Audio": {
      "main": [
        [
          {
            "node": "Extract Account Memo",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Account Memo": {
      "main": [
        [
          {
            "node": "Generate v1 Spec",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate v1 Spec": {
      "main": [
        [
          {
            "node": "Create Retell Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Retell Agent": {
      "main": [
        [
          {
            "node": "Create GitHub Issue",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create GitHub Issue": {
      "main": [
        [
          {
            "node": "Set Complete Status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}