AutomationFlowsAI & RAG › Native: AI

Native: AI

Native: AI. Uses executeWorkflowTrigger, openAi, anthropic. Event-driven trigger; 8 nodes.

Event trigger★★★★☆ complexityAI-powered8 nodesExecute Workflow TriggerOpenAIAnthropic
AI & RAG Trigger: Event Nodes: 8 Complexity: ★★★★☆ AI nodes: yes Added:

This workflow follows the Execute Workflow Trigger → OpenAI recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "updatedAt": "2025-12-20T07:28:09.401Z",
  "createdAt": "2025-12-20T07:28:09.401Z",
  "id": "PqNPzr19PjlelCZ9",
  "name": "Native: AI",
  "description": null,
  "active": false,
  "isArchived": false,
  "nodes": [
    {
      "parameters": {},
      "id": "ai-trigger",
      "name": "Execute Workflow Trigger",
      "type": "n8n-nodes-base.executeWorkflowTrigger",
      "typeVersion": 1,
      "position": [
        240,
        300
      ]
    },
    {
      "parameters": {
        "jsCode": "// Route to specific AI integration\nconst input = $input.item.json;\nconst integrationName = input.integration.integration;\n\nreturn [{\n  json: {\n    ...input,\n    routing_node: integrationName\n  }\n}];"
      },
      "id": "ai-router",
      "name": "AI Router",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        460,
        300
      ]
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "openai",
              "name": "=openai",
              "value": "={{ $json.routing_node === 'openai' }}",
              "type": "boolean"
            },
            {
              "id": "anthropic",
              "name": "=anthropic",
              "value": "={{ $json.routing_node === 'anthropic' }}",
              "type": "boolean"
            },
            {
              "id": "gemini",
              "name": "=gemini",
              "value": "={{ $json.routing_node === 'google_gemini' }}",
              "type": "boolean"
            }
          ]
        },
        "options": {}
      },
      "id": "ai-switch-prep",
      "name": "Prepare Switch",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.3,
      "position": [
        680,
        300
      ]
    },
    {
      "parameters": {
        "dataType": "boolean",
        "value1": "={{ $json.openai }}",
        "rules": {
          "rules": [
            {
              "value2": true,
              "output": 0
            }
          ]
        },
        "fallbackOutput": 3
      },
      "id": "ai-switch",
      "name": "Switch: AI Provider",
      "type": "n8n-nodes-base.switch",
      "typeVersion": 3,
      "position": [
        900,
        300
      ]
    },
    {
      "parameters": {
        "resource": "text",
        "operation": "message",
        "modelId": "gpt-4",
        "messages": {
          "values": [
            {
              "role": "user",
              "content": "={{ $('Execute Workflow Trigger').item.json.command.params.prompt || 'Hello' }}"
            }
          ]
        },
        "options": {
          "temperature": 0.7,
          "maxTokens": 1000
        }
      },
      "id": "openai-node",
      "name": "OpenAI",
      "type": "n8n-nodes-base.openAi",
      "typeVersion": 1.3,
      "position": [
        1120,
        100
      ],
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "prompt": "={{ $('Execute Workflow Trigger').item.json.command.params.prompt || 'Hello' }}",
        "options": {}
      },
      "id": "anthropic-node",
      "name": "Anthropic",
      "type": "n8n-nodes-base.anthropic",
      "typeVersion": 1,
      "position": [
        1120,
        300
      ],
      "credentials": {
        "anthropicApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "jsCode": "// Generic AI handler for other providers\nconst input = $input.item.json;\nreturn [{\n  json: {\n    error: true,\n    message: `AI provider ${input.routing_node} not yet implemented`,\n    request_id: input.request_id\n  }\n}];"
      },
      "id": "ai-fallback",
      "name": "AI Fallback",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        1120,
        500
      ]
    },
    {
      "parameters": {
        "jsCode": "// Format AI response\nconst input = $('Execute Workflow Trigger').item.json;\nconst result = $input.item.json;\n\nreturn [{\n  json: {\n    success: !result.error,\n    request_id: input.request_id,\n    integration: input.integration.integration,\n    action: input.command.action,\n    result: result,\n    timestamp: new Date().toISOString()\n  }\n}];"
      },
      "id": "format-response",
      "name": "Format Response",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        1560,
        300
      ]
    }
  ],
  "connections": {
    "Execute Workflow Trigger": {
      "main": [
        [
          {
            "node": "AI Router",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Router": {
      "main": [
        [
          {
            "node": "Prepare Switch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Switch": {
      "main": [
        [
          {
            "node": "Switch: AI Provider",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Switch: AI Provider": {
      "main": [
        [
          {
            "node": "OpenAI",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Anthropic",
            "type": "main",
            "index": 0
          }
        ],
        [],
        [
          {
            "node": "AI Fallback",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI": {
      "main": [
        [
          {
            "node": "Format Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Anthropic": {
      "main": [
        [
          {
            "node": "Format Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Fallback": {
      "main": [
        [
          {
            "node": "Format Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1",
    "callerPolicy": "workflowsFromSameOwner",
    "availableInMCP": false
  },
  "staticData": null,
  "meta": null,
  "versionId": "0f4e5b60-b099-464a-bd62-471ae498db90",
  "activeVersionId": null,
  "versionCounter": 1,
  "triggerCount": 0,
  "shared": [
    {
      "updatedAt": "2025-12-20T07:28:09.403Z",
      "createdAt": "2025-12-20T07:28:09.403Z",
      "role": "workflow:owner",
      "workflowId": "PqNPzr19PjlelCZ9",
      "projectId": "2vYHfUSw9PyoLiDh",
      "project": {
        "updatedAt": "2025-12-20T07:26:10.218Z",
        "createdAt": "2025-12-20T07:24:36.044Z",
        "id": "2vYHfUSw9PyoLiDh",
        "name": "Morgan Mycosoft <morgan@mycosoft.org>",
        "type": "personal",
        "icon": null,
        "description": null,
        "projectRelations": [
          {
            "updatedAt": "2025-12-20T07:24:36.044Z",
            "createdAt": "2025-12-20T07:24:36.044Z",
            "userId": "22c64709-d230-4f0d-bd7a-db86b3d3cc34",
            "projectId": "2vYHfUSw9PyoLiDh",
            "user": {
              "updatedAt": "2025-12-20T07:30:13.000Z",
              "createdAt": "2025-12-20T07:24:35.720Z",
              "id": "22c64709-d230-4f0d-bd7a-db86b3d3cc34",
              "email": "morgan@mycosoft.org",
              "firstName": "Morgan",
              "lastName": "Mycosoft",
              "personalizationAnswers": {
                "version": "v4",
                "personalization_survey_submitted_at": "2025-12-20T07:26:31.298Z",
                "personalization_survey_n8n_version": "2.0.2",
                "companySize": "<20",
                "companyType": "saas",
                "role": "business-owner",
                "reportedSource": "friend"
              },
              "settings": {
                "userActivated": false
              },
              "disabled": false,
              "mfaEnabled": false,
              "lastActiveAt": "2025-12-20",
              "isPending": false
            }
          }
        ]
      }
    }
  ],
  "tags": [],
  "activeVersion": null
}

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

Native: AI. Uses executeWorkflowTrigger, openAi, anthropic. Event-driven trigger; 8 nodes.

Source: https://github.com/MycosoftLabs/mycosoft-mas/blob/439d030db9856bb5df78f89124324ed5a091593c/n8n/backup/Native__AI.json — original creator credit. Request a take-down →

More AI & RAG workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

AI & RAG

How it Works

Memory Buffer Window, Agent, Output Parser Structured +9
AI & RAG

The best content automation template in the market is now even better—with “deep research” on time-sensitive topics\! Unlike most n8n content automation templates that are mainly for “demo purposes,”

OpenAI, HTTP Request, XML +11
AI & RAG

Template Nodes Example. Uses CUSTOM, formTrigger, executeWorkflowTrigger, chatTrigger. Event-driven trigger; 70 nodes.

Custom, Form Trigger, Execute Workflow Trigger +23
AI & RAG

Template Carnaval - time instagram. Uses toolWorkflow, lmChatOpenAi, memoryBufferWindow, agent. Event-driven trigger; 56 nodes.

Tool Workflow, OpenAI Chat, Memory Buffer Window +10
AI & RAG

Turn your Telegram into a personal Bloomberg terminal. Ask any question about any stock — get institutional-grade analysis back in seconds. TwelveData Pro Analyst is a complete, ready-to-import n8n wo

Telegram, Telegram Trigger, Agent +6