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.
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.
| Node | Category | Type | Operation |
|---|---|---|---|
| Structured Output Parser | Transform | Output Parser Structured | See node parameters |
| Set Variables | Transform | Edit Fields | See node parameters |
| OpenAI Chat Model | AI & models | OpenAI Chat Model | See node parameters |
| OpenAI Chat Model1 | AI & models | OpenAI Chat Model | See node parameters |
| OpenAI Chat Model2 | AI & models | OpenAI Chat Model | See node parameters |
| Structured Output Parser1 | Transform | Output Parser Structured | See node parameters |
| On form submission | Trigger | Form Trigger | See node parameters |
| Generate SERP Queries | AI & models | Chain LLM | See node parameters |
| Structured Output Parser2 | Transform | Output Parser Structured | See node parameters |
| OpenAI Chat Model3 | AI & models | OpenAI Chat Model | See node parameters |
| Set Initial Query | Transform | Edit Fields | See node parameters |
| SERP to Items | Transform | Split Out | See node parameters |
| Item Ref | Routing | No Op | See node parameters |
| Research Goal + Learnings | Transform | Edit Fields | See node parameters |
| Accumulate Results | Transform | Edit Fields | See node parameters |
| DeepResearch Results | Transform | Edit Fields | See node parameters |
| Results to Items | Transform | Split Out | See node parameters |
| Set Next Queries | Transform | Edit Fields | See node parameters |
| For Each Query... | Routing | Loop Over Items | See node parameters |
| Feedback to Items | Transform | Split Out | See node parameters |
| Ask Clarity Questions | Integration | Form | See node parameters |
| For Each Question... | Routing | Loop Over Items | See node parameters |
| DeepResearch Subworkflow | Trigger | Execute Workflow Trigger | See node parameters |
| Clarifying Questions | AI & models | Chain LLM | See node parameters |
| End Form | Integration | Form | completion |
| Initiate DeepResearch | Subworkflow | Execute Workflow | See node parameters |
| Execution Data | Integration | Execution Data | See node parameters |
| JobType Router | Routing | Switch | See node parameters |
| OpenAI Chat Model4 | AI & models | OpenAI Chat Model | See node parameters |
| Get Initial Query | Transform | Edit Fields | See node parameters |
| Structured Output Parser4 | Transform | Output Parser Structured | See node parameters |
| Create Row | Integration | Notion | databasePage |
| Report Page Generator | AI & models | Chain LLM | See node parameters |
| Is Depth Reached? | Routing | If | See node parameters |
| Get Research Results | Transform | Edit Fields | See node parameters |
| Get Existing Row | Integration | Notion | databasePage / getAll |
| Set In-Progress | Integration | Notion | databasePage / update |
| Set Done | Integration | Notion | databasePage / update |
| Tags to Items | Transform | Split Out | See node parameters |
| Convert to HTML | Transform | Markdown | See node parameters |
| HTML to Array | Transform | Edit Fields | See node parameters |
| Notion Block Generator | AI & models | Chain LLM | See node parameters |
| Google Gemini Chat Model | AI & models | LM Chat Google Gemini | See node parameters |
| Parse JSON blocks | Transform | Edit Fields | See node parameters |
| Upload to Notion Page | Web / API | HTTP Request | PATCH |
| Get Existing Row1 | Integration | Notion | databasePage / getAll |
| DeepResearch Report | AI & models | Chain LLM | See node parameters |
| DeepResearch Learnings | AI & models | Chain LLM | See node parameters |
| Generate Report | Subworkflow | Execute Workflow | See node parameters |
| Generate Learnings | Subworkflow | Execute Workflow | See node parameters |
| Confirmation | Integration | Form | See node parameters |
| Research Request | Integration | Form | See node parameters |
| Valid Blocks | Routing | Filter | See node parameters |
| Append Blocks | Transform | Merge | See node parameters |
| URL Sources to Lists | Code | Code | See node parameters |
| Empty Response | Transform | Edit Fields | See node parameters |
| Has Content? | Routing | If | See node parameters |
| Combine & Send back to Loop | Transform | Aggregate | See node parameters |
| For Each Block... | Routing | Loop Over Items | See node parameters |
| Valid Results | Routing | Filter | See node parameters |
| RAG Web Browser | Web / API | HTTP Request | POST |
| Get Markdown + URL | Transform | Edit Fields | See node parameters |
| Is Apify Auth Error? | Routing | If | See node parameters |
| Stop and Error | Routing | Stop And Error | See node parameters |
Setup
- Download the JSON and import it into an isolated n8n instance. Leave the workflow inactive.
- Connect your own credentials through n8n’s credential store. Replace
REPLACE_WITH_*values with your resource identifiers. - Inspect API destinations, Code nodes, database queries, file paths, and outbound actions.
- 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
googlePalmApihttpHeaderAuthhttpQueryAuthnotionApiopenAiApi
Workflow notes
2. Ask Clarifying Questions
2. Ask Clarifying Questions
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
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
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.
- Notion ⇄ Markdown Conversion Community Node
- tryfabric/martian: Markdown to Notion: Convert Markdown and GitHub Flavoured Markdown to Notion API Blocks and RichText 🔀📝
- brittonhayes/notionmd: 🪄 Convert Markdown into Notion Blocks
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!