Gemini AI Agent Chatbot with Real-Time Tool Use - n8n Workflow

Learn how to build and deploy your first AI Agent chatbot using the n8n workflow platform, powered by Google Gemini, conversation memory, and real-time data tools.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

Automation Beginners: Users looking for introductory n8n templates to understand complex AI Agent architecture.
Developers: Those who need to expose APIs and real-time data sources (like weather or news) through a conversational interface.
Technical Writers & Content Creators: Individuals seeking a powerful n8n workflow to demonstrate AI reasoning and tool-use capabilities.
n8n Automation Specialists: Users aiming to create custom, conversational interfaces for existing business processes using a dynamic n8n node structure.

Overview

Building intelligent, responsive applications often requires combining the reasoning power of an LLM with external data sources. This specific n8n workflow provides a complete, ready-to-use framework for an AI Agent powered by Google Gemini.

The core value of this n8n template lies in its ability to allow the AI to choose the correct tool based on the user's conversational query. If the user asks for the weather, the agent autonomously calls the Weather API tool; if they ask for news, it uses the RSS Feed tool. This eliminates manual logic switching and showcases the power of integrated AI within the n8n platform. This approach creates a highly flexible n8n node sequence that can be easily extended with custom tools like Gmail or Calendar, making the agent instantly useful for a wide range of tasks.

How it Works

This automation operates as a continuous conversational loop initiated by an n8n trigger.


  1. Trigger (Example Chat): The process starts when a user sends a message through the public chat interface, which serves as the primary n8n trigger for the entire operation. This action passes the user's message to the agent.

  2. Core Agent Logic (Your First AI Agent): This central n8n node receives the input. It is connected to three key components: the Language Model, the Memory, and the Tools.

  3. Language Model (Connect your model): The agent uses the Google Gemini connection to interpret the user's intent, reason, and decide whether a tool is required.

  4. Memory (Conversation Memory): Before deciding, the agent references the conversation memory (set to 30 messages) to maintain context and continuity, ensuring the reply is relevant to previous dialogue.

  5. Tool Selection & Execution: If the agent determines a query requires external information (e.g., weather or news), it calls the appropriate integrated n8n node tool (Get Weather or Get News). The tool executes, fetching real-time data.

  6. Response Generation: The agent receives the data output from the tool, formats it into a conversational, helpful response based on its System Message parameters, and sends the final answer back to the user via the initial n8n trigger (Example Chat).

Installation Guide

To deploy this comprehensive n8n workflow and run your AI Agent, follow these steps:


  1. Import the n8n Workflow: Copy the provided JSON code and import it directly into your n8n instance using the 'New' menu -> 'Import from JSON'.

  2. Configure Gemini Credentials (Crucial Step): Locate the 'Connect your model' n8n node (Google Gemini).

Click on 'Credential' and select 'Create New'.
Obtain a free API key from Google AI Studio (aistudio.google.com/app/apikey).
* Paste the key into the API Key field and save the credentials.

  1. Review System Message: The 'Your First AI Agent' n8n node contains a detailed System Message. Review this message to understand and customize the agent's personality, goals, and behavior.

  2. Activate the n8n Trigger: Click the 'Activate' toggle on the top right of the n8n canvas. This enables the 'Example Chat' n8n trigger. You can then click the 'Open chat' button on the trigger node to interact with your new agent instantly.

Node Details

This advanced n8n workflow utilizes specific n8n node types to achieve complex AI functionality:

Example Chat (Chat Trigger Node):
Function: Serves as the conversational entry point and the primary public n8n trigger. It creates the user interface for interaction.
Key Configuration: Set to public: true and configured for responseMode: lastNode to ensure the agent's final output is displayed.

Your First AI Agent (Agent Node):
Function: The central orchestrator of the entire n8n workflow. It handles decision-making, tool routing, and response formatting based on the LLM's reasoning.
Key Configuration: Contains a detailed, multi-section System Message defining the agent’s role, instructions, goals, and best practices regarding AI Agent reliability in n8n.

Connect your model (Google Gemini Node):
Function: Provides the Large Language Model necessary for the Agent node to reason and generate text. This is the intelligence behind the n8n workflow.
Key Configuration: Uses a low temperature (0) for more deterministic and predictable responses.

Conversation Memory (Memory Buffer Window Node):
Function: Gives the agent short-term memory of the conversation history, allowing it to understand contextual references.
Key Configuration: Context Window Length is set to 30, meaning it remembers the last 30 messages.

Get Weather (HTTP Request Tool Node):
Function: An n8n node configured as an AI tool. It calls the Open-Meteo API. The agent automatically infers necessary parameters (like Latitude and Longitude) from the user's city name via AI logic ($fromAI expressions).

Get News (RSS Feed Read Tool Node):
Function: An n8n node configured as an AI tool that fetches real-time headlines and posts from specified RSS URLs (e.g., TechCrunch or n8n Blog), feeding fresh data directly into the agent’s response loop.

Related n8n Workflows

Free

Nodes: 7 Nodes
Updated: December 26 2025
View all
Created by

Innovative builder with a passion for crafting automation solutions that solve real-world challenges. From streamlining workflows to driving efficiency, my work empowers teams and individuals to achieve more with less effort. Experienced in developing scalable tools and strategies that deliver results with n8n, supabase and cline.

Featured*