AI Chatbot-based co-pilot similar to Zapier Copilot for n8n workflow

The idea is:

N8n co-pilot to create, debug and suggest best practices to n8n workflows. Make use of the json file to review the workflow and having an engine to run the workflow in a simulated environment.

My use case:

  • Currently using chatgpt to debug my json file when truly stuck but the experience has been sub-par

I think it would be beneficial to add this because:

  • Compete directly with zapier
  • Allow users to be more productive by getting started quickly with projects and faster debugging
  • Allow beginners to be onboarded onto n8n and its many integrations.
  • Increase the number of workflows generated and published on the marketplace for others to utilise
  • Join the ongoing trend of gen ai

Have you used zapier’s text to node feature? How do you find it?

Max from n8n’s design team here. Good news, we are currently working on such a feature. +1 to @Yeo_Meng_Han 's question, would be very curious to hear your experience.

Could you also perhaps share some examples of the initial prompts you’re sending to ChatGPT for the various workflow problems you use it for? That would also really help us :pray:

CC @Niklas_Hatje

1 Like

hi Max! Glad to hear that n8n is building such a capability!

ChatGPT naive approach

I tried several approaches, the naive one being to ask ChatGPT 4 (I have the plus version) to impersonate an expert n8n developer and as it to debug:

You're a friendly and cheerful technical assistant in an office setting, widely recognised for your mastery in drafting automation workflows using n8n software. Your office-bound peers often rely on your expert advice when it comes to determining which node in n8n fits best their specific task requirements. Help me debug the following n8n json workflow: 
< insert json workflow > 

Thereafter I will dump the json into n8n, put in my various credentials and try to get it running. If anything fails to work, I will throw it back to ChatGPT and inform what worked and what didn’t work and try to rectify on each iteration but it rarely works well.

Coze AI approach

coze: https://www.coze.com/

I also used coze ai’s single agent with the following prompt + a csv file containing simplified node name, display name and a single sentence of what the node do (not saying much about properties of the node)

# Character
You're a friendly and cheerful technical assistant in an office setting, widely recognised for your mastery in drafting automation workflows using n8n software. Your office-bound peers often rely on your expert advice when it comes to determining which node in n8n fits best their specific task requirements.

## Skills
### Skill 1: Identifying the Necessary Node
- Through an in-depth consultation, understand the colleague's exact requirements.
- Based on their needs, determine which node in n8n would best fulfil their task.
- Offer a clear succinct explanation of why this is the best choice and how it works.

### Skill 2: Draft Automation Workflows
- Once the necessary node is identified, employ your expertise in n8n software to draft up an appropriate automation workflow.
- Make sure the workflow matches the colleague’s needs and accommodate any adjustments required.
- Output functional n8n json for the user to paste onto their n8n workflows.

### Skill 3: Debug Workflows
- Begin by isolating the issue within your n8n workflow
- Verify all external connections and credentials
- Inspect data format and types
- Utilise the error workflow feature
- Review logic and conditions within the workflow
- Examine rate limits and timeouts
- Update n8n and nodes to latest version
- Leverage community resources such as n8n community forum or documentation to troubleshoot
- Simplify the workflow - temporarily remove non-essential nodes to simplify debugging

## Constraints:
- Stick to only advising and generating automation workflows using n8n software.
- Ensure that the advice offered pertains solely to the task at hand and that the created workflows align solely to the requirements provided.
- Aim to deliver clear, precise guidance - every piece of advice should be actionable and helpful.

Findings on Coze AI + GPT 4 turbo

  • GPT has rather good knowledge of the configurations (albeit having hallucinations at times) of individual n8n nodes but struggle with putting these nodes together into a coherent json workflow (issues with node version, node’s configuration)
  • GPT is ok with generating pseudo-code information but the pseudo-code also tend to hallucinate and is insufficient to be used for further json workflow generation
  • Configuration and hierarchy is a huge issue - gpt does not have any inherent information about how a node would look like, it generally hallucinates on the json workflow being generated unless using a RAG approach

One-Node Generation with Coze AI

Experimented with the approach of pre-generating json workflows of different configurations of a single node (Chosen node: Google Sheet) and feeding the coze ai knowledge base (can search in bot store “n8n node generator”)

  • Made sure to label the workflow name as specific as I can be as a way for the agent to semantically retrieve the information
  • i.e. Google Sheet - Create a spreadsheet without any named sheets, Google Sheet - Create a spreadsheet with 1 named sheet, Google Sheet - Delete a sheet, Google Sheet - Append 1 column with information …
  • Model used: gpt-4-turbo with a 128K context window
  • Use case: Query and retrieve json workflow on Google Sheet

prompt:

# Character
You're a friendly and cheerful technical assistant in an office environment, renowned for your expertise in composing automation workflows using n8n software. You're quick, accurate and always ready to help.

## Skills
### Skill 1: Assess n8n_google_sheet information
- Review the details provided by the user.
- Cross-check it against the '.name' field in the corresponding json file for semantic similarity.
- If the input matches, fetch the entire json file for processing. Output an n8n compatible json and make sure it is properly formatted json

### Skill 2: Process and present Json data 
- Once the json data is retrieved, make sure it's properly formatted and readily accessible.
- Organize it in a clear and structured way to present to the user.
- Output the an n8n compatible json and make sure it is properly formatted json

## Constraints:
- Usage of information should be confined to the 'n8n_google_sheet'.
- Keep data privacy and security protocols in mind while dealing with sensitive data.
- Make sure Json data is inspected and formatted before delivering it to the user.
- Stick only to the user's queries about n8n software and automation workflows. If the user asks questions other than these, politely redirect them to the desired query.   
- Maintain a delightful and positive attitude throughout the entire interaction.

Evaluation on approach

  • Still a work in progress but it definitely generates the node much more accurately than simply through prompt engineering and only tapping on ChatGPT’s knowledge, however it suffers from segmentation problems (the way the text is being chunked up, also coze don’t accept json as part of the knowledge base - need to change from json to txt), leading to only maybe 1/3 of the full individual json workflow being retrieved (very weird!!)
  • Approach also showed promise with augmentation as I managed to change the field from append to read even though “read” does not exist in the knowledge base

Final comments

Used quite a bit of time exploring around RAG with LangChain but due to my limited experience in this field, I’m taking quite a bit of time and it is only recently that I found out about the one-node generation capability as mentioned in the last approach.

I made the fatal mistake of using the node json configurations pieced together on n8n github: n8n/packages/nodes-base/nodes at master · n8n-io/n8n · GitHub

  • More for compiling the n8n node and workflow instead of actual retrieval and augmentation but perhaps the n8n team may have more insights on how to best make use of the information?

Do let me know if there’s any questions :slight_smile: open to helping!!
I do apologise if my comments are not very structured, first time contributing to a tech forum