← All N8N workflows
AI & researchAggregateChain LLMCodeExecute WorkflowExecute Workflow Trigger

conversational interviews with ai agents and n8n forms

Configured with Aggregate, Chain LLM, Execute Workflow, Execute Workflow Trigger, and additional nodes. Review the connections and setup before adapting this template.

Workflow preview
TransformStructured OutputParserOutput Parser StructuredTransformSet VariablesEdit FieldsAI & modelsOpenAI Chat ModelOpenAI Chat ModelAI & modelsOpenAI Chat Model1OpenAI Chat ModelAI & modelsOpenAI Chat Model2OpenAI Chat ModelTransformStructured OutputParser1Output Parser StructuredTriggerOn form submissionForm TriggerAI & modelsGenerate SERP QueriesChain LLMTransformStructured OutputParser2Output Parser StructuredAI & modelsOpenAI Chat Model3OpenAI Chat ModelTransformSet Initial QueryEdit FieldsTransformSERP to ItemsSplit OutRoutingItem RefNo OpTransformResearch Goal +LearningsEdit FieldsTransformAccumulate ResultsEdit FieldsTransformDeepResearch ResultsEdit FieldsTransformResults to ItemsSplit OutTransformSet Next QueriesEdit FieldsRoutingFor Each Query...Loop Over ItemsTransformFeedback to ItemsSplit OutIntegrationAsk Clarity QuestionsFormRoutingFor Each Question...Loop Over ItemsTriggerDeepResearchSubworkflowExecute Workflow TriggerAI & modelsClarifying QuestionsChain LLMIntegrationEnd FormFormSubworkflowInitiate DeepResearchExecute WorkflowIntegrationExecution DataExecution DataRoutingJobType RouterSwitchAI & modelsOpenAI Chat Model4OpenAI Chat ModelTransformGet Initial QueryEdit FieldsTransformStructured OutputParser4Output Parser StructuredIntegrationCreate RowNotionAI & modelsReport Page GeneratorChain LLMRoutingIs Depth Reached?IfTransformGet Research ResultsEdit FieldsIntegrationGet Existing RowNotionIntegrationSet In-ProgressNotionIntegrationSet DoneNotionTransformTags to ItemsSplit OutTransformConvert to HTMLMarkdownTransformHTML to ArrayEdit FieldsAI & modelsNotion Block GeneratorChain LLMAI & modelsGoogle Gemini ChatModelLM Chat Google GeminiTransformParse JSON blocksEdit FieldsWeb / APIUpload to Notion PageHTTP RequestIntegrationGet Existing Row1NotionAI & modelsDeepResearch ReportChain LLMAI & modelsDeepResearch LearningsChain LLMSubworkflowGenerate ReportExecute WorkflowSubworkflowGenerate LearningsExecute WorkflowIntegrationConfirmationFormIntegrationResearch RequestFormRoutingValid BlocksFilterTransformAppend BlocksMergeCodeURL Sources to ListsCodeTransformEmpty ResponseEdit FieldsRoutingHas Content?IfTransformCombine & Send back toLoopAggregateRoutingFor Each Block...Loop Over ItemsRoutingValid ResultsFilterWeb / APIRAG Web BrowserHTTP RequestTransformGet Markdown + URLEdit FieldsRoutingIs Apify Auth Error?IfRoutingStop and ErrorStop And Error

Node categories in this workflow

  • Transform
  • AI & models
  • Trigger
  • Routing
  • Integration
  • Subworkflow
  • Web / API
  • Code

Icons describe general node roles, inferred from node types. Inspect the parameters for the configured action.

Drag to pan; use + and − to zoom. Reconstructed from the exported node positions; nothing runs here. Dashed lines represent non-main connections. Full node names and notes appear below.

How it works

The exported workflow contains the following configured nodes. Their connections are shown above; inspect the JSON for the complete logic, expressions, and external actions.

