{
  "name": "Redlynr Guarded Action \u2014 Starter",
  "nodes": [
    {
      "parameters": {},
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        0,
        0
      ],
      "id": "770530b5-b23d-489b-b333-6153458325d1",
      "name": "When clicking \u2018Execute workflow\u2019"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "94009708-ec68-4c43-9455-bec21a136b10",
              "name": "tenant_id",
              "value": "YOUR_TENANT_ID",
              "type": "string"
            },
            {
              "id": "bb75f8c3-f953-41f5-8400-c510005101ce",
              "name": "agent_id",
              "value": "n8n_demo_agent",
              "type": "string"
            },
            {
              "id": "d99b437e-59a2-4ffd-846d-bbaeb5f3b46a",
              "name": "chain_id",
              "value": "n8n_demo_chain_001",
              "type": "string"
            },
            {
              "id": "38255996-d538-4fc2-b3b5-ed08414f215a",
              "name": "depth",
              "value": 0,
              "type": "number"
            },
            {
              "id": "d63163fc-97b3-48c9-b7ad-06601b3697e6",
              "name": "step_cost",
              "value": 0.01,
              "type": "number"
            },
            {
              "id": "d86cadcc-b6fe-4624-9e97-3b2cc0d92f2c",
              "name": "chain_type",
              "value": "interactive",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.5,
      "position": [
        224,
        0
      ],
      "id": "2d208244-3624-44a4-8b3b-0bd78ac46f75",
      "name": "Prepare Action"
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://redlynr.com/run",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "X-Trial-Token",
              "value": "YOUR_TRIAL_TOKEN"
            }
          ]
        },
        "sendBody": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "tenant_id",
              "value": "={{ $json.tenant_id }}"
            },
            {
              "name": "agent_id",
              "value": "={{ $json.agent_id }}"
            },
            {
              "name": "chain_id",
              "value": "={{ $json.chain_id }}"
            },
            {
              "name": "depth",
              "value": "={{ $json.depth }}"
            },
            {
              "name": "step_cost",
              "value": "={{ $json.step_cost }}"
            },
            {
              "name": "chain_type",
              "value": "={{ $json.chain_type }}"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.5,
      "position": [
        448,
        0
      ],
      "id": "4a993468-61be-4225-a8b7-033808d0f69c",
      "name": "Redlynr Guardrail"
    },
    {
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 3
                },
                "conditions": [
                  {
                    "leftValue": "={{ $json.decision }}",
                    "rightValue": "proceed",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "id": "126dac0b-15ab-4693-be11-31752caffa72"
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "proceed"
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 3
                },
                "conditions": [
                  {
                    "id": "cca99801-c48c-40f6-8524-9fb3269f1181",
                    "leftValue": "={{ $json.decision }}",
                    "rightValue": "slow_down",
                    "operator": {
                      "type": "string",
                      "operation": "equals",
                      "name": "filter.operator.equals"
                    }
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "slow_down"
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 3
                },
                "conditions": [
                  {
                    "id": "98ac3af3-2e85-4012-946d-b363a807e8b0",
                    "leftValue": "={{ $json.decision }}",
                    "rightValue": "stop",
                    "operator": {
                      "type": "string",
                      "operation": "equals",
                      "name": "filter.operator.equals"
                    }
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "stop"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.switch",
      "typeVersion": 3.4,
      "position": [
        672,
        0
      ],
      "id": "253fcc9e-9387-409d-a2f7-129875055909",
      "name": "Switch"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "c79c4228-1050-4d15-865b-f9a689f73bb7",
              "name": "executed",
              "value": true,
              "type": "boolean"
            },
            {
              "id": "74574764-4918-430e-a4d7-05371909e4a5",
              "name": "message",
              "value": "Protected action executed.",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.5,
      "position": [
        768,
        -112
      ],
      "id": "88d7d3cc-f6e1-4b77-a767-329661d99626",
      "name": "Protected Action"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "2fbf5491-1808-4f13-8915-60a897b8ff70",
              "name": "executed",
              "value": false,
              "type": "boolean"
            },
            {
              "id": "2428f03c-0ff8-43e7-adf9-b0c175be6ff8",
              "name": "decision",
              "value": "={{ $json.decision }}",
              "type": "string"
            },
            {
              "id": "7c223b38-4672-4c30-a47f-5f4baa17163c",
              "name": "reason",
              "value": "={{ $json.reason }}",
              "type": "string"
            },
            {
              "id": "f465fd71-473e-4a41-974f-3cdb989e6c6c",
              "name": "message",
              "value": "Protected action blocked by Redlynr.",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.5,
      "position": [
        768,
        112
      ],
      "id": "78ec6595-2e82-4bda-8966-63091715b431",
      "name": "Action Blocked"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "bfeb1abb-cde1-4b5b-85a4-13dcd7ea885a",
              "name": "executed",
              "value": false,
              "type": "boolean"
            },
            {
              "id": "585ce7bf-b07f-4d10-82ff-ce03fd290f01",
              "name": "decision",
              "value": "={{ $json.decision }}",
              "type": "string"
            },
            {
              "id": "748e97f8-1b5e-490a-8cfe-75bce0f2fa87",
              "name": "reason",
              "value": "={{ $json.reason }}",
              "type": "string"
            },
            {
              "id": "96236d9c-b729-41ed-a5eb-31a98fd16362",
              "name": "wait_seconds",
              "value": "={{ $json.wait_seconds }}",
              "type": "string"
            },
            {
              "id": "828e8f48-f4dc-49b1-850a-b3205b90ce57",
              "name": "message",
              "value": "Redlynr requested a slowdown before the protected action.",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.5,
      "position": [
        896,
        0
      ],
      "id": "7c15b9a6-c891-42e3-ba71-febca3a80746",
      "name": "Slow Down"
    }
  ],
  "pinData": {},
  "connections": {
    "When clicking \u2018Execute workflow\u2019": {
      "main": [
        [
          {
            "node": "Prepare Action",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Action": {
      "main": [
        [
          {
            "node": "Redlynr Guardrail",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Redlynr Guardrail": {
      "main": [
        [
          {
            "node": "Switch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Switch": {
      "main": [
        [
          {
            "node": "Protected Action",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Slow Down",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Action Blocked",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1",
    "binaryMode": "separate"
  },
  "nodeGroups": [],
  "tags": []
}