{
  "elementsLearnedData": [],
  "elementsTestData": [],
  "flow": {
    "id": "AB0DA7B3-A174-413D-8AB3-D8789037E3CA",
    "name": "Captain: Zendesk tickets answered from documents"
  },
  "flowVersion": {
    "clientMetadata": {
      "viewport": {
        "x": -52.05020920502092,
        "y": 6.527196652719667,
        "zoom": 0.84
      },
      "autoSave": false,
      "descriptions": {
        "flow": "When a new Zendesk ticket arrives, searches the help-center and policy collection in Captain with the ticket's subject and description, drafts a suggested answer from the top passages with each point's document and page, and adds it to the ticket as an internal note. When nothing matches, the note says so.",
        "initialData": "",
        "initialDataFields": {}
      }
    },
    "description": "When a new Zendesk ticket arrives, searches the help-center and policy collection in Captain with the ticket's subject and description, drafts a suggested answer from the top passages with each point's document and page, and adds it to the ticket as an internal note. When nothing matches, the note says so.",
    "elements": [
      {
        "clientMetadata": {
          "elementId": "condition",
          "isFirstElement": false,
          "blockDefinitionId": "condition",
          "position": {
            "x": 1152,
            "y": 49
          }
        },
        "flowElementId": "B80A4111-74A0-4B7C-BB85-69152078D1FF",
        "groupId": null,
        "id": "A2D1BDD6-30BD-407B-A6CF-B609AF9959FB",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "condition": {
            "conditionParts": [
              {
                "id": "09b76903-afcd-4b75-a391-faec031c3a1f",
                "nestedOperation": null,
                "operation": ">",
                "property": {
                  "expression": [
                    {
                      "id": "ELEMENT_RESULT",
                      "label": "Passages",
                      "subPathSegments": [
                        {
                          "key": "total_results",
                          "optional": false
                        }
                      ],
                      "type": "ELEMENT_LINK",
                      "value": "996C75AF-9BCA-4D84-9CD5-86D0B58CED35"
                    }
                  ],
                  "mode": "EXPRESSION",
                  "parseJsonString": false,
                  "resultType": null
                },
                "propertyType": "INT",
                "values": [
                  {
                    "expression": [
                      {
                        "id": "NUMBER",
                        "label": null,
                        "type": "INPUT",
                        "value": 0
                      }
                    ],
                    "mode": "EXPRESSION",
                    "parseJsonString": false,
                    "resultType": null
                  }
                ]
              }
            ],
            "grouping": [
              "09b76903-afcd-4b75-a391-faec031c3a1f"
            ]
          },
          "elseComponent": {
            "componentId": "F88E82D1-B322-4042-9383-187157FCA94C",
            "componentType": "ELEMENT"
          },
          "logging": null,
          "onFailElemId": null,
          "resultAlias": "Passages check",
          "storeResult": false,
          "thenComponent": {
            "componentId": "27017D5C-F25B-4BEF-A00C-CA990806141C",
            "componentType": "ELEMENT"
          }
        },
        "name": "Any passages found?",
        "nextElementIds": [
          "F88E82D1-B322-4042-9383-187157FCA94C",
          "27017D5C-F25B-4BEF-A00C-CA990806141C"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "preferredDateFormats": []
        },
        "type": "CONDITION"
      },
      {
        "clientMetadata": {
          "notes": "Adds a comment (public reply or private internal note) to an existing ticket, optionally with file attachments (by file URL, or by tokens from Upload Attachment) and a new ticket status in the same update. Returns the updated ticket.",
          "elementId": "EXTENSION:::SHARED:::default:::zendesk:::addCommentToTicket",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Note that nothing matched Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::zendesk:::addCommentToTicket",
          "legacyElementId": "JS###v1###Zendesk###addCommentToTicket",
          "methodName": "addCommentToTicket",
          "position": {
            "x": 1459,
            "y": 40
          }
        },
        "flowElementId": "0C51F01F-E767-4BD1-9B11-6325307C4319",
        "groupId": null,
        "id": "F88E82D1-B322-4042-9383-187157FCA94C",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "ticketId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "RESULT",
                    "label": "New ticket",
                    "subPathSegments": [
                      {
                        "key": "ticketId",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "7B4406AC-C822-4CAF-B271-BA32ABE43D3B"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "commentBody",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": "Captain found no passage in "
                  },
                  {
                    "id": "PLACEHOLDER_DATA",
                    "label": "Captain collection",
                    "subPathSegments": null,
                    "type": "EXECUTION_CONTEXT_STATIC_DATA",
                    "value": "Captain collection"
                  },
                  {
                    "id": "TEXT",
                    "label": null,
                    "type": "INPUT",
                    "value": " for this ticket. Nothing to suggest from your documents; this one needs an answer from scratch."
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "htmlBody",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "publicComment",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "K_FALSE",
                    "label": null,
                    "type": "KEYWORD",
                    "value": false
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "status",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "attachmentUrls",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "uploadTokens",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "connectionId": null,
          "enabled": true,
          "hostType": "SHARED",
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "methodName": "addCommentToTicket",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "No match note",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "zendesk",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Note that nothing matched",
        "nextElementIds": [],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "ai-agent",
          "isFirstElement": false,
          "blockDefinitionId": "ai-agent",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Draft the suggested answer Result"
          },
          "tools": {},
          "position": {
            "x": 780,
            "y": 219
          }
        },
        "flowElementId": "A826CCCB-C2AF-412E-8D06-D9D0880196A0",
        "groupId": null,
        "id": "A2A34737-D317-4BFE-AE4F-917578C1A160",
        "metaInfo": {
          "aiApiKey": null,
          "aiModel": "claude-sonnet-5",
          "aiProvider": "ANTHROPIC",
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "dynamicAiApiKey": {
            "expression": [
              {
                "id": "PLACEHOLDER_DATA",
                "label": "Anthropic key",
                "subPathSegments": null,
                "type": "EXECUTION_CONTEXT_STATIC_DATA",
                "value": "Anthropic key"
              }
            ],
            "mode": "EXPRESSION",
            "parseJsonString": false,
            "resultType": null
          },
          "enabled": true,
          "files": [],
          "forceParsedOutput": false,
          "langSmithSettings": {
            "enabled": false,
            "apiKey": null,
            "projectName": null,
            "label": "FlowRunner AI-Agent",
            "accountCluster": "US"
          },
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "messagesHistoryEnabled": false,
          "messagesHistoryLimit": 15,
          "onFailElemId": null,
          "resultAlias": "Draft",
          "retryPolicy": null,
          "saveToVariable": null,
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "systemPrompt": {
            "expression": [
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": "You help a support team answer tickets from the company's own documents. You get a new Zendesk ticket and the passages Captain found in the team's document collection, each numbered with its document, page and score. Write an internal note for the support agent, in plain text, with no greeting.\n\nRules:\n- Use only what the passages say. Never add facts from memory or guess.\n- Start with one line. Either \"Suggested answer, from your documents:\" or, when no passage actually answers the question, \"No passage in the collection answers this ticket.\" followed by one sentence on what came closest.\n- Then give the suggested answer as short points, in the customer's terms.\n- End every point with its source in square brackets: the document name and page, for example [Refund Policy 2025.pdf, page 3].\n- Finish with the line \"Check the cited pages before replying to the customer.\"\n- Keep the whole note under 250 words."
              }
            ],
            "mode": "EXPRESSION",
            "parseJsonString": false,
            "resultType": null
          },
          "tools": [],
          "type": "AI_AGENT",
          "userPrompt": {
            "expression": [
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": "Ticket #"
              },
              {
                "id": "RESULT",
                "label": "New ticket",
                "subPathSegments": [
                  {
                    "key": "ticketId",
                    "optional": false
                  }
                ],
                "type": "TRIGGER_DATA",
                "value": "7B4406AC-C822-4CAF-B271-BA32ABE43D3B"
              },
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": " from "
              },
              {
                "id": "RESULT",
                "label": "New ticket",
                "subPathSegments": [
                  {
                    "key": "requesterName",
                    "optional": false
                  }
                ],
                "type": "TRIGGER_DATA",
                "value": "7B4406AC-C822-4CAF-B271-BA32ABE43D3B"
              },
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": "\nSubject: "
              },
              {
                "id": "RESULT",
                "label": "New ticket",
                "subPathSegments": [
                  {
                    "key": "subject",
                    "optional": false
                  }
                ],
                "type": "TRIGGER_DATA",
                "value": "7B4406AC-C822-4CAF-B271-BA32ABE43D3B"
              },
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": "\n\n"
              },
              {
                "id": "ELEMENT_RESULT",
                "label": "Ticket",
                "subPathSegments": [
                  {
                    "key": "description",
                    "optional": false
                  }
                ],
                "type": "ELEMENT_LINK",
                "value": "5DDD2F2A-476A-42DC-8820-EE510C81F880"
              },
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": "\n\nPassages from Captain ("
              },
              {
                "id": "ELEMENT_RESULT",
                "label": "Cited passages",
                "subPathSegments": [
                  {
                    "key": "count",
                    "optional": false
                  }
                ],
                "type": "ELEMENT_LINK",
                "value": "27017D5C-F25B-4BEF-A00C-CA990806141C"
              },
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": " found in "
              },
              {
                "id": "PLACEHOLDER_DATA",
                "label": "Captain collection",
                "subPathSegments": null,
                "type": "EXECUTION_CONTEXT_STATIC_DATA",
                "value": "Captain collection"
              },
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": "):\n\n"
              },
              {
                "id": "ELEMENT_RESULT",
                "label": "Cited passages",
                "subPathSegments": [
                  {
                    "key": "text",
                    "optional": false
                  }
                ],
                "type": "ELEMENT_LINK",
                "value": "27017D5C-F25B-4BEF-A00C-CA990806141C"
              }
            ],
            "mode": "EXPRESSION",
            "parseJsonString": false,
            "resultType": null
          }
        },
        "name": "Draft the suggested answer",
        "nextElementIds": [
          "5802E785-0A72-4B42-8265-DE34CFE4B04B"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "notes": "Fires when a ticket is created or updated in Zendesk. Provisions a Zendesk webhook plus a business-rule trigger that posts the ticket's ID (a number, like Get Ticket's), subject, status, priority, type, tags, requester, assignee, and URL to FlowRunner in real time. A flow activated before tags were added receives them once it is activated again.",
          "elementId": "EXTENSION:::SHARED:::default:::zendesk:::onTicketEvent",
          "isFirstElement": true,
          "blockDefinitionId": "api-service-trigger",
          "newElementId": "EXTENSION:::SHARED:::default:::zendesk:::onTicketEvent",
          "legacyElementId": "JS###v1###Zendesk###onTicketEvent",
          "methodName": "onTicketEvent",
          "position": {
            "x": 110,
            "y": 40
          }
        },
        "flowElementId": "FB373638-B682-4C20-80A4-AF7F45CDF4D7",
        "groupId": null,
        "id": "7B4406AC-C822-4CAF-B271-BA32ABE43D3B",
        "metaInfo": {
          "callbackUrl": null,
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "condition": null,
          "connectionId": null,
          "eventName": "onTicketEvent",
          "hostType": "SHARED",
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": null
          },
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "New ticket",
          "scope": "SINGLE_APP",
          "serviceId": "zendesk",
          "slaConditions": [],
          "staticData": {
            "event": "created"
          },
          "storeResult": true,
          "subtype": "REALTIME",
          "type": "CUSTOM"
        },
        "name": "New ticket in Zendesk",
        "nextElementIds": [
          "5DDD2F2A-476A-42DC-8820-EE510C81F880"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "TRIGGER"
      },
      {
        "clientMetadata": {
          "notes": "Retrieves a single Zendesk ticket by ID, including subject, description, status, priority, requester, assignee, group, tags, and custom fields.",
          "elementId": "EXTENSION:::SHARED:::default:::zendesk:::getTicket",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Read the ticket Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::zendesk:::getTicket",
          "legacyElementId": "JS###v1###Zendesk###getTicket",
          "methodName": "getTicket",
          "position": {
            "x": 440,
            "y": 40
          }
        },
        "flowElementId": "9A3DAB24-95E3-41FE-90B9-7D13189C1FBB",
        "groupId": null,
        "id": "5DDD2F2A-476A-42DC-8820-EE510C81F880",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "ticketId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "RESULT",
                    "label": "New ticket",
                    "subPathSegments": [
                      {
                        "key": "ticketId",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "7B4406AC-C822-4CAF-B271-BA32ABE43D3B"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "connectionId": null,
          "enabled": true,
          "hostType": "SHARED",
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "methodName": "getTicket",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "Ticket",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "zendesk",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Read the ticket",
        "nextElementIds": [
          "996C75AF-9BCA-4D84-9CD5-86D0B58CED35"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "notes": "Searches a collection in natural language and returns the best matching passages with their documents, pages and scores.",
          "elementId": "EXTENSION:::SHARED:::default:::captain:::searchCollection",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Search your documents in Captain Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::captain:::searchCollection",
          "legacyElementId": null,
          "methodName": "searchCollection",
          "position": {
            "x": 757,
            "y": 40
          }
        },
        "flowElementId": "FA5A530E-740A-45DC-86FC-66973C8AB92E",
        "groupId": null,
        "id": "996C75AF-9BCA-4D84-9CD5-86D0B58CED35",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "collectionName",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "PLACEHOLDER_DATA",
                    "label": "Captain collection",
                    "subPathSegments": null,
                    "type": "EXECUTION_CONTEXT_STATIC_DATA",
                    "value": "Captain collection"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "query",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "RESULT",
                    "label": "New ticket",
                    "subPathSegments": [
                      {
                        "key": "subject",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "7B4406AC-C822-4CAF-B271-BA32ABE43D3B"
                  },
                  {
                    "id": "NEWLINE",
                    "label": null,
                    "type": "KEYWORD",
                    "value": "\n"
                  },
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Ticket",
                    "subPathSegments": [
                      {
                        "key": "description",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "5DDD2F2A-476A-42DC-8820-EE510C81F880"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "limit",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "NUMBER",
                    "label": null,
                    "type": "INPUT",
                    "value": 8
                  }
                ],
                "mode": "BASIC",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "filter",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "rerank",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "semanticRatio",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "maxChunksPerDocument",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "NUMBER",
                    "label": null,
                    "type": "INPUT",
                    "value": 3
                  }
                ],
                "mode": "BASIC",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "connectionId": null,
          "enabled": true,
          "hostType": "SHARED",
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "methodName": "searchCollection",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "Passages",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "captain",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Search your documents in Captain",
        "nextElementIds": [
          "A2D1BDD6-30BD-407B-A6CF-B609AF9959FB"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "notes": "Adds a comment (public reply or private internal note) to an existing ticket, optionally with file attachments (by file URL, or by tokens from Upload Attachment) and a new ticket status in the same update. Returns the updated ticket.",
          "elementId": "EXTENSION:::SHARED:::default:::zendesk:::addCommentToTicket",
          "isFirstElement": false,
          "blockDefinitionId": "api-service-method",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Add the note to the ticket Result"
          },
          "newElementId": "EXTENSION:::SHARED:::default:::zendesk:::addCommentToTicket",
          "legacyElementId": "JS###v1###Zendesk###addCommentToTicket",
          "methodName": "addCommentToTicket",
          "position": {
            "x": 422,
            "y": 210
          }
        },
        "flowElementId": "0C7C1C28-A819-4808-BE38-5C0D17505966",
        "groupId": null,
        "id": "5802E785-0A72-4B42-8265-DE34CFE4B04B",
        "metaInfo": {
          "bodyParams": [
            {
              "name": "ticketId",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "RESULT",
                    "label": "New ticket",
                    "subPathSegments": [
                      {
                        "key": "ticketId",
                        "optional": false
                      }
                    ],
                    "type": "TRIGGER_DATA",
                    "value": "7B4406AC-C822-4CAF-B271-BA32ABE43D3B"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "commentBody",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Draft",
                    "subPathSegments": [
                      {
                        "key": "output",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "A2A34737-D317-4BFE-AE4F-917578C1A160"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "htmlBody",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "publicComment",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "K_FALSE",
                    "label": null,
                    "type": "KEYWORD",
                    "value": false
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "status",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "attachmentUrls",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            },
            {
              "name": "uploadTokens",
              "type": "SIMPLE",
              "value": {
                "expression": [],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "connectionId": null,
          "enabled": true,
          "hostType": "SHARED",
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "methodName": "addCommentToTicket",
          "onFailElemId": null,
          "packageId": "default",
          "resultAlias": "Note added",
          "retryPolicy": null,
          "saveToVariable": null,
          "serviceId": "zendesk",
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "subtype": "API_SERVICE",
          "type": "EXTENSION"
        },
        "name": "Add the note to the ticket",
        "nextElementIds": [],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      },
      {
        "clientMetadata": {
          "elementId": "custom-cloud-code",
          "isFirstElement": false,
          "blockDefinitionId": "custom-cloud-code",
          "setResultToVariable": false,
          "saveToVariable": {
            "dataBucket": "Default",
            "variable": "Gather the passages Result"
          },
          "position": {
            "x": 1155,
            "y": 219
          }
        },
        "flowElementId": "0C8D9584-6A81-48FA-A097-C0C76779DFDE",
        "groupId": null,
        "id": "27017D5C-F25B-4BEF-A00C-CA990806141C",
        "metaInfo": {
          "clientValidationState": {
            "errorMessage": null,
            "valid": true
          },
          "codeArguments": [
            {
              "name": "results",
              "type": "SIMPLE",
              "value": {
                "expression": [
                  {
                    "id": "ELEMENT_RESULT",
                    "label": "Passages",
                    "subPathSegments": [
                      {
                        "key": "results",
                        "optional": false
                      }
                    ],
                    "type": "ELEMENT_LINK",
                    "value": "996C75AF-9BCA-4D84-9CD5-86D0B58CED35"
                  }
                ],
                "mode": "EXPRESSION",
                "parseJsonString": false,
                "resultType": null
              }
            }
          ],
          "codeBody": {
            "expression": [
              {
                "id": "TEXT",
                "label": null,
                "type": "INPUT",
                "value": "const list = Array.isArray(results) ? results : [];\nconst items = list.map((r, i) => {\n  const doc = r.document || {};\n  const loc = r.location || {};\n  let page = 'no page';\n  if (loc.page_start) {\n    page = loc.page_end && loc.page_end !== loc.page_start ? `pages ${loc.page_start}-${loc.page_end}` : `page ${loc.page_start}`;\n  } else if (loc.sheet_name) {\n    page = `sheet ${loc.sheet_name}`;\n  }\n  return {\n    n: i + 1,\n    document: doc.filename || doc.id || 'unknown document',\n    page,\n    score: Number(r.score || 0).toFixed(3),\n    text: String(r.text || '').trim(),\n  };\n});\nconst text = items.map(p => `[${p.n}] ${p.document}, ${p.page} (score ${p.score})\\n${p.text}`).join('\\n\\n');\nreturn { items, text, count: items.length };"
              }
            ],
            "mode": "EXPRESSION",
            "parseJsonString": false,
            "resultType": null
          },
          "enabled": true,
          "logging": {
            "input": {
              "logData": false,
              "message": null
            },
            "output": {
              "logData": false,
              "message": null
            }
          },
          "onFailElemId": null,
          "resultAlias": "Cited passages",
          "retryPolicy": null,
          "saveToVariable": null,
          "simulationResult": null,
          "slaConditions": [],
          "storeResult": true,
          "type": "CUSTOM_CLOUD_CODE"
        },
        "name": "Gather the passages",
        "nextElementIds": [
          "A2A34737-D317-4BFE-AE4F-917578C1A160"
        ],
        "nextGroupIds": [],
        "serverFields": {
          "learningStatus": "OFF"
        },
        "type": "ACTION"
      }
    ],
    "firstElementId": "7B4406AC-C822-4CAF-B271-BA32ABE43D3B",
    "groups": [],
    "id": "3E7CA877-5901-400B-9303-E94313E3D05D",
    "metaInfo": {
      "clientValidationState": {
        "errorMessage": null,
        "valid": true
      },
      "errorMessage": null,
      "executionStaticData": [
        {
          "description": "The Anthropic key the drafting agent uses.",
          "error": null,
          "name": "Anthropic key",
          "type": "API_KEY",
          "value": null
        },
        {
          "description": "The Captain collection that holds your help-center articles and policies, by name.",
          "error": null,
          "name": "Captain collection",
          "type": "STRING",
          "value": ""
        }
      ],
      "initialData": null,
      "initialDataDefaultValues": {},
      "ownerFlowVersionId": null,
      "schedule": null,
      "sharedMemory": {
        "anchor": {
          "missingAnchorPolicy": null,
          "path": null,
          "type": "FLOW_MEMORY"
        },
        "expirationInSec": null
      },
      "wasLive": false
    }
  },
  "slaCalendars": [],
  "slaGoals": [],
  "subFlows": [],
  "exportDate": "2026-12-02T08:37:46.040Z"
}