Workflow node names, types, and operations
NodeCategoryTypeOperation
Structured Output ParserTransformOutput Parser StructuredSee node parameters
Set VariablesTransformEdit FieldsSee node parameters
OpenAI Chat ModelAI & modelsOpenAI Chat ModelSee node parameters
OpenAI Chat Model1AI & modelsOpenAI Chat ModelSee node parameters
OpenAI Chat Model2AI & modelsOpenAI Chat ModelSee node parameters
Structured Output Parser1TransformOutput Parser StructuredSee node parameters
On form submissionTriggerForm TriggerSee node parameters
Generate SERP QueriesAI & modelsChain LLMSee node parameters
Structured Output Parser2TransformOutput Parser StructuredSee node parameters
OpenAI Chat Model3AI & modelsOpenAI Chat ModelSee node parameters
Set Initial QueryTransformEdit FieldsSee node parameters
SERP to ItemsTransformSplit OutSee node parameters
Item RefRoutingNo OpSee node parameters
Research Goal + LearningsTransformEdit FieldsSee node parameters
Accumulate ResultsTransformEdit FieldsSee node parameters
DeepResearch ResultsTransformEdit FieldsSee node parameters
Results to ItemsTransformSplit OutSee node parameters
Set Next QueriesTransformEdit FieldsSee node parameters
For Each Query...RoutingLoop Over ItemsSee node parameters
Feedback to ItemsTransformSplit OutSee node parameters
Ask Clarity QuestionsIntegrationFormSee node parameters
For Each Question...RoutingLoop Over ItemsSee node parameters
DeepResearch SubworkflowTriggerExecute Workflow TriggerSee node parameters
Clarifying QuestionsAI & modelsChain LLMSee node parameters
End FormIntegrationFormcompletion
Initiate DeepResearchSubworkflowExecute WorkflowSee node parameters
Execution DataIntegrationExecution DataSee node parameters
JobType RouterRoutingSwitchSee node parameters
OpenAI Chat Model4AI & modelsOpenAI Chat ModelSee node parameters
Get Initial QueryTransformEdit FieldsSee node parameters
Structured Output Parser4TransformOutput Parser StructuredSee node parameters
Create RowIntegrationNotiondatabasePage
Report Page GeneratorAI & modelsChain LLMSee node parameters
Is Depth Reached?RoutingIfSee node parameters
Get Research ResultsTransformEdit FieldsSee node parameters
Get Existing RowIntegrationNotiondatabasePage / getAll
Set In-ProgressIntegrationNotiondatabasePage / update
Set DoneIntegrationNotiondatabasePage / update
Tags to ItemsTransformSplit OutSee node parameters
Convert to HTMLTransformMarkdownSee node parameters
HTML to ArrayTransformEdit FieldsSee node parameters
Notion Block GeneratorAI & modelsChain LLMSee node parameters
Google Gemini Chat ModelAI & modelsLM Chat Google GeminiSee node parameters
Parse JSON blocksTransformEdit FieldsSee node parameters
Upload to Notion PageWeb / APIHTTP RequestPATCH
Get Existing Row1IntegrationNotiondatabasePage / getAll
DeepResearch ReportAI & modelsChain LLMSee node parameters
DeepResearch LearningsAI & modelsChain LLMSee node parameters
Generate ReportSubworkflowExecute WorkflowSee node parameters
Generate LearningsSubworkflowExecute WorkflowSee node parameters
ConfirmationIntegrationFormSee node parameters
Research RequestIntegrationFormSee node parameters
Valid BlocksRoutingFilterSee node parameters
Append BlocksTransformMergeSee node parameters
URL Sources to ListsCodeCodeSee node parameters
Empty ResponseTransformEdit FieldsSee node parameters
Has Content?RoutingIfSee node parameters
Combine & Send back to LoopTransformAggregateSee node parameters
For Each Block...RoutingLoop Over ItemsSee node parameters
Valid ResultsRoutingFilterSee node parameters
RAG Web BrowserWeb / APIHTTP RequestPOST
Get Markdown + URLTransformEdit FieldsSee node parameters
Is Apify Auth Error?RoutingIfSee node parameters
Stop and ErrorRoutingStop And ErrorSee node parameters

