Build a GPT-4o Conversational Agent with n8n LangChain Tools

This workflow builds a powerful GPT-4o conversational agent using n8n with LangChain tools like Wikipedia and SerpAPI. It solves the problem of context-aware, tool-assisted chat automation to deliver accurate, enhanced responses in real time.
agent
toolWikipedia
toolSerpApi
+4
Workflow Identifier: 1659
NODES in Use: manualChatTrigger, agent, memoryBufferWindow, toolWikipedia, toolSerpApi, lmChatOpenAi, stickyNote

Press CTRL+F5 if the workflow didn't load.

Learn how to Build this Workflow with AI:

Visit through Desktop for Best experience

What this workflow does

This workflow creates a chat assistant using GPT-4o-mini that answers user questions quickly and correctly.

It solves the problem of searching many websites for facts, saving time and avoiding mistakes.

The outcome is a chat agent that understands what users say, remembers recent talk, and uses Wikipedia and SerpAPI for fresh information.


Who should use this workflow

This is useful for customer support teams or anyone who must answer many questions fast and with good info.

It helps reduce time spent searching and improves answer accuracy.


Tools and services used

  • n8n Platform: Used to design and run the automation workflow.
  • OpenAI GPT-4o-mini: The AI language model that creates smart replies.
  • SerpAPI: Gives current search engine results for up-to-date info.
  • Wikipedia API: Provides factual information from Wikipedia articles.
  • LangChain Nodes: Manage chat memory, AI agent functions, and tool connections.

Inputs, Processing, and Outputs

Inputs

  • User types questions or messages using the Manual Chat Trigger node.

Processing Steps

  • The Window Buffer Memory node keeps the last 20 messages to keep conversation flow.
  • The AI Agent node reads the user input and decides how to answer.
  • The AI Agent calls the Tool Wikipedia and Tool SerpAPI nodes to find facts live from the web.
  • The Chat OpenAI node with GPT-4o-mini model generates the reply using collected info and memory.

Outputs

  • The AI Agent sends a clear, up-to-date, and well-informed chat reply to the user.

Beginner step-by-step: How to run this workflow in n8n

1. Importing the workflow

  1. Download the workflow file using the Download button on this page.
  2. Open n8n editor and click “Import from File”.
  3. Select and upload the downloaded workflow file.

2. Configuring the workflow

  1. Enter your OpenAI API Key in the Chat OpenAI node’s credentials.
  2. Add your SerpAPI key in the Tool SerpAPI node.
  3. No changes needed for Wikipedia API since it is public.
  4. Check if any IDs, emails, channels, or folders need updating for your setup (if applicable).

3. Testing and activating

  1. Run the workflow manually and send a test message through the Manual Chat Trigger node.
  2. See if the AI Agent returns a thoughtful answer.
  3. If all tests pass, activate the workflow for live use.
  4. For better privacy and control, consider also self-host n8n.

Customization ideas

  • You can change how many past messages the AI remembers by adjusting “contextWindowLength” in the Memory Buffer Window node.
  • Add more search or knowledge tools by including more LangChain-compatible tool nodes connected to the AI Agent.
  • Switch the GPT model in the Chat OpenAI node to a newer one if available for better answers.
  • Modify the AI Agent’s prompt settings to change how the agent thinks or replies.
  • Replace the manual trigger node with a webhook to accept chat messages automatically from other apps or websites.

Possible problems and fixes

  • AI Agent not responding: Check OpenAI API key and usage limits; verify credentials are correct.
  • Search tools not working: Confirm Wikipedia and SerpAPI nodes are connected and configured properly.
  • Memory not keeping context: Make sure Memory Buffer Window node is linked to AI Agent’s memory input and increase history length if needed.

Summary of results

✓ Faster answers to complex questions without manual searching.

✓ Reduced errors from outdated or missing info.

✓ Smarter chat replies that remember recent conversation.

→ Saves support teams many hours weekly.

→ Improves user satisfaction with instant, accurate help.


Frequently Asked Questions

Yes, other supported OpenAI models can replace GPT-4o-mini by updating the model name in the Chat OpenAI node settings.
No, the Window Buffer Memory node keeps only the last 20 messages per session. Permanent storage is not provided.
Yes, extra LangChain-compatible tool nodes like Google Search can be connected to the AI Agent’s tool inputs.
Replace the Manual Chat Trigger node with a webhook node to receive external chat messages and start the workflow automatically.

Promoted by BULDRR AI

Related Workflows

Automate Viral UGC Video Creation Using n8n + Degaus (Beginner-Friendly Guide)

Learn how to automate viral UGC video creation using n8n, AI prompts, and Degaus. This beginner-friendly guide shows how to import, configure, and run the workflow without technical complexity.
Form Trigger
Google Sheets
Gmail
+37
Free

AI SEO Blog Writer Automation Workflows in n8n

A complete beginner guide to building an AI SEO blog writer automation using n8n.
AI Agent
Google Sheets
httpRequest
+5
Free

Automate CrowdStrike Alerts with VirusTotal, Jira & Slack

This workflow automates processing of CrowdStrike detections by enriching threat data via VirusTotal, creating Jira tickets for incident tracking, and notifying teams on Slack for quick response. Save hours daily by transforming complex threat data into actionable alerts effortlessly.
scheduleTrigger
httpRequest
jira
+5
Free

Automate Telegram Invoices to Notion with AI Summaries & Reports

Save hours on financial tracking by automating invoice extraction from Telegram photos to Notion using Google Gemini AI. This workflow extracts data, records transactions, and generates detailed spending reports with charts sent on schedule via Telegram.
lmChatGoogleGemini
telegramTrigger
notion
+9
Free

Automate Email Replies with n8n and AI-Powered Summarization

Save hours managing your inbox with this n8n workflow that uses IMAP email triggers, AI summarization, and vector search to draft concise replies requiring minimal review. Automate business email processing efficiently with AI guidance and Gmail integration.
emailReadImap
vectorStoreQdrant
emailSend
+12
Free

Automate Email Campaigns Using n8n with Gmail & Google Sheets

This n8n workflow automates personalized email outreach campaigns by integrating Gmail and Google Sheets, saving hours of manual follow-up work and reducing errors in email sequences. It ensures timely follow-ups based on previous email interactions, optimizing communication efficiency.
googleSheets
gmail
code
+5
Free