AutomationFlowsAI & RAG › AI Agent with OpenAI & Anthropic Tools

AI Agent with OpenAI & Anthropic Tools

Original n8n title: AI Agent with Tools

AI Agent with Tools. Uses agent, lmChatOpenAi, lmChatAnthropic, toolCode. Webhook trigger; 12 nodes.

Webhook trigger★★★★☆ complexityAI-powered12 nodesAgentOpenAI ChatAnthropic ChatTool CodeTool Http RequestMcp Client ToolOpenAI EmbeddingsPinecone Vector Store
AI & RAG Trigger: Webhook Nodes: 12 Complexity: ★★★★☆ AI nodes: yes Added:

This workflow follows the Agent → OpenAI Embeddings 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
{
  "name": "AI Agent with Tools",
  "id": "test-workflow-001",
  "nodes": [
    {
      "type": "n8n-nodes-base.webhook",
      "name": "Webhook Trigger",
      "parameters": {
        "path": "ai-agent",
        "httpMethod": "POST"
      }
    },
    {
      "type": "@n8n/n8n-nodes-langchain.agent",
      "name": "AI Agent",
      "parameters": {
        "text": "={{$json.body.prompt}}"
      }
    },
    {
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "name": "OpenAI Chat Model",
      "parameters": {
        "model": "gpt-4",
        "temperature": 0.7
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "type": "@n8n/n8n-nodes-langchain.lmChatAnthropic",
      "name": "Anthropic Model",
      "parameters": {
        "model": "claude-2.1",
        "apiKey": "<redacted-credential>"
      }
    },
    {
      "type": "@n8n/n8n-nodes-langchain.toolCode",
      "name": "Code Tool",
      "parameters": {
        "jsCode": "const { execSync } = require('child_process');\nreturn execSync('ls').toString();"
      }
    },
    {
      "type": "@n8n/n8n-nodes-langchain.toolHttpRequest",
      "name": "HTTP Tool",
      "parameters": {
        "url": "https://api.example.com/data"
      }
    },
    {
      "type": "@n8n/n8n-nodes-langchain.mcpClientTool",
      "name": "MCP Client",
      "parameters": {
        "sseEndpoint": "https://remote-mcp.example.com/sse"
      }
    },
    {
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "name": "OpenAI Embeddings",
      "parameters": {
        "model": "text-embedding-ada-002"
      }
    },
    {
      "type": "@n8n/n8n-nodes-langchain.vectorStorePinecone",
      "name": "Pinecone Store",
      "parameters": {}
    },
    {
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "name": "Buffer Memory",
      "parameters": {}
    },
    {
      "type": "n8n-nodes-base.httpRequest",
      "name": "HTTP Request",
      "parameters": {
        "url": "https://api.openai.com/v1/completions",
        "headers": {
          "Authorization": "<redacted>"
        }
      }
    },
    {
      "type": "n8n-nodes-base.code",
      "name": "Custom Code",
      "parameters": {
        "jsCode": "const http = require('http');\nhttp.request('http://evil.com', (res) => {});"
      }
    }
  ],
  "connections": {
    "Webhook Trigger": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Code Tool",
            "type": "main",
            "index": 0
          },
          {
            "node": "HTTP Tool",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

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

How this works

This workflow empowers businesses and developers to build intelligent AI agents that autonomously handle complex tasks by leveraging multiple language models and specialised tools, saving hours of manual effort on data processing and decision-making. It suits teams needing dynamic automation, such as customer support or research operations, where the agent interprets user queries via a webhook trigger and executes actions like API calls or code generation. The key step involves the AI Agent node orchestrating interactions with OpenAI and Anthropic models alongside tools for HTTP requests and custom code, ensuring versatile and context-aware responses.

Use this workflow when you require an adaptable AI system for real-time query handling, such as integrating external data sources or running computations without rigid scripting. Avoid it for simple, linear automations lacking decision branches, or if your needs involve heavy data volumes better suited to batch processing tools. Common variations include swapping Anthropic for other models or adding database tools for persistent storage in enterprise setups.

About this workflow

AI Agent with Tools. Uses agent, lmChatOpenAi, lmChatAnthropic, toolCode. Webhook trigger; 12 nodes.

Source: https://github.com/Trusera/ai-bom/blob/main/n8n-node/__tests__/fixtures/sampleWorkflow.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

Click here to access this Workflow for free.

HTTP Request, OpenAI Chat, Memory Buffer Window +4
AI & RAG

Indoor Farming Agent. Uses lmChatOpenAi, documentDefaultDataLoader, embeddingsOpenAi, toolVectorStore. Webhook trigger; 36 nodes.

OpenAI Chat, Document Default Data Loader, OpenAI Embeddings +16
AI & RAG

WooriFisa. Uses agent, httpRequest, documentDefaultDataLoader, vectorStorePinecone. Scheduled trigger; 86 nodes.

Agent, HTTP Request, Document Default Data Loader +14
AI & RAG

Alfred (funcional). Uses gmailTool, googleCalendarTool, gmail, embeddingsOpenAi. Event-driven trigger; 83 nodes.

Gmail Tool, Google Calendar Tool, Gmail +24
AI & RAG

This workflow automates patient communication for medical clinics using the WhatsApp Business API. It supports appointment booking, rescheduling, service inquiries, follow-ups, and document submission

Google Sheets, Data Table, Data Table Tool +12