A complex n8n workflow template that replicates advanced AI research agents (like Perplexity), using Google Gemini, native Google Search, and Redis for state management to conduct iterative, cited web research.
Download this n8n workflow template and start using it instantly.
Markdown-formatted:
AI Developers and Automation Engineers seeking advanced n8n workflow examples.
Users needing robust research reports generated automatically with traceable citations.
Organizations that require complex looping and state management within their n8n templates.
Technical professionals looking to build deep Retrieval-Augmented Generation (RAG) pipelines using an n8n node ecosystem.
This advanced n8n workflow provides a robust solution for deep, verifiable research. Unlike simple single-query searches, this n8n template employs a recursive research methodology inspired by modern AI agents. It starts with a user question, generates initial search queries, conducts web research (leveraging the native Google Search tool within the Gemini API via an n8n node), and then performs an AI 'reflection' step. The reflection identifies knowledge gaps. If gaps exist, it generates new follow-up queries, repeating the process up to a defined maximum loop count (maxresearchloops). Crucially, it uses Redis to manage conversation state, store research history, and maintain source citations throughout the complex n8n workflow, ensuring the final output is comprehensive and fully sourced. This powerful n8n solution turns a simple user input (the n8n trigger) into a comprehensive research report.
Markdown-formatted:
googlesearch tool) executes a web search.historywebresearchresult, historysourcesgathered, etc.) to maintain a running history across the entire n8n workflow.issufficient: true).followupqueries are injected, and the n8n workflow loops back to step Markdown-formatted:
Google Gemini Chat Model nodes require one credential (used for initial query generation and final answer synthesis).GeminiSearch and reflection HTTP Request n8n nodes require another credential (ensure these are correctly linked as they are used for tooling and structured output).Redis n8n nodes (historywebresearchresult, researchloop_count, etc.).Markdown-formatted:
When chat message received (n8n trigger): The starting point of the n8n workflow. It accepts a user prompt/question to begin the research process.
Configs (Set n8n node): Centralized configuration point. Key settings include numberofinitialqueries: 3 and maxresearchloops: 3.
generatequery (Langchain LLM n8n node): Uses Gemini 2.0 Flash combined with a 'Structured Output Parser' n8n node to reliably generate a list of search terms in a predictable JSON format.
GeminiSearch (HTTP Request n8n node): Crucial step where the Google Search tool is invoked. The JSON body explicitly includes "tools": [{"googlesearch": {}}], enabling the AI to retrieve real-time search results.
websearch (Code n8n node): Contains complex JavaScript logic to parse the Gemini API's grounding metadata. It handles URL resolution, citation extraction, and inserts citation markers into the text summary.
Redis n8n nodes (e.g., historywebresearchresult, researchloopcount): Used extensively throughout the n8n workflow to maintain state, particularly the research loop count and the aggregated summaries and source lists using the list push/get operations.
reflection (HTTP Request n8n node): Calls the powerful Gemini 2.5 Flash model with a precise JSON output schema defined in the request body to analyze current summaries and decide if more research is required, generating new queries if necessary.
finalizeanswer (Langchain LLM n8n node): Synthesizes all gathered information from the Redis history into a coherent final answer, ensuring all citations remain intact.
Use this powerful n8n workflow to schedule the daily delivery of random cocktail recipes, including images and instructions, directly to a Telegram chat using an n8n node. A great example of n8n templates.

Integrate urlscan.io security analysis into your AI agents using this specialized n8n workflow. Expose three key operations (Perform, Get Single, Get Multiple Scans) as a comprehensive n8n tool.

Automate bulk email searches using this powerful n8n workflow. Extract contact data from Google Sheets, handle API authentication via a custom n8n node, and submit requests to Icypeas efficiently.

Deploy a powerful personal AI Agent using this n8n workflow template. Automate Gmail categorization, auto-reply to leads, and manage Google Calendar and contacts via natural language commands through Telegram.

Deploy a powerful n8n workflow for a personalized AI assistant (using Google Gemini) accessible via Telegram. This multi-agent system manages tasks, email, calendar, projects, and research.








































