AI agent chat
Empower your applications with an intelligent AI agent capable of dynamic, context-aware conversations and real-time information retrieval. This workflow automates the process of handling incoming chat messages, directing them to an AI agent that leverages OpenAI's advanced language models for generating responses and SerpAPI for searching the web. It connects the "When chat message received" trigger directly to the "AI Agent" node, which then orchestrates interactions with the "OpenAI Chat Model" for conversational intelligence and the "SerpAPI" tool for fetching up-to-date information, all while maintaining conversational history using the "Window Buffer Memory" node. Businesses can use this for enhanced customer support chatbots, interactive product guides, or internal knowledge base assistants, providing instant, accurate answers and reducing the workload on human agents. This significantly saves time and effort by automating complex information retrieval and conversational tasks, allowing your team to focus on more strategic initiatives.
Workflow JSON
{"meta": {"instanceId": "408f9fb9940c3cb18ffdef0e0150fe342d6e655c3a9fac21f0f644e8bedabcd9"}, "nodes": [{"id": "939bb301-5e12-4d5b-9a56-61a61cca5f0d", "name": "OpenAI Chat Model", "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi", "position": [640, 460], "parameters": {"model": "gpt-4o-mini", "options": {}}, "credentials": {"openAiApi": {"id": "", "name": "[Your openAiApi]"}}, "typeVersion": 1}, {"id": "372777e8-ce90-4dea-befc-ac1b2eb4729f", "name": "Window Buffer Memory", "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow", "position": [780, 460], "parameters": {}, "typeVersion": 1.2}, {"id": "7a8f0ad1-1c00-4043-b3e5-c88521140a1a", "name": "SerpAPI", "type": "@n8n/n8n-nodes-langchain.toolSerpApi", "position": [920, 460], "parameters": {"options": {}}, "credentials": {"serpApi": {"id": "", "name": "[Your serpApi]"}}, "typeVersion": 1}, {"id": "a7624108-e3da-4193-a625-887314216b8b", "name": "When chat message received", "type": "@n8n/n8n-nodes-langchain.chatTrigger", "position": [360, 240], "webhookId": "53c136fe-3e77-4709-a143-fe82746dd8b6", "parameters": {"options": {}}, "typeVersion": 1.1}, {"id": "6b8b7de8-fe3f-43b5-97ce-a52a9e44eb5e", "name": "AI Agent", "type": "@n8n/n8n-nodes-langchain.agent", "position": [680, 240], "parameters": {"options": {}}, "typeVersion": 1.6}], "pinData": {}, "connections": {"SerpAPI": {"ai_tool": [[{"node": "AI Agent", "type": "ai_tool", "index": 0}]]}, "OpenAI Chat Model": {"ai_languageModel": [[{"node": "AI Agent", "type": "ai_languageModel", "index": 0}]]}, "Window Buffer Memory": {"ai_memory": [[{"node": "AI Agent", "type": "ai_memory", "index": 0}]]}, "When chat message received": {"main": [[{"node": "AI Agent", "type": "main", "index": 0}]]}}}How to Import This Workflow
- 1Copy the workflow JSON above using the Copy Workflow JSON button.
- 2Open your n8n instance and go to Workflows.
- 3Click Import from JSON and paste the copied workflow.
Don't have an n8n instance? Start your free trial at n8nautomation.cloud
Related Templates
Text to Speech (OpenAI)
Converts text into natural-sounding speech using OpenAI's Text-to-Speech API. It sends your input text to OpenAI and receives an audio file in return. This is useful for creating audio versions of articles, generating voiceovers for videos, or providing accessibility features for web content. Quickly transform written content into engaging audio.
LangChain - Example - Code Node Example
Explore a basic LangChain agent that answers questions using a custom tool. This workflow connects n8n's AI nodes and custom code nodes to OpenAI for language model interactions. It's useful for developers building custom AI assistants or researchers experimenting with agentic workflows. This saves development time by providing a ready-to-use example of a LangChain agent.
AI-Powered Candidate Shortlisting Automation for ERPNext
Automate AI-powered candidate shortlisting for ERPNext job applications. This workflow connects ERPNext, Google Gemini, WhatsApp, and Outlook to process resumes, evaluate candidates, and communicate outcomes. Recruiters and HR departments can use this to efficiently screen applicants, automatically reject unqualified candidates, and send acceptance notifications. It significantly reduces manual review time and streamlines the hiring process.