Setup

  1. Download the JSON and import it into an isolated n8n instance. Leave the workflow inactive.
  2. Connect your own credentials through n8n’s credential store. Replace REPLACE_WITH_* values with your resource identifiers.
  3. Inspect API destinations, Code nodes, database queries, file paths, and outbound actions.
  4. Run with synthetic data and harmless destinations. Enable triggers only after checking the actual outputs.

Requirements

An n8n instance with the listed node types and compatible versions. Service-connected workflows may require accounts, credentials, or paid APIs.

Credential types declared in the source

  • googlePalmApi
  • httpHeaderAuth
  • httpQueryAuth
  • notionApi
  • openAiApi

Workflow notes

2. Ask Clarifying Questions

2. Ask Clarifying Questions

Read more about form nodes

To handle the clarification questions generated by the LLM, I used the same technique found in my "AI Interviewer" template (link). This involves a looping of dynamically generated forms to collect answers from the user.

6. Perform DeepSearch Loop

6. Perform DeepSearch Loop

Learn more about the Looping in n8n

The key of the Deep Research flow is its extensive data collection capability. In this implementation, this capability is represented by a recursive web search & scrape loop which starts with the original query and extended by AI-generated subqueries. How many subqueries to generate are determined the depth and breadth parameters specified.

"Learnings" are generated for each subquery and accumulate on each iteration of the loop. When the loop finishes when depth limit is reached, all learnings are collected and it's these learnings are what we use to generate the report.

3. Create Empty Report Page in Notion

3. Create Empty Report Page in Notion

Read more about the Notion node

Some thought was given where to upload the final report and Notion was selected due to familiarity. This can be easily changed to whatever wiki tools you prefer.

If you're following along however, here's the Notion database you need to replicate - Jim's n8n DeepResearcher Database.

4. Trigger DeepResearch Asynchronously

4. Trigger DeepResearch Asynchronously

Learn more about the Execute Trigger node

n8n handles asynchronous jobs by spinning them off as separate executions. This basically means the user doesn't have to wait or keep their browser window open for our researcher to do its job.

Once we initiate the Deepresearcher job, we can close out the onboarding journey for a nice user experience.

7. Generate Search Queries

7. Generate Search Queries

Learn more about the Basic LLM node

Much like a human researcher, the DeepResearcher will rely on web search and content as the preferred source of information. To ensure it can cover a wide range of sources, the AI can first generate relevant research queries of which each can be explored separately.

