Smart Chatbot with AI Agent, Memory, and Web Search - n8n Workflow

Deploy a powerful n8n workflow using AI Agents, GPT, and web search capabilities. This n8n template provides a sophisticated, conversational chatbot solution with persistent memory.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

Developers or businesses looking to embed a custom, intelligent chatbot on their website using n8n.
Users who need an n8n template that combines conversational memory with real-time web search for up-to-date answers.
Automation specialists seeking to build complex AI agents within the n8n platform.
Anyone interested in leveraging the AI Agent n8n node for advanced decision-making workflows.

Overview

This comprehensive n8n workflow is designed to deploy a high-performance, context-aware chatbot named 'Sofia.' The core value of this n8n template lies in its ability to utilize conversational memory (ensuring context across messages) and dynamic web search (keeping answers current and factual). By utilizing the AI Agent n8n node, the bot acts as a central decision engine, choosing whether to answer based on its internal knowledge or perform a web search when necessary. This results in a seamless, professional, and highly capable customer interaction tool, providing an exceptional example of what is possible with advanced n8n automation and AI integration.

How it Works

The process begins with the When chat message received n8n trigger. This n8n node instantly activates the workflow when a user sends a message, while also managing the UI/UX and initial session memory via the Simple Memory n8n node.


  1. Trigger & Context: The user message is captured by the n8n trigger and passed to the central AI Agent.

  2. Agent Processing: The AI Agent n8n node receives the input. It is configured to use the GPT Large Language Model (specifically defined as 'gpt-5-nano' in this n8n workflow) and utilizes the IA Memory n8n node to maintain a rolling history of the conversation (up to 10 context windows).

  3. Tool Use: The Agent is provided with a Search tool (an n8n HttpRequestTool configured for Bing search). The Agent determines if the user's query requires external, up-to-date information. If so, it executes the search; otherwise, it answers directly.

  4. Response Generation: The Agent generates the final, contextually appropriate response.

  5. Final Action: The workflow concludes with the Respond to Chat n8n node, which sends the AI-generated message back to the user interface, completing the loop and storing the final exchange in memory for future reference.

Installation Guide

To install this robust n8n workflow, follow these steps:


  1. Import: Copy the provided JSON code and paste it into your n8n instance via the 'Import from JSON' option in the workflow editor.

  2. OpenAI Credentials: Locate the GPT n8n node. You must set up or select an existing OpenAI API credential to enable the language model communication. Ensure you have access to the specified model (or replace it with a standard GPT model if needed).

  3. Search Tool Setup: Review the Search n8n node. This node is an HTTP Request configured to search the web (e.g., using Bing). You may need to replace the placeholder or integrate a specific API key if you require authenticated search functionality.

  4. Activate Trigger: Locate the When chat message received n8n trigger. After saving the n8n workflow, activate the workflow. The node will generate a webhook URL that you can embed into your webpage to deploy the chatbot interface.

  5. Testing: Send a test message to the newly deployed chatbot interface to ensure the AI Agent n8n node, memory, and search tool are working correctly within the n8n environment.

Node Details

This advanced n8n workflow relies on several specialized n8n node components:

When chat message received (n8n trigger): This is the starting point, initiating the flow on user input. It also manages the frontend appearance using extensive custom CSS, providing a clean, modern chat interface for this specific n8n template. It utilizes Simple Memory to retain session data.
AI Agent (n8n node): The core intelligence. It coordinates the use of the Language Model, IA Memory, and the Search tool to formulate complex answers based on the prompt and available resources.
GPT (Langchain ChatOpenAi n8n node): Configured with the highly efficient 'gpt-5-nano' model (or equivalent) and a temperature of 0.7 for creative yet focused responses. Requires valid OpenAI credentials.
IA Memory (Memory Buffer Window n8n node): Essential for maintaining conversational history within the Agent's decision loop, ensuring the chatbot remembers previous turns, making the n8n workflow highly conversational.
Search (HTTP Request Tool n8n node): Acts as the external knowledge base. It is configured to perform web searches (described as Bing search in the parameters), allowing the AI Agent to access information beyond its training cut-off date.
Respond to Chat (n8n node): The final output node, which takes the result from the AI Agent and displays it directly back to the user in the chat widget interface.

Related n8n Workflows

Free

Nodes: 7 Nodes
Updated: December 26 2025
View all
Created by
Oriol Seguí
Oriol Seguí

Completion of a higher degree on the way to university (computer engineering)

Featured*