Deep Research Report Generator Using AI Agents and Structured Data - n8n Workflow

Automate deep content generation using an n8n workflow. This n8n template coordinates AI agents (via OpenRouter), Tavily search for RAG, and Google Sheets for structured data management.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?


  • Content marketing professionals needing scalable article generation.

  • SEO teams aiming to automate deep research and report drafting.

  • Users leveraging advanced Langchain AI agents within an n8n workflow.

  • Anyone looking for robust n8n templates integrating external search tools like Tavily and structured data storage.

Overview

This sophisticated n8n workflow transforms a single research query into a fully structured, well-researched, and drafted markdown report. Traditional content creation is often slow and prone to errors, requiring manual topic planning, source identification, and drafting. This automation streamlines the entire process by employing specialized AI agents for each phase: topic planning, structure drafting, source identification, and sectional writing.

The workflow uses the OpenRouter service for intelligence (compatible with OpenAI) and relies heavily on Google Sheets as a persistent database to track progress and store intermediate and final content segments. By incorporating the Tavily search tool via an n8n node, the dedicated AI Writer performs Retrieval-Augmented Generation (RAG), ensuring the output is based on current, verifiable information, making this one of the most effective n8n templates for generating high-quality research documents.

How it Works

The process begins with the On form submission n8n trigger, which receives the initial research query.


  1. Topic Generation: The input is passed to the Plan Topics n8n node (an AI Agent). This agent, powered by the OpenRouter Chat Model, generates a structured list of five potential article topics, ensuring relevance and scope.

  2. Structure & Introduction: The generated topics are prepared for parallel processing. The Intro agent then creates a detailed title, introduction, and preliminary chapter outline. This output is immediately stored in Google Sheets via the Send Intro n8n node for persistence.

  3. Source Management: The n8n workflow initiates two key tasks concurrently: generating a Table of Contents (Table of Contents Agent) and identifying necessary external research sources (Sources Agent). These sources are saved (Send Sources) and subsequently retrieved (Get Sources) from Google Sheets before the main writing phase.

  4. Iterative Writing Loop: The core content generation occurs within a loop managed by the Loop Over Items n8n node, which iterates over each required section. Inside this loop, the workflow executes a targeted external web search via the Tavily5 HTTP Request n8n node.

  5. Content Drafting: The aggregated search results are merged with the current section prompt and fed into the Writer5 AI Agent. This agent generates the rich, researched content for that specific section using the OpenRouter Chat Model8.

  6. Aggregation: Finally, Aggregate and Merge nodes systematically collect all the individually written sections and structure them along with the introduction and TOC, compiling the final, complete research report structure. This entire n8n workflow is designed for efficiency and structure.

Installation Guide


  1. Import the n8n workflow: Copy the provided JSON data and paste it into your n8n instance's workflow editor.

  2. AI Credentials Setup: Configure credentials for the Language Models. This n8n workflow uses OpenRouter. You must set up the connection details for the OpenRouter Chat Model n8n node instances.

  3. Google Sheets Configuration: This n8n template requires a Google Sheet to manage topics, sources, and output structure. You must set up Google Sheets credentials and configure all five Google Sheets n8n node instances (Send Intro, Get Sources, Send Sources, Get All Content, Send ToC) to point to the correct Spreadsheet ID and relevant sheet tabs.

  4. Tavily Setup (RAG): Configure the Tavily5 HTTP Request n8n node with your Tavily API key and ensure the request structure correctly pulls search results.

  5. Trigger Setup: The On form submission n8n trigger must be configured to expose a webhook URL. Use this URL in your external application (e.g., a web form or another n8n workflow) to start the research process.

  6. Activate: Save and activate the n8n workflow to enable autonomous execution.

Node Details

On form submission (n8n trigger): The entry point of the n8n workflow. It captures the initial research request data needed to kick off the content pipeline.
Plan Topics (Langchain Agent n8n node): A high-level AI agent responsible for initial content strategy, breaking down the broad request into targeted topics. It relies on a structured output parser (5 Topics).
OpenRouter Chat Model / OpenRouter Chat Model1 / etc. (Langchain Model n8n node): These instances provide the computational intelligence for all the AI agents, handling complex instruction sets, reasoning, and text generation throughout the n8n workflow.
Google Sheets (n8n node instances): Critical for data persistence. Nodes like Send Intro and Get Sources ensure that structured data—titles, introductions, research requirements—are saved and retrieved reliably between sequential and looping parts of the n8n workflow.
Tavily5 (HTTP Request n8n node): Handles the Retrieval-Augmented Generation (RAG) aspect by executing real-time web searches using the Tavily API, ensuring the subsequent writing agent has access to fresh, factual data.
Code5 / Get Sections (Code n8n node): These custom code nodes are used to manipulate and restructure the complex JSON objects resulting from AI processing and web search, preparing the data correctly for the next n8n node.
Writer5 (Langchain Agent n8n node): The dedicated content generation agent. It consumes the search data and outline to produce the detailed, written markdown for a specific section.
Loop Over Items (Split In Batches n8n node): Manages the iteration process, allowing the n8n workflow to execute the research and writing steps for every chapter or section defined in the structure.

Related n8n Workflows

Paid

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

Featured*