{
  "name": "Evaluation metric example: Check if tool was called",
  "nodes": [
    {
      "id": "ffd0cca6-4a60-4058-b3fb-c92d949ea864",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -960,
        -120
      ]
    },
    {
      "id": "73055399-e667-45cb-8a32-accb83dd74f8",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -1000,
        140
      ]
    },
    {
      "id": "54ffa0e9-dbf7-4406-9952-485ca46d1172",
      "name": "Calculator",
      "type": "@n8n/n8n-nodes-langchain.toolCalculator",
      "position": [
        -840,
        140
      ]
    },
    {
      "id": "09dcce53-ce33-4263-b903-655db12d13dd",
      "name": "Check if tool called",
      "type": "n8n-nodes-base.set",
      "position": [
        -340,
        -240
      ]
    },
    {
      "id": "62fb0980-6c8e-4ab6-b914-59339b4b385f",
      "name": "Fetch a webpage",
      "type": "n8n-nodes-base.httpRequestTool",
      "position": [
        -700,
        140
      ]
    },
    {
      "id": "ec4c82df-8804-49f2-a8ba-348f29b97cd6",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -980,
        -200
      ],
      "parameters": {
        "width": 300,
        "height": 220,
        "content": "Make sure to enable 'Return intermediate steps' in the agent, to get the list of executed tools"
      }
    },
    {
      "id": "f6fa8aef-4362-4691-85fc-2612eb1dee63",
      "name": "When chat message received",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "position": [
        -1440,
        -240
      ]
    },
    {
      "id": "d1274230-aa4d-4456-93ea-8123e263df7d",
      "name": "Match chat format",
      "type": "n8n-nodes-base.set",
      "position": [
        -1220,
        40
      ]
    },
    {
      "id": "474a2321-7a4c-41be-a8fa-718f5a093171",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -380,
        -320
      ],
      "parameters": {
        "width": 180,
        "height": 240,
        "content": "Check whether the list of executed tools contains the target tool"
      }
    },
    {
      "id": "3351706d-e7e9-4701-9224-b4c873167c0d",
      "name": "Return chat response",
      "type": "n8n-nodes-base.noOp",
      "position": [
        -340,
        40
      ]
    },
    {
      "id": "e7beb2d8-f864-4aea-84f2-0d82987f52f8",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1740,
        -280
      ],
      "parameters": {
        "width": 200,
        "height": 500,
        "content": "## How it works\nThis template shows how to calculate a workflow evaluation metric: **whether a specific tool was called** by an agent.\n\nYou can find more information on workflow evaluation [here](http"
      }
    },
    {
      "id": "a990cca2-7ea5-4d43-9cc2-b6257299bcc1",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1500,
        -60
      ],
      "parameters": {
        "width": 220,
        "height": 260,
        "content": "Read in [this test dataset](https://docs.google.com/spreadsheets/d/1uuPS5cHtSNZ6HNLOi75A2m8nVWZrdBZ_Ivf58osDAS8/edit?gid=969651976#gid=969651976) of questions and the tools that should be called when "
      }
    },
    {
      "id": "f0f7e18c-029f-4e0a-ac2f-168e10b5f51f",
      "name": "When fetching a dataset row",
      "type": "n8n-nodes-base.evaluationTrigger",
      "position": [
        -1440,
        40
      ]
    },
    {
      "id": "e0c49dc5-a06b-4552-b53c-e5dfc51017e0",
      "name": "Evaluation",
      "type": "n8n-nodes-base.evaluation",
      "position": [
        -120,
        -240
      ]
    },
    {
      "id": "5b14c47b-2dae-4ca7-882c-d0ec722eadab",
      "name": "Evaluating?",
      "type": "n8n-nodes-base.evaluation",
      "position": [
        -580,
        -120
      ]
    }
  ],
  "connections": {
    "AI Agent": {
      "main": [
        [
          {
            "node": "Evaluating?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Calculator": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Evaluating?": {
      "main": [
        [
          {
            "node": "Check if tool called",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Return chat response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch a webpage": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Match chat format": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Check if tool called": {
      "main": [
        [
          {
            "node": "Evaluation",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When chat message received": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When fetching a dataset row": {
      "main": [
        [
          {
            "node": "Match chat format",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}