8. Web Search and Extracting Web Page Contents using [APIFY.com](https://www.apify.com?fpr=414q6)

8. Web Search and Extracting Web Page Contents using APIFY.com

Read more about the HTTP Request node

Here is where I deviated a little from the reference implementation. I opted not to use Firecrawl.ai due to (1) high cost of the service and (2) a regular non-ai crawler would work just as well and probably quicker. Instead I'm using APIFY.com which is a more performant, cost-effective and reliable web scraper service. If you don't want to use Apify, feel free to swap this out with your preferred service.

This step is the most exciting in terms of improvements and optimisations eg. mix in internal data sources! Add in Perplexity.ai or Jina.ai! Possibilities are endless.

5. Set Report to In-Progress

5. Set Report to In-Progress

Read more about the Notion node

9. Compile Learnings with Reasoning Model

9. Compile Learnings with Reasoning Model

Read more about the Basic LLM node

With our gathered sources, it's now just a case of giving it to our LLM to compile a list of "learnings" from them. For our DeepResearcher, we'll use OpenAI's o3-mini which is the latest reasoning model at time of writing. Reasoning perform better than regular chat models due their chain-of-thought or "thinking" process that they perform.

The "Learnings" are then combined with the generated research goal to complete one loop.

10. Generate DeepSearch Report using Learnings

10. Generate DeepSearch Report using Learnings

Read more about the Basic LLM node

Finally! After all learnings have been gathered - which may have taken up to an hour or more on the higher settings! - they are given to our LLM to generate the final research report in markdown format. Technically, the DeepResearch ends here but for this template, we need to push the output to Notion. If you're not using Notion, feel free to ignore the last few steps.

11. Reformat Report as Notion Blocks

11. Reformat Report as Notion Blocks

Learn more about the Markdown node

To write our report to our Notion page, we'll have to convert it to Notion "blocks" - these are specialised json objects which are required by the Notion API. There are quite a number of ways to do this conversion not involving the use of AI but for kicks, I decided to do so anyway. In this step, we first convert to HTML as it allows us to split the report semantically and makes for easier parsing for the LLM.

13. Update Report in Notion

13. Update Report in Notion

Read more about the HTTP request node

In this step, we can use the Notion API to add the blocks to our page sequentially. A loop is used due to the unstable Notion API - the loop allows retries for blocks that require it.

1. Let's Research!

1. Let's Research!

Learn more about the form trigger node

n8n forms are a really nice way to get our frontend up and running quickly and compared to chat, offers a superior user interface for user input. I've gone perhaps a little extra with the custom html fields but I do enjoy adding a little customisation now and then.

12. Append URL Sources List

12. Append URL Sources List

Read more about the Code node

For our source URLs, we'll manually compose the Notion blocks for them - this is because there's usually a lot of them! We'll then append to the end of the other blocks.

Not using forms?

Not using forms?

Feel free ot swap this out for chat or even webhooks to fit your existing workflows.

🚏 The Subworkflow Event Pattern

🚏 The Subworkflow Event Pattern

If you're new to n8n, this advanced technique might need some explaining but in gist, we're using subworkflows to run different parts of our DeepResearcher workflow as separate executions.

  • Necessary to implement the recursive loop mechanism needed to enable this workflow.
  • Negates the need to split this workflow into multiple templates.
  • Great generally for building high performance n8n workflows (a topic for a future post!)
Recursive Looping

Recursive Looping

The recursive looping implemented for this workflow is an advanced item-linking technique. It works by specifically controlling which nodes "execute once" vs" execute for each item" because of this becareful of ermoving nodes! Always check the settings of the node you're replacing and ensure the settings match.

n8n DeepResearcher

n8n DeepResearcher

This template attempts to replicate OpenAI's DeepResearch feature which, at time of writing, is only available to their pro subscribers.

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!

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 to use with this template: https://jimleuk.notion.site/19486dd60c0c80da9cb7eb1468ea9afd?v=19486dd60c0c805c8e0c000ce8c87acf
  • 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 a exponentially more time and money to complete. The 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!

Need Help?

Join the Discord or ask in the Forum!

Happy Hacking!

Sticky Note17

Self-hosting n8n? Consider using one of these to upload to Notion!

Self-hosting n8n? Consider using one of these to upload to Notion!

This template uses an LLM to convert markdown to Notion which isn't the most efficient but it's "easier" because doesn't require installing other software. To speed this up and reduce errors in the conversation, consider the following options to replace this flow if you're able to install them yourself.

Note: Recommendation onl, requires due diligence and use at your own risk!

conversational interviews with ai agents and n8n forms

conversational interviews with ai agents and n8n forms

Purpose and structure

This folder contains the conversational interviews with ai agents and n8n forms workflow. Its executable nodes use aggregate, chainLlm, code, executeWorkflow, executeWorkflowTrigger, executionData, filter, form, formTrigger, httpRequest, if, lmChatGoogleGemini, lmChatOpenAi, markdown, merge, noOp, notion, outputParserStructured, set, splitInBatches, splitOut, stopAndError, switch. The table and connection map below are derived from the JSON, not an inferred guarantee of behavior.

Setup

Import inactive. Configure your own credentials and replace REPLACE_WITH_* values. Review external destinations and Code nodes before running.

Entry points

On form submission, DeepResearch Subworkflow

Verification

Sanitized source candidate; not runtime-tested. This overview is generated from node metadata. Read the folder README for the connection map, credential types, and license.

Attribution

https://github.com/Zie619/n8n-workflows/blob/94007c1445d9258a7da116646b79473e7c7c3282/workflows/Stopanderror/0719_Stopanderror_Splitout_Create_Webhook.json MIT; preserve source notices.

Canvas section labels

These name areas of the original canvas; they do not include explanatory instructions.

  • UPDATE APIFY CREDENTIAL HERE!
  • UPDATE NOTION CREDENTIAL HERE!

More in AI & research