I am trying to replicate a workflow on N8N that I have working fine on a chatbot platform. Relatively new with n8n so please be kind
In short, I am trying to create a system that gathers information from users in a conversational manner, verifies that all information has been collected and then outputs a structured output. Think first name, last name, email and zip.
I’ve been able to instruct the agent AI to ask the user and collect the information, but I am stuck at what happens after this point. I would want to check if all fields have been completed. If so, output the json. If not, loop back to the agent and collect the missing information.
What does this workflow look like after the agent node?
Ensure to copy your n8n workflow and paste it in the code block, that is in between the pairs of triple backticks, which also could be achieved by clicking </> (preformatted text) in the editor and pasting in your workflow.
```
<your workflow>
```
That implies to any JSON output you would like to share with us.
Make sure that you have removed any sensitive information from your workflow and include dummy or pinned data with it!
So, where/how do you store the information? Can’t you just query your storage to devise if any data is yet missing?
The AI Agent is instructed to collect the information from the user (ie. first name, last name, email and zip) and to output a simple json structure when done. In addition to the 4 required key value pairs, it also includes a key called “status” and a value of “completed”.
The IF statement checks if the json contains the value “completed”. If so, if runs the output to an LLM chain and generates structured data in the exact json format I want. If not, I route it to another LLM chain which repeats the last output from the AI Agent - and loops it back for completion.
This works but if I can make this better or more efficient, I’d love to hear it.
Hey @flyover137 , your solution sounds fine to me. Though I was having in mind checking all the outputs produced by Memory manager for the session in question and checking if there is any missing data the user did not provide yet. This approach would not require an additional “status” field.