Host your own AI deep research agent with n8n, Apify and OpenAI o3
This template attempts to replicate OpenAI's DeepResearch feature which, at time of writing, is only available to their pro subscribers.
> An agent that uses reasoning to synthesize large amount of online information and complete multi-step research tasks for you. Source
Though the inner workings of DeepResearch have not been made public, it is presumed the feature relies on the ability to deep search the web, scrape web content and invoking reasoning models to generate reports. All of which n8n is really good at!
Using this workflow, n8n users can enjoy a variation of the Deep Research experience for themselves and their teams at a fraction of the cost. Better yet, learn and customise this Deep Research template for their businesses and/or organisations.
Check out the generated reports here: https://jimleuk.notion.site/19486dd60c0c80da9cb7eb1468ea9afd?v=19486dd60c0c805c8e0c000ce8c87acf
How it works
- A form is used to first capture the user's research query and how deep they'd like the researcher to go.
- Once submitted, a blank Notion page is created which will later hold the final report and the researcher gets to work.
- The user's query goes through a recursive series of web serches and web scraping to collect data on the research topic to generate partial learnings.
- Once complete, all learnings are combined and given to a reasoning LLM to generate the final report.
- The report is then written to the placeholder Notion page created earlier.
How to use
- Duplicate this Notion database template and make sure all Notion related nodes point to it.
- Sign-up for APIFY.com API Key for web search and scraping services.
- Ensure you have access to OpenAI's o3-mini model. Alternatively, switch this out for o1 series.
- You must publish this workflow and ensure the form url is publically accessible.
On depth & breadth configuration
For more detailed reports, increase depth and breadth but be warned the workflow will take exponentially longer and cost more to complete. The recommended defaults are usually good enough.
Depth=1 & Breadth=2 - will take about 5 - 10mins. Depth=1 & Breadth=3 - will take about 15 - 20mins. Dpeth=3 & Breadth=5 - will take about 2+ hours!
Customising this workflow
- I deliberately chose not to use AI-powered scrapers like Firecrawl as I felt these were quite costly and quotas would be quickly exhausted. However, feel free to switch web search and scraping services which suit your environment.
- Maybe you don't decide to source the web and instead, data collection comes from internal documents instead. This template gives you freedom to change this.
- Experiment with different Reasoning/Thinking models such as Deepseek and Google's Gemini 2.0.
- Finally, the LLM prompts could definitely be improved. Refine them to fit your use-case.
Credits
- This template is largely based off the work by David Zhang (dzhng) and his open source implementation of Deep Research: https://github.com/dzhng/deep-research
n8n AI Deep Research Agent Workflow
This n8n workflow enables you to host your own AI deep research agent, leveraging n8n's capabilities to orchestrate AI models and other services. It's designed to process research requests, generate detailed output, and manage the flow of information.
What it does
This workflow automates the following steps:
- Receives Research Requests: It starts by listening for incoming research requests, likely via an n8n form submission or another workflow execution.
- Initial Data Processing: It processes the incoming data, potentially setting or modifying fields to prepare for the AI research phase.
- Conditional AI Model Selection: It intelligently decides which AI model to use (e.g., OpenAI Chat Model or Google Gemini Chat Model) based on predefined conditions in the input data.
- Executes AI Research Chain: It utilizes a "Basic LLM Chain" to perform the core AI research, interacting with the selected AI chat model.
- Parses AI Output: The output from the AI model is then processed by a "Structured Output Parser" to extract and format the relevant information.
- Handles Successful Research: If the AI research is successful, the output is formatted into Markdown and can be stored or further processed (e.g., saved to Notion).
- Handles Research Failures: If the AI research encounters an error, the workflow captures the error and stops, providing clear indication of failure.
- Aggregates and Splits Data: It includes nodes for aggregating and splitting data, suggesting that it can handle multiple research items or complex data structures, processing them in batches if necessary.
- Sub-workflow Execution: The presence of "Execute Sub-workflow" and "Execute Workflow Trigger" nodes indicates that this workflow can be part of a larger, modular system, allowing for specialized sub-tasks to be delegated to other workflows.
Prerequisites/Requirements
To use this workflow, you will need:
- n8n Instance: A running instance of n8n.
- OpenAI API Key: For using the OpenAI Chat Model.
- Google Gemini API Key: For using the Google Gemini Chat Model.
- Notion Account (Optional): If you intend to save the research output to Notion, you'll need a Notion API integration and database set up.
- Credentials: Appropriate credentials configured in n8n for OpenAI, Google Gemini, and Notion (if used).
Setup/Usage
- Import the Workflow: Download the provided JSON and import it into your n8n instance.
- Configure Credentials:
- Set up your OpenAI API Key credentials.
- Set up your Google Gemini API Key credentials.
- (Optional) Set up your Notion API credentials if you plan to use the Notion node.
- Configure Nodes:
- "On form submission" (Trigger): Customize the form fields to match the input you expect for your research requests.
- "Edit Fields" (Set): Adjust any initial data manipulation as needed.
- "Switch": Review and modify the conditions that determine which AI model (OpenAI or Google Gemini) will be used based on your input data.
- "Basic LLM Chain": Configure the chain's prompts and parameters according to your research needs.
- "OpenAI Chat Model" / "Google Gemini Chat Model": Select the specific model versions and any other relevant settings.
- "Structured Output Parser": Define the schema for the expected output from your AI model to ensure correct parsing.
- "Markdown": Customize the Markdown formatting for the final output.
- "Notion" (Optional): Configure the Notion database ID and properties where the research results should be stored.
- "Stop and Error": Review the error handling logic, especially if you want custom error notifications.
- Activate the Workflow: Once configured, activate the workflow to start processing research requests.
- Trigger the Workflow: Submit data to the "On form submission" trigger, or execute the workflow manually with test data to verify its functionality.
Related Templates
Send WooCommerce cross-sell offers to customers via WhatsApp using Rapiwa API
Who Is This For? This n8n workflow enables automated cross-selling by identifying each WooCommerce customer's most frequently purchased product, finding a related product to recommend, and sending a personalized WhatsApp message using the Rapiwa API. It also verifies whether the user's number is WhatsApp-enabled before sending, and logs both successful and unsuccessful attempts to Google Sheets for tracking. What This Workflow Does Retrieves all paying customers from your WooCommerce store Identifies each customer's most purchased product Finds the latest product in the same category as their most purchased item Cleans and verifies customer phone numbers for WhatsApp compatibility Sends personalized WhatsApp messages with product recommendations Logs all activities to Google Sheets for tracking and analysis Handles both verified and unverified numbers appropriately Key Features Customer Segmentation: Automatically identifies paying customers from your WooCommerce store Product Analysis: Determines each customer's most purchased product Smart Recommendations: Finds the latest products in the same category as customer favorites WhatsApp Integration: Uses Rapiwa API for message delivery Phone Number Validation: Verifies WhatsApp numbers before sending messages Dual Logging System: Tracks both successful and failed message attempts in Google Sheets Rate Limiting: Uses batching and wait nodes to prevent API overload Personalized Messaging: Includes customer name and product details in messages Requirements WooCommerce store with API access Rapiwa account with API access for WhatsApp verification and messaging Google account with Sheets access Customer phone numbers in WooCommerce (stored in billing.phone field) How to Use β Step-by-Step Setup Credentials Setup WooCommerce API: Configure WooCommerce API credentials in n8n (e.g., "WooCommerce (get customer)" and "WooCommerce (get customer data)") Rapiwa Bearer Auth: Create an HTTP Bearer credential with your Rapiwa API token Google Sheets OAuth2: Set up OAuth2 credentials for Google Sheets access Configure Google Sheets Ensure your sheet has the required columns as specified in the Google Sheet Column Structure section Verify Code Nodes Code (get paying_customer): Filters customers to include only those who have made purchases Get most buy product id & Clear Number: Identifies the most purchased product and cleans phone numbers Configure HTTP Request Nodes Get customer data: Verify the WooCommerce API endpoint for retrieving customer orders Get specific product data: Verify the WooCommerce API endpoint for product details Get specific product recommend latest product: Verify the WooCommerce API endpoint for finding latest products by category Check valid WhatsApp number Using Rapiwa: Verify the Rapiwa endpoint for WhatsApp number validation Rapiwa Sender: Verify the Rapiwa endpoint for sending messages Google Sheet Required Columns Youβll need two Google Sheets (or two tabs in one spreadsheet): A Google Sheet formatted like this β€ sample The workflow uses a Google Sheet with the following columns to track coupon distribution: Both must have the following headers (match exactly): | name | number | email | address1 | price | suk | title | product link | validity | staus | | ---------- | ------------- | ----------------------------------------------- | ----------- | ----- | --- | ---------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------- | -------- | | Abdul Mannan | 8801322827799 | contact@spagreen.net | mirpur dohs | 850 | | Sharp Most Demanding Hoodie x Nike | https://yourshopdomain/p-img-nike | verified | sent | | Abdul Mannan | 8801322827799 | contact@spagreen.net | mirpur dohs | 850 | | Sharp Most Demanding Hoodie x Nike | https://yourshopdomain/p-img-nike | unverified | not sent | | Abdul Mannan | 8801322827799 | contact@spagreen.net | mirpur dohs | 850 | | Sharp Most Demanding Hoodie x Nike | https://yourshopdomain/p-img-nike | verified | sent | Important Notes Phone Number Format: The workflow cleans phone numbers by removing all non-digit characters. Ensure your WooCommerce phone numbers are in a compatible format. API Rate Limits: Rapiwa and WooCommerce APIs have rate limits. Adjust batch sizes and wait times accordingly. Data Privacy: Ensure compliance with data protection regulations when sending marketing messages. Error Handling: The workflow logs unverified numbers but doesn't have extensive error handling. Consider adding error notifications for failed API calls. Product Availability: The workflow recommends the latest product in a category, but doesn't check if it's in stock. Consider adding stock status verification. Testing: Always test with a small batch before running the workflow on your entire customer list. Useful Links Dashboard: https://app.rapiwa.com Official Website: https://rapiwa.com Documentation: https://docs.rapiwa.com Support & Help WhatsApp: Chat on WhatsApp Discord: SpaGreen Community Facebook Group: SpaGreen Support Website: https://spagreen.net Developer Portfolio: Codecanyon SpaGreen
Track SDK documentation drift with GitHub, Notion, Google Sheets, and Slack
π Description Automatically track SDK releases from GitHub, compare documentation freshness in Notion, and send Slack alerts when docs lag behind. This workflow ensures documentation stays in sync with releases, improves visibility, and reduces version drift across teams. πππ¬ What This Template Does Step 1: Listens to GitHub repository events to detect new SDK releases. π§© Step 2: Fetches release metadata including version, tag, and publish date. π¦ Step 3: Logs release data into Google Sheets for record-keeping and analysis. π Step 4: Retrieves FAQ or documentation data from Notion. π Step 5: Merges GitHub and Notion data to calculate documentation drift. π Step 6: Flags SDKs whose documentation is over 30 days out of date. β οΈ Step 7: Sends detailed Slack alerts to notify responsible teams. π Key Benefits β Keeps SDK documentation aligned with product releases β Prevents outdated information from reaching users β Provides centralized release tracking in Google Sheets β Sends real-time Slack alerts for overdue updates β Strengthens DevRel and developer experience operations Features GitHub release trigger for real-time monitoring Google Sheets logging for tracking and auditing Notion database integration for documentation comparison Automated drift calculation (days since last update) Slack notifications for overdue documentation Requirements GitHub OAuth2 credentials Notion API credentials Google Sheets OAuth2 credentials Slack Bot token with chat:write permissions Target Audience Developer Relations (DevRel) and SDK engineering teams Product documentation and technical writing teams Project managers tracking SDK and doc release parity Step-by-Step Setup Instructions Connect your GitHub account and select your SDK repository. Replace YOURGOOGLESHEETID and YOURSHEET_GID with your tracking spreadsheet. Add your Notion FAQ database ID. Configure your Slack channel ID for alerts. Run once manually to validate setup, then enable automation.
Automate Gmail responses with GPT and human-in-the-loop verification
Try It Out! This n8n template uses AI to automatically respond to your Gmail inbox by drafting response for your approval via email. How it works Gmail Trigger monitors your inbox for new emails AI Analysis determines if a response is needed based on your criteria Draft Generation creates contextually appropriate replies using your business information Human Approval sends you the draft for review before sending Auto-Send replies automatically once approved Setup Connect your Gmail account to the Gmail Trigger node Update the "Your Information" node with: Entity name and description Approval email address Resource guide (FAQs, policies, key info) Response guidelines (tone, style, formatting preferences) Configure your LLM provider (OpenAI, Claude, Gemini, etc.) with API credentials Test with a sample email Requirements n8n instance (self-hosted or cloud) Gmail account with API access LLM provider API key Need Help? Email Nick @ nick@tropicflare.com