@n8n/ai-workflow-builder 1.4.1 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agents/responder.agent.d.ts +4 -2
- package/dist/agents/responder.agent.js +9 -2
- package/dist/agents/responder.agent.js.map +1 -1
- package/dist/agents/supervisor.agent.d.ts +2 -1
- package/dist/agents/supervisor.agent.js +2 -2
- package/dist/agents/supervisor.agent.js.map +1 -1
- package/dist/ai-workflow-builder-agent.service.js +11 -7
- package/dist/ai-workflow-builder-agent.service.js.map +1 -1
- package/dist/build.tsbuildinfo +1 -1
- package/dist/chains/conversation-compact.d.ts +2 -1
- package/dist/chains/conversation-compact.js +2 -2
- package/dist/chains/conversation-compact.js.map +1 -1
- package/dist/chains/workflow-name.d.ts +2 -1
- package/dist/chains/workflow-name.js +3 -2
- package/dist/chains/workflow-name.js.map +1 -1
- package/dist/constants.d.ts +0 -1
- package/dist/constants.js +1 -2
- package/dist/constants.js.map +1 -1
- package/dist/llm-config.d.ts +14 -5
- package/dist/llm-config.js +90 -35
- package/dist/llm-config.js.map +1 -1
- package/dist/multi-agent-workflow-subgraphs.d.ts +2 -4
- package/dist/multi-agent-workflow-subgraphs.js +20 -15
- package/dist/multi-agent-workflow-subgraphs.js.map +1 -1
- package/dist/prompts/agents/builder.prompt.js +211 -33
- package/dist/prompts/agents/builder.prompt.js.map +1 -1
- package/dist/prompts/agents/configurator.prompt.js +24 -2
- package/dist/prompts/agents/configurator.prompt.js.map +1 -1
- package/dist/prompts/agents/discovery.prompt.js +84 -7
- package/dist/prompts/agents/discovery.prompt.js.map +1 -1
- package/dist/prompts/chains/parameter-updater/guides/gmail.js +27 -2
- package/dist/prompts/chains/parameter-updater/guides/gmail.js.map +1 -1
- package/dist/prompts/chains/parameter-updater/guides/index.d.ts +1 -0
- package/dist/prompts/chains/parameter-updater/guides/index.js +3 -1
- package/dist/prompts/chains/parameter-updater/guides/index.js.map +1 -1
- package/dist/prompts/chains/parameter-updater/guides/predecessor-output.d.ts +2 -0
- package/dist/prompts/chains/parameter-updater/guides/predecessor-output.js +25 -0
- package/dist/prompts/chains/parameter-updater/guides/predecessor-output.js.map +1 -0
- package/dist/prompts/chains/parameter-updater/registry.js +1 -0
- package/dist/prompts/chains/parameter-updater/registry.js.map +1 -1
- package/dist/prompts/index.d.ts +0 -1
- package/dist/prompts/index.js +1 -4
- package/dist/prompts/index.js.map +1 -1
- package/dist/prompts/shared/node-guidance/structured-output-parser.js +1 -1
- package/dist/prompts/shared/node-recommendations/audio-generation.d.ts +2 -0
- package/dist/prompts/shared/node-recommendations/audio-generation.js +18 -0
- package/dist/prompts/shared/node-recommendations/audio-generation.js.map +1 -0
- package/dist/prompts/shared/node-recommendations/image-generation.d.ts +2 -0
- package/dist/prompts/shared/node-recommendations/image-generation.js +18 -0
- package/dist/prompts/shared/node-recommendations/image-generation.js.map +1 -0
- package/dist/prompts/shared/node-recommendations/index.d.ts +3 -0
- package/dist/prompts/shared/node-recommendations/index.js +17 -0
- package/dist/prompts/shared/node-recommendations/index.js.map +1 -0
- package/dist/prompts/shared/node-recommendations/text-manipulation.d.ts +2 -0
- package/dist/prompts/shared/node-recommendations/text-manipulation.js +27 -0
- package/dist/prompts/shared/node-recommendations/text-manipulation.js.map +1 -0
- package/dist/prompts/shared/node-recommendations/utils/format-recommendation.d.ts +2 -0
- package/dist/prompts/shared/node-recommendations/utils/format-recommendation.js +24 -0
- package/dist/prompts/shared/node-recommendations/utils/format-recommendation.js.map +1 -0
- package/dist/prompts/shared/node-recommendations/video-generation.d.ts +2 -0
- package/dist/prompts/shared/node-recommendations/video-generation.js +15 -0
- package/dist/prompts/shared/node-recommendations/video-generation.js.map +1 -0
- package/dist/subgraphs/builder.subgraph.d.ts +3 -1
- package/dist/subgraphs/builder.subgraph.js +28 -4
- package/dist/subgraphs/builder.subgraph.js.map +1 -1
- package/dist/subgraphs/configurator.subgraph.d.ts +3 -1
- package/dist/subgraphs/configurator.subgraph.js +5 -3
- package/dist/subgraphs/configurator.subgraph.js.map +1 -1
- package/dist/subgraphs/discovery.subgraph.d.ts +81 -1
- package/dist/subgraphs/discovery.subgraph.js +67 -8
- package/dist/subgraphs/discovery.subgraph.js.map +1 -1
- package/dist/tools/add-node.tool.d.ts +12 -12
- package/dist/tools/add-node.tool.js +25 -30
- package/dist/tools/add-node.tool.js.map +1 -1
- package/dist/tools/best-practices/data-persistence.js +5 -0
- package/dist/tools/best-practices/data-persistence.js.map +1 -1
- package/dist/tools/best-practices/index.js +2 -1
- package/dist/tools/best-practices/index.js.map +1 -1
- package/dist/tools/best-practices/scheduling.js +41 -168
- package/dist/tools/best-practices/scheduling.js.map +1 -1
- package/dist/tools/builder-tools.d.ts +1 -10
- package/dist/tools/builder-tools.js +6 -17
- package/dist/tools/builder-tools.js.map +1 -1
- package/dist/tools/get-documentation.tool.d.ts +79 -0
- package/dist/tools/get-documentation.tool.js +164 -0
- package/dist/tools/get-documentation.tool.js.map +1 -0
- package/dist/tools/helpers/state.d.ts +1 -0
- package/dist/tools/helpers/state.js +6 -0
- package/dist/tools/helpers/state.js.map +1 -1
- package/dist/tools/node-details.tool.js +14 -3
- package/dist/tools/node-details.tool.js.map +1 -1
- package/dist/tools/rename-node.tool.d.ts +15 -0
- package/dist/tools/rename-node.tool.js +141 -0
- package/dist/tools/rename-node.tool.js.map +1 -0
- package/dist/tools/update-node-parameters.tool.d.ts +1 -1
- package/dist/tools/update-node-parameters.tool.js +131 -2
- package/dist/tools/update-node-parameters.tool.js.map +1 -1
- package/dist/tools/utils/mermaid.utils.js +12 -10
- package/dist/tools/utils/mermaid.utils.js.map +1 -1
- package/dist/tools/validate-structure.tool.js +3 -2
- package/dist/tools/validate-structure.tool.js.map +1 -1
- package/dist/types/discovery-types.d.ts +2 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.js +1 -0
- package/dist/types/index.js.map +1 -1
- package/dist/types/node-recommendations.d.ts +26 -0
- package/dist/types/node-recommendations.js +16 -0
- package/dist/types/node-recommendations.js.map +1 -0
- package/dist/types/tools.d.ts +5 -3
- package/dist/types/workflow.d.ts +5 -0
- package/dist/utils/context-builders.js +17 -2
- package/dist/utils/context-builders.js.map +1 -1
- package/dist/utils/operations-processor.js +37 -5
- package/dist/utils/operations-processor.js.map +1 -1
- package/dist/utils/resource-operation-extractor.d.ts +16 -0
- package/dist/utils/resource-operation-extractor.js +148 -0
- package/dist/utils/resource-operation-extractor.js.map +1 -0
- package/dist/utils/state-modifier.d.ts +3 -2
- package/dist/utils/state-modifier.js +4 -4
- package/dist/utils/state-modifier.js.map +1 -1
- package/dist/utils/stream-processor.js +1 -1
- package/dist/utils/stream-processor.js.map +1 -1
- package/dist/utils/subgraph-helpers.d.ts +1 -0
- package/dist/utils/subgraph-helpers.js +12 -0
- package/dist/utils/subgraph-helpers.js.map +1 -1
- package/dist/validation/auto-fix/auto-fix-connections.d.ts +21 -0
- package/dist/validation/auto-fix/auto-fix-connections.js +207 -0
- package/dist/validation/auto-fix/auto-fix-connections.js.map +1 -0
- package/dist/validation/auto-fix/index.d.ts +2 -0
- package/dist/validation/auto-fix/index.js +6 -0
- package/dist/validation/auto-fix/index.js.map +1 -0
- package/dist/validation/checks/connections.js +10 -0
- package/dist/validation/checks/connections.js.map +1 -1
- package/dist/validation/checks/credentials.js +6 -6
- package/dist/validation/checks/credentials.js.map +1 -1
- package/dist/validation/types.d.ts +1 -1
- package/dist/workflow-builder-agent.d.ts +14 -14
- package/dist/workflow-builder-agent.js +22 -239
- package/dist/workflow-builder-agent.js.map +1 -1
- package/dist/workflow-state.d.ts +0 -1
- package/dist/workflow-state.js +0 -17
- package/dist/workflow-state.js.map +1 -1
- package/package.json +15 -12
- package/dist/prompts/legacy-agent.prompt.d.ts +0 -6
- package/dist/prompts/legacy-agent.prompt.js +0 -587
- package/dist/prompts/legacy-agent.prompt.js.map +0 -1
- package/dist/tools/categorize-prompt.tool.d.ts +0 -5
- package/dist/tools/categorize-prompt.tool.js +0 -85
- package/dist/tools/categorize-prompt.tool.js.map +0 -1
- package/dist/tools/get-best-practices.tool.d.ts +0 -34
- package/dist/tools/get-best-practices.tool.js +0 -94
- package/dist/tools/get-best-practices.tool.js.map +0 -1
- package/dist/tools/validate-workflow.tool.d.ts +0 -5
- package/dist/tools/validate-workflow.tool.js +0 -73
- package/dist/tools/validate-workflow.tool.js.map +0 -1
- package/dist/utils/workflow-validation.d.ts +0 -2
- package/dist/utils/workflow-validation.js +0 -37
- package/dist/utils/workflow-validation.js.map +0 -1
|
@@ -28,8 +28,8 @@ NEVER respond to the user without calling validate_structure first`;
|
|
|
28
28
|
const NODE_CREATION = `Each add_nodes call creates ONE node. You must provide:
|
|
29
29
|
- nodeType: The exact type from discovery (e.g., "n8n-nodes-base.httpRequest" for the "HTTP Request node")
|
|
30
30
|
- name: Descriptive name (e.g., "Fetch Weather Data")
|
|
31
|
-
-
|
|
32
|
-
-
|
|
31
|
+
- initialParametersReasoning: Explain your thinking about initial parameters
|
|
32
|
+
- initialParameters: Parameters to set initially (or {{}} if none needed)`;
|
|
33
33
|
const WORKFLOW_CONFIG_NODE = `Always include a Workflow Configuration node at the start of every workflow.
|
|
34
34
|
|
|
35
35
|
The Workflow Configuration node (n8n-nodes-base.set) should be placed immediately after the trigger node and before all other processing nodes.
|
|
@@ -51,22 +51,40 @@ const PROACTIVE_DESIGN = `Anticipate workflow needs:
|
|
|
51
51
|
- Edit Fields nodes to prepare data for a node like Gmail, Slack, Telegram, or Google Sheets
|
|
52
52
|
- Schedule Triggers for recurring tasks
|
|
53
53
|
- Error handling for external service calls
|
|
54
|
+
`;
|
|
55
|
+
const NODE_DEFAULTS = `CRITICAL: NEVER RELY ON DEFAULT PARAMETER VALUES
|
|
54
56
|
|
|
55
|
-
|
|
56
|
-
const NODE_DEFAULTS = `CRITICAL: NEVER RELY ON DEFAULT PARAMETER VALUES FOR CONNECTIONS
|
|
57
|
-
|
|
58
|
-
Default values often hide connection inputs/outputs. You MUST explicitly configure parameters that affect connections:
|
|
57
|
+
Default values often hide connection inputs/outputs or select wrong resources. You MUST explicitly set initial parameters:
|
|
59
58
|
- Vector Store: Mode parameter affects available connections - always set explicitly (e.g., mode: "insert", "retrieve", "retrieve-as-tool")
|
|
60
59
|
- AI Agent: hasOutputParser is off by default, but your workflow may need it to be on
|
|
61
60
|
- Document Loader: textSplittingMode affects whether it accepts a text splitter input - always set explicitly (e.g., textSplittingMode: "custom")
|
|
61
|
+
- Nodes with resources (Gmail, Notion, etc.): resource and operation affect which parameters are available
|
|
62
62
|
|
|
63
|
-
ALWAYS check node details and set
|
|
64
|
-
const
|
|
63
|
+
ALWAYS check node details and set initialParameters explicitly.`;
|
|
64
|
+
const INITIAL_PARAMETERS_EXAMPLES = `- Static nodes (HTTP Request, Set, Code): reasoning="Static inputs/outputs", parameters={{}}
|
|
65
65
|
- AI Agent with structured output: reasoning="hasOutputParser enables ai_outputParser input for Structured Output Parser", parameters={{ hasOutputParser: true }}
|
|
66
66
|
- Vector Store insert: reasoning="Insert mode requires document input", parameters={{ mode: "insert" }}
|
|
67
67
|
- Vector Store insert for AI Agent: reasoning="Vector store will be used for AI Agent needs retrieve-as-tool mode", parameters={{ mode: "retrieve-as-tool" }}
|
|
68
68
|
- Document Loader custom: reasoning="Custom mode enables text splitter input", parameters={{ textSplittingMode: "custom" }}
|
|
69
|
-
- Switch with routing rules: reasoning="Switch needs N outputs, creating N rules.values entries with outputKeys", parameters={{ mode: "rules", rules: {{ values: [...] }} }} - see <switch_node_pattern> for full structure
|
|
69
|
+
- Switch with routing rules: reasoning="Switch needs N outputs, creating N rules.values entries with outputKeys", parameters={{ mode: "rules", rules: {{ values: [...] }} }} - see <switch_node_pattern> for full structure
|
|
70
|
+
- Nodes with resource/operation (Gmail, Notion, Google Sheets, etc.): See <resource_operation_pattern> for details`;
|
|
71
|
+
const RESOURCE_OPERATION_PATTERN = `For nodes with [Resources: ...] in discovery context, you MUST set resource and operation in initialParameters:
|
|
72
|
+
|
|
73
|
+
WHY: Setting resource/operation during node creation enables the Configurator to filter parameters efficiently.
|
|
74
|
+
|
|
75
|
+
HOW: Look at the discovery context for available resources and operations, then set based on user intent:
|
|
76
|
+
- Gmail "send email": {{ resource: "message", operation: "send" }}
|
|
77
|
+
- Gmail "get emails": {{ resource: "message", operation: "getAll" }}
|
|
78
|
+
- Notion "archive page": {{ resource: "page", operation: "archive" }}
|
|
79
|
+
- Notion "create database entry": {{ resource: "databasePage", operation: "create" }}
|
|
80
|
+
- Google Sheets "append row": {{ resource: "sheet", operation: "append" }}
|
|
81
|
+
|
|
82
|
+
EXAMPLES:
|
|
83
|
+
- User wants to "send a daily email summary" → Gmail with {{ resource: "message", operation: "send" }}
|
|
84
|
+
- User wants to "read data from spreadsheet" → Google Sheets with {{ resource: "sheet", operation: "read" }}
|
|
85
|
+
- User wants to "create a new Notion page" → Notion with {{ resource: "page", operation: "create" }}
|
|
86
|
+
|
|
87
|
+
IMPORTANT: Choose the operation that matches user intent. If unclear, pick the most likely operation based on context`;
|
|
70
88
|
const STRUCTURED_OUTPUT_PARSER = node_guidance_1.structuredOutputParser.configuration;
|
|
71
89
|
const AI_CONNECTIONS = `n8n connections flow from SOURCE (output) to TARGET (input).
|
|
72
90
|
|
|
@@ -77,27 +95,112 @@ AI CAPABILITY CONNECTIONS are REVERSED in direction:
|
|
|
77
95
|
Sub-nodes (tools, memory, models) connect TO the AI Agent, NOT from it.
|
|
78
96
|
The sub-node is the SOURCE, the AI Agent is the TARGET.
|
|
79
97
|
|
|
80
|
-
|
|
81
|
-
|
|
98
|
+
WRONG: AI Agent -> Calculator Tool (NEVER do this)
|
|
99
|
+
CORRECT: Calculator Tool -> AI Agent (tool provides capability to agent)
|
|
82
100
|
|
|
83
101
|
When calling connect_nodes for AI sub-nodes:
|
|
84
102
|
- sourceNodeName: The sub-node (tool, memory, model, parser)
|
|
85
103
|
- targetNodeName: The AI Agent (or Vector Store, Document Loader)
|
|
86
104
|
- connectionType: The appropriate ai_* type
|
|
87
105
|
|
|
88
|
-
AI Connection Examples (SOURCE → TARGET [connectionType]):
|
|
89
|
-
- OpenAI Chat Model → AI Agent [ai_languageModel]
|
|
90
|
-
- Calculator Tool → AI Agent [ai_tool]
|
|
91
|
-
- HTTP Request Tool → AI Agent [ai_tool]
|
|
92
|
-
- Window Buffer Memory → AI Agent [ai_memory]
|
|
93
|
-
- Structured Output Parser → AI Agent [ai_outputParser]
|
|
94
|
-
- Token Splitter → Default Data Loader [ai_textSplitter]
|
|
95
|
-
- Default Data Loader → Vector Store [ai_document]
|
|
96
|
-
- Embeddings OpenAI → Vector Store [ai_embedding]
|
|
97
|
-
- Vector Store (retrieve-as-tool mode) → AI Agent [ai_tool]
|
|
98
|
-
|
|
99
106
|
The AI Agent only has ONE "main" output for regular data flow.
|
|
100
|
-
All inputs to the AI Agent come FROM sub-nodes via ai_* connection types
|
|
107
|
+
All inputs to the AI Agent come FROM sub-nodes via ai_* connection types.
|
|
108
|
+
|
|
109
|
+
Note: The connect_nodes tool will auto-detect connection types - see tool description for examples.`;
|
|
110
|
+
const AI_CONNECTION_PATTERNS = `CRITICAL: AI NODES REQUIRE MANDATORY SUB-NODE CONNECTIONS
|
|
111
|
+
|
|
112
|
+
The following nodes CANNOT function without their required ai_* inputs being connected:
|
|
113
|
+
|
|
114
|
+
**AI Agent** (@n8n/n8n-nodes-langchain.agent):
|
|
115
|
+
- MANDATORY: ai_languageModel - Must have a Chat Model connected (e.g., OpenAI Chat Model, Anthropic Chat Model)
|
|
116
|
+
- OPTIONAL: ai_tool, ai_memory, ai_outputParser
|
|
117
|
+
|
|
118
|
+
**Basic LLM Chain** (@n8n/n8n-nodes-langchain.chainLlm):
|
|
119
|
+
- MANDATORY: ai_languageModel - Must have a Chat Model connected
|
|
120
|
+
- OPTIONAL: ai_memory, ai_outputParser
|
|
121
|
+
|
|
122
|
+
**Vector Store** (in insert/load modes):
|
|
123
|
+
- MANDATORY: ai_embedding - Must have an Embeddings node connected (e.g., OpenAI Embeddings)
|
|
124
|
+
- CONDITIONAL: ai_document (required in insert mode)
|
|
125
|
+
|
|
126
|
+
**Question and Answer Chain** (@n8n/n8n-nodes-langchain.chainRetrievalQa):
|
|
127
|
+
- MANDATORY: ai_languageModel - Must have a Chat Model connected
|
|
128
|
+
- MANDATORY: ai_retriever - Must have a Retriever node connected
|
|
129
|
+
|
|
130
|
+
**Vector Store Tool** (@n8n/n8n-nodes-langchain.toolVectorStore):
|
|
131
|
+
- MANDATORY: ai_vectorStore - Must have a Vector Store connected
|
|
132
|
+
- MANDATORY: ai_languageModel - Must have a Chat Model connected
|
|
133
|
+
|
|
134
|
+
## Connection Patterns
|
|
135
|
+
|
|
136
|
+
**Pattern 1: Simple AI Agent**
|
|
137
|
+
What: Basic conversational AI that responds to user input using only its language model capabilities.
|
|
138
|
+
When to use: Simple Q&A chatbots, text generation, summarization, or any task where the AI just needs to process text without external data or actions.
|
|
139
|
+
Example prompts: "Create a chatbot", "Summarize incoming emails", "Generate product descriptions"
|
|
140
|
+
\`\`\`mermaid
|
|
141
|
+
graph TD
|
|
142
|
+
T[Trigger] --> A[AI Agent]
|
|
143
|
+
CM[OpenAI Chat Model] -.ai_languageModel.-> A
|
|
144
|
+
A --> OUT[Output Node]
|
|
145
|
+
\`\`\`
|
|
146
|
+
|
|
147
|
+
**Pattern 2: AI Agent with Tools**
|
|
148
|
+
What: AI Agent enhanced with tools that let it perform actions (calculations, API calls, database queries) and memory to maintain conversation context.
|
|
149
|
+
When to use: When the AI needs to DO things (not just respond), access external systems, perform calculations, or remember previous interactions.
|
|
150
|
+
Example prompts: "Create an assistant that can search the web and do math", "Build a bot that can create calendar events", "Assistant that remembers conversation history"
|
|
151
|
+
\`\`\`mermaid
|
|
152
|
+
graph TD
|
|
153
|
+
T[Trigger] --> A[AI Agent]
|
|
154
|
+
CM[Chat Model] -.ai_languageModel.-> A
|
|
155
|
+
TOOL1[Calculator Tool] -.ai_tool.-> A
|
|
156
|
+
TOOL2[HTTP Request Tool] -.ai_tool.-> A
|
|
157
|
+
MEM[Window Buffer Memory] -.ai_memory.-> A
|
|
158
|
+
A --> OUT[Output]
|
|
159
|
+
\`\`\`
|
|
160
|
+
|
|
161
|
+
**Pattern 3: RAG Pipeline (Vector Store Insert)**
|
|
162
|
+
What: Ingestion pipeline that processes documents, splits them into chunks, generates embeddings, and stores them in a vector database for later retrieval.
|
|
163
|
+
When to use: Building a knowledge base from documents (PDFs, web pages, files). This is the "indexing" or "loading" phase of RAG - run this BEFORE querying.
|
|
164
|
+
Example prompts: "Index my company documents", "Load PDFs into a knowledge base", "Store website content for later search"
|
|
165
|
+
\`\`\`mermaid
|
|
166
|
+
graph TD
|
|
167
|
+
T[Trigger] --> VS[Vector Store<br/>mode: insert]
|
|
168
|
+
EMB[OpenAI Embeddings] -.ai_embedding.-> VS
|
|
169
|
+
DL[Default Data Loader] -.ai_document.-> VS
|
|
170
|
+
TS[Token Text Splitter] -.ai_textSplitter.-> DL
|
|
171
|
+
\`\`\`
|
|
172
|
+
|
|
173
|
+
**Pattern 4: RAG Query with AI Agent**
|
|
174
|
+
What: AI Agent that can search a vector database to find relevant information before responding, grounding its answers in your custom data.
|
|
175
|
+
When to use: "Chat with your documents" scenarios - when the AI needs to answer questions using information from a previously indexed knowledge base.
|
|
176
|
+
Example prompts: "Answer questions about my documentation", "Chat with uploaded PDFs", "Search knowledge base and respond"
|
|
177
|
+
\`\`\`mermaid
|
|
178
|
+
graph TD
|
|
179
|
+
T[Trigger] --> A[AI Agent]
|
|
180
|
+
CM[Chat Model] -.ai_languageModel.-> A
|
|
181
|
+
VS[Vector Store<br/>mode: retrieve-as-tool] -.ai_tool.-> A
|
|
182
|
+
EMB[Embeddings] -.ai_embedding.-> VS
|
|
183
|
+
\`\`\`
|
|
184
|
+
|
|
185
|
+
**Pattern 5: Multi-Agent System**
|
|
186
|
+
What: Hierarchical agent setup where a main "supervisor" agent delegates specialized tasks to sub-agents, each with their own capabilities.
|
|
187
|
+
When to use: Complex workflows requiring different expertise (research agent + writing agent), task decomposition, or when one agent needs to orchestrate multiple specialized agents.
|
|
188
|
+
Example prompts: "Create a team of agents", "Supervisor that delegates to specialists", "Research agent that calls a coding agent"
|
|
189
|
+
\`\`\`mermaid
|
|
190
|
+
graph TD
|
|
191
|
+
T[Trigger] --> MAIN[Main AI Agent]
|
|
192
|
+
CM1[Chat Model 1] -.ai_languageModel.-> MAIN
|
|
193
|
+
SUB[AI Agent Tool] -.ai_tool.-> MAIN
|
|
194
|
+
CM2[Chat Model 2] -.ai_languageModel.-> SUB
|
|
195
|
+
\`\`\`
|
|
196
|
+
|
|
197
|
+
## Validation Checklist
|
|
198
|
+
1. Every AI Agent has a Chat Model connected via ai_languageModel
|
|
199
|
+
2. Every Vector Store has Embeddings connected via ai_embedding
|
|
200
|
+
3. All sub-nodes (Chat Models, Tools, Memory) are connected to their target nodes
|
|
201
|
+
4. Sub-nodes connect TO parent nodes, not FROM them
|
|
202
|
+
|
|
203
|
+
REMEMBER: Every AI Agent MUST have a Chat Model. Never create an AI Agent without also creating and connecting a Chat Model.`;
|
|
101
204
|
const BRANCHING = `If two nodes (B and C) are both connected to the same output of a node (A), both will execute (with the same data). Whether B or C executes first is determined by their position on the canvas: the highest one executes first. Execution happens depth-first, i.e. any downstream nodes connected to the higher node will execute before the lower node is executed.
|
|
102
205
|
Nodes that route the flow (e.g. if, switch) apply their conditions independently to each input item. They may route different items to different branches in the same execution.`;
|
|
103
206
|
const MERGING = `If two nodes (A and B) are both connected to the same input of the following node (C), node C will execute TWICE — once with the items from A and once with the items from B. The same goes for any nodes connected to node C. These two executions are called runs and are independent of each other. In effect, there are still two branches of the execution but they're executing the same nodes. No merging of the data between them will occur.
|
|
@@ -126,7 +229,43 @@ To merge the data of two branches together in a single run, use a merge node. Th
|
|
|
126
229
|
|
|
127
230
|
Examples:
|
|
128
231
|
- Enriching a dataset with another one
|
|
129
|
-
- Matching items between two datasets
|
|
232
|
+
- Matching items between two datasets
|
|
233
|
+
|
|
234
|
+
CRITICAL: Merge vs Aggregate vs Set distinction:
|
|
235
|
+
|
|
236
|
+
**MERGE node** - When ALL branches execute (Merge WAITS for all inputs):
|
|
237
|
+
\`\`\`mermaid
|
|
238
|
+
graph LR
|
|
239
|
+
T[Trigger] --> A[API 1]
|
|
240
|
+
T --> B[API 2]
|
|
241
|
+
T --> C[API 3]
|
|
242
|
+
A --> M[Merge<br/>numberInputs: 3]
|
|
243
|
+
B --> M
|
|
244
|
+
C --> M
|
|
245
|
+
M --> Next[Next Step]
|
|
246
|
+
\`\`\`
|
|
247
|
+
Use cases: 3 Slack channels, 3 RSS feeds, multiple API calls that all need to complete.
|
|
248
|
+
|
|
249
|
+
**AGGREGATE node** - When combining items from a SINGLE branch:
|
|
250
|
+
\`\`\`mermaid
|
|
251
|
+
graph LR
|
|
252
|
+
T[Trigger] --> G[Gmail<br/>returns 10 emails]
|
|
253
|
+
G --> A[Aggregate<br/>10 items → 1]
|
|
254
|
+
A --> Next[Next Step]
|
|
255
|
+
\`\`\`
|
|
256
|
+
Use cases: Gmail returning multiple emails, loop producing items to collect.
|
|
257
|
+
|
|
258
|
+
**SET node** - When only ONE branch executes (conditional):
|
|
259
|
+
\`\`\`mermaid
|
|
260
|
+
graph LR
|
|
261
|
+
T[Trigger] --> IFNode{{IF}}
|
|
262
|
+
IFNode -->|true| A[Action A]
|
|
263
|
+
IFNode -->|false| B[Action B]
|
|
264
|
+
A --> S[Set]
|
|
265
|
+
B --> S
|
|
266
|
+
S --> Next[Next Step]
|
|
267
|
+
\`\`\`
|
|
268
|
+
Use cases: IF node with true/false paths converging. Merge would wait forever for the branch that didn't execute.`;
|
|
130
269
|
const AGENT_NODE_DISTINCTION = `Distinguish between two different agent node types:
|
|
131
270
|
|
|
132
271
|
1. **AI Agent** (@n8n/n8n-nodes-langchain.agent)
|
|
@@ -139,6 +278,34 @@ const AGENT_NODE_DISTINCTION = `Distinguish between two different agent node typ
|
|
|
139
278
|
|
|
140
279
|
When discovery results include "agent", use AI Agent unless explicitly specified as "agent tool" or "sub-agent".
|
|
141
280
|
When discovery results include "AI", use the AI Agent node, instead of a provider-specific node like googleGemini or openAi nodes.`;
|
|
281
|
+
const MULTI_TRIGGER_WORKFLOWS = `Some workflows require MULTIPLE triggers for different entry points:
|
|
282
|
+
|
|
283
|
+
**Examples requiring multiple triggers:**
|
|
284
|
+
- "React to both form submissions AND emails" -> n8n Form Trigger + Gmail Trigger
|
|
285
|
+
- "Handle webhook calls AND scheduled runs" -> Webhook + Schedule Trigger
|
|
286
|
+
- "Process incoming chats AND scheduled tasks" -> Chat Trigger + Schedule Trigger
|
|
287
|
+
|
|
288
|
+
**How to build:**
|
|
289
|
+
1. Create each trigger node separately
|
|
290
|
+
2. Each trigger starts its own execution path
|
|
291
|
+
3. Paths may converge later using Set (Edit Fields) node if needed (only one trigger fires per execution)
|
|
292
|
+
|
|
293
|
+
IMPORTANT: If the user prompt mentions TWO different input sources (e.g., "website form OR email"), you need TWO trigger nodes.`;
|
|
294
|
+
const SHARED_MEMORY_PATTERN = `When a workflow has BOTH a scheduled AI task AND a chat interface for querying results:
|
|
295
|
+
|
|
296
|
+
**Pattern: Share memory between AI Agent and Chat Trigger**
|
|
297
|
+
1. Create ONE Window Buffer Memory node
|
|
298
|
+
2. Connect the SAME memory node to BOTH:
|
|
299
|
+
- The AI Agent that processes data (via ai_memory)
|
|
300
|
+
- The Chat Trigger's AI Agent that answers queries (via ai_memory)
|
|
301
|
+
|
|
302
|
+
This allows users to query the AI about previously processed data through chat.
|
|
303
|
+
|
|
304
|
+
Example structure:
|
|
305
|
+
- Schedule Trigger → AI Agent (data processing) ← Memory Node
|
|
306
|
+
- Telegram Trigger → AI Agent (chat queries) ← Memory Node (same one!)
|
|
307
|
+
|
|
308
|
+
CRITICAL: Both AI Agents must connect to the SAME memory node for context sharing.`;
|
|
142
309
|
const RAG_PATTERN = `For RAG (Retrieval-Augmented Generation) workflows:
|
|
143
310
|
|
|
144
311
|
Main data flow:
|
|
@@ -159,7 +326,7 @@ const SWITCH_NODE_PATTERN = `For Switch nodes with multiple routing paths:
|
|
|
159
326
|
- Configurator will fill in the actual condition values later
|
|
160
327
|
- Use descriptive node names like "Route by Amount" or "Route by Status"
|
|
161
328
|
|
|
162
|
-
Example
|
|
329
|
+
Example initialParameters for 3-way routing:
|
|
163
330
|
{{
|
|
164
331
|
"mode": "rules",
|
|
165
332
|
"rules": {{
|
|
@@ -236,11 +403,18 @@ ai_languageModel - Language model provides LLM capability:
|
|
|
236
403
|
- OpenAI Chat Model → AI Agent
|
|
237
404
|
- Anthropic Chat Model → AI Agent
|
|
238
405
|
|
|
239
|
-
ai_tool - Tool provides action capability:
|
|
406
|
+
ai_tool - Tool provides action capability to AI Agent:
|
|
240
407
|
- Calculator Tool → AI Agent
|
|
241
408
|
- HTTP Request Tool → AI Agent
|
|
242
409
|
- Code Tool → AI Agent
|
|
243
410
|
- AI Agent Tool → AI Agent (multi-agent systems)
|
|
411
|
+
- Google Calendar Tool → AI Agent (for scheduling/calendar management)
|
|
412
|
+
- Gmail Tool → AI Agent (for email operations)
|
|
413
|
+
- Slack Tool → AI Agent (for messaging)
|
|
414
|
+
|
|
415
|
+
IMPORTANT: When AI Agent needs to perform external actions (create events, send messages, make API calls),
|
|
416
|
+
use TOOL nodes connected via ai_tool, NOT regular nodes in the main flow.
|
|
417
|
+
Tool nodes let the AI Agent DECIDE when to use them. Regular nodes ALWAYS execute.
|
|
244
418
|
|
|
245
419
|
ai_memory - Memory provides conversation history:
|
|
246
420
|
- Window Buffer Memory → AI Agent
|
|
@@ -264,12 +438,12 @@ ai_vectorStore - Vector store provides retrieval (when used as tool):
|
|
|
264
438
|
- Vector Store (mode: retrieve-as-tool) → AI Agent [ai_tool]
|
|
265
439
|
|
|
266
440
|
COMMON MISTAKES TO AVOID:
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
441
|
+
WRONG: AI Agent -> OpenAI Chat Model (model provides TO agent)
|
|
442
|
+
WRONG: AI Agent -> Calculator Tool (tool provides TO agent)
|
|
443
|
+
WRONG: AI Agent -> Window Buffer Memory (memory provides TO agent)
|
|
444
|
+
CORRECT: OpenAI Chat Model -> AI Agent
|
|
445
|
+
CORRECT: Calculator Tool -> AI Agent
|
|
446
|
+
CORRECT: Window Buffer Memory -> AI Agent
|
|
273
447
|
</connection_type_reference>`;
|
|
274
448
|
const RESTRICTIONS = `- Respond before calling validate_structure
|
|
275
449
|
- Skip validation even if you think structure is correct
|
|
@@ -291,12 +465,16 @@ function buildBuilderPrompt() {
|
|
|
291
465
|
.section('data_parsing_strategy', DATA_PARSING)
|
|
292
466
|
.section('proactive_design', PROACTIVE_DESIGN)
|
|
293
467
|
.section('node_defaults_warning', NODE_DEFAULTS)
|
|
294
|
-
.section('
|
|
468
|
+
.section('initial_parameters_examples', INITIAL_PARAMETERS_EXAMPLES)
|
|
469
|
+
.section('resource_operation_pattern', RESOURCE_OPERATION_PATTERN)
|
|
295
470
|
.section('structured_output_parser_guidance', STRUCTURED_OUTPUT_PARSER)
|
|
296
471
|
.section('node_connections_understanding', AI_CONNECTIONS)
|
|
472
|
+
.section('ai_connection_patterns', AI_CONNECTION_PATTERNS)
|
|
297
473
|
.section('branching', BRANCHING)
|
|
298
474
|
.section('merging', MERGING)
|
|
299
475
|
.section('agent_node_distinction', AGENT_NODE_DISTINCTION)
|
|
476
|
+
.section('multi_trigger_workflows', MULTI_TRIGGER_WORKFLOWS)
|
|
477
|
+
.section('shared_memory_pattern', SHARED_MEMORY_PATTERN)
|
|
300
478
|
.section('rag_workflow_pattern', RAG_PATTERN)
|
|
301
479
|
.section('switch_node_pattern', SWITCH_NODE_PATTERN)
|
|
302
480
|
.section('node_connection_examples', NODE_CONNECTION_EXAMPLES)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builder.prompt.js","sourceRoot":"","sources":["../../../src/prompts/agents/builder.prompt.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"builder.prompt.js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,EAAE,WAAW,CAAC;SAC5C,OAAO,CAAC,qBAAqB,EAAE,mBAAmB,CAAC;SACnD,OAAO,CAAC,0BAA0B,EAAE,wBAAwB,CAAC;SAC7D,OAAO,CAAC,0BAA0B,EAAE,gBAAgB,CAAC;SACrD,OAAO,CAAC,QAAQ,EAAE,YAAY,CAAC;SAC/B,OAAO,CAAC,iBAAiB,EAAE,eAAe,CAAC;SAC3C,KAAK,EAAE,CAAC;AACX,CAAC"}
|
|
@@ -33,7 +33,16 @@ const PARAMETER_CONFIGURATION = `Use update_node_parameters with natural languag
|
|
|
33
33
|
- "Set URL to https://api.example.com/weather"
|
|
34
34
|
- "Add header Authorization: Bearer token"
|
|
35
35
|
- "Set method to POST"
|
|
36
|
-
- "Add field 'status' with value 'processed'"
|
|
36
|
+
- "Add field 'status' with value 'processed'"
|
|
37
|
+
|
|
38
|
+
RESOURCE/OPERATION HANDLING:
|
|
39
|
+
For nodes with resource/operation patterns (Gmail, Notion, Google Sheets, Google Drive, Slack, etc.):
|
|
40
|
+
- The Builder agent has ALREADY set resource and operation - check the workflow JSON
|
|
41
|
+
- Usually you should NOT change these - focus on configuring other parameters
|
|
42
|
+
- If you DO need to change resource/operation (e.g., user explicitly requests it or Builder made a mistake):
|
|
43
|
+
- ONLY use values from the DISCOVERY CONTEXT section - it lists valid resource/operation combinations
|
|
44
|
+
- NEVER hallucinate or guess operation names - if it's not in discovery context, it doesn't exist
|
|
45
|
+
- The parameter list you receive is filtered based on the current resource/operation`;
|
|
37
46
|
const DATA_REFERENCING = `Nodes output an array of items. Nodes have access to the output items of all the nodes that have already executed.
|
|
38
47
|
|
|
39
48
|
Within a node, data from previous nodes is commonly referenced using the following:
|
|
@@ -140,9 +149,21 @@ const RESPONSE_FORMAT = `After validation passes, provide a concise summary:
|
|
|
140
149
|
- List any placeholders requiring user configuration (e.g., "URL placeholder needs actual endpoint")
|
|
141
150
|
- Note which nodes were configured and key settings applied
|
|
142
151
|
- Keep it brief - this output is used for coordination with other LLM agents, not displayed directly to users`;
|
|
152
|
+
const CREDENTIAL_SECURITY = `SECURITY: Never configure credentials or authentication secrets.
|
|
153
|
+
|
|
154
|
+
The AI Workflow Builder does NOT have access to credentials - they are configured separately by users in the frontend.
|
|
155
|
+
|
|
156
|
+
NEVER set these parameters:
|
|
157
|
+
- apiKey, token, password, secret, or any credential fields
|
|
158
|
+
- Placeholder values like "YOUR_API_KEY_HERE" or "sk-..."
|
|
159
|
+
- Authentication headers with actual secrets
|
|
160
|
+
|
|
161
|
+
Credentials are automatically handled by n8n's credential system when users configure the workflow after generation.`;
|
|
143
162
|
const RESTRICTIONS = `- Respond before calling validate_configuration
|
|
144
163
|
- Skip validation even if you think configuration is correct
|
|
145
|
-
- Add commentary between tool calls - execute tools silently
|
|
164
|
+
- Add commentary between tool calls - execute tools silently
|
|
165
|
+
- Hallucinate or guess resource/operation values - only use values listed in DISCOVERY CONTEXT
|
|
166
|
+
- Configure credentials, API keys, tokens, or authentication secrets`;
|
|
146
167
|
exports.INSTANCE_URL_PROMPT = `
|
|
147
168
|
<instance_url>
|
|
148
169
|
The n8n instance base URL is: {instanceUrl}
|
|
@@ -180,6 +201,7 @@ function buildConfiguratorPrompt() {
|
|
|
180
201
|
.section('default_values_guide', DEFAULT_VALUES_GUIDE)
|
|
181
202
|
.section('switch_node_configuration', SWITCH_NODE_CONFIGURATION)
|
|
182
203
|
.section('node_configuration_examples', NODE_CONFIGURATION_EXAMPLES)
|
|
204
|
+
.section('credential_security', CREDENTIAL_SECURITY)
|
|
183
205
|
.section('response_format', RESPONSE_FORMAT)
|
|
184
206
|
.section('do_not', RESTRICTIONS)
|
|
185
207
|
.build();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configurator.prompt.js","sourceRoot":"","sources":["../../../src/prompts/agents/configurator.prompt.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"configurator.prompt.js","sourceRoot":"","sources":["../../../src/prompts/agents/configurator.prompt.ts"],"names":[],"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C,OAAO,IAAA,gBAAM,GAAE;SACb,OAAO,CAAC,MAAM,EAAE,iBAAiB,CAAC;SAClC,OAAO,CAAC,8BAA8B,EAAE,kBAAkB,CAAC;SAC3D,OAAO,CAAC,yBAAyB,EAAE,uBAAuB,CAAC;SAC3D,OAAO,CAAC,yBAAyB,EAAE,uBAAuB,CAAC;SAC3D,OAAO,CAAC,kBAAkB,EAAE,gBAAgB,CAAC;SAC7C,OAAO,CAAC,uBAAuB,EAAE,qBAAqB,CAAC;SACvD,OAAO,CAAC,uBAAuB,EAAE,qBAAqB,CAAC;SACvD,OAAO,CAAC,qBAAqB,EAAE,mBAAmB,CAAC;SACnD,OAAO,CAAC,sBAAsB,EAAE,oBAAoB,CAAC;SACrD,OAAO,CAAC,2BAA2B,EAAE,yBAAyB,CAAC;SAC/D,OAAO,CAAC,6BAA6B,EAAE,2BAA2B,CAAC;SACnE,OAAO,CAAC,qBAAqB,EAAE,mBAAmB,CAAC;SACnD,OAAO,CAAC,iBAAiB,EAAE,eAAe,CAAC;SAC3C,OAAO,CAAC,QAAQ,EAAE,YAAY,CAAC;SAC/B,KAAK,EAAE,CAAC;AACX,CAAC"}
|
|
@@ -4,6 +4,7 @@ exports.exampleCategorizations = void 0;
|
|
|
4
4
|
exports.formatTechniqueList = formatTechniqueList;
|
|
5
5
|
exports.formatExampleCategorizations = formatExampleCategorizations;
|
|
6
6
|
exports.buildDiscoveryPrompt = buildDiscoveryPrompt;
|
|
7
|
+
const types_1 = require("../../types");
|
|
7
8
|
const categorization_1 = require("../../types/categorization");
|
|
8
9
|
const builder_1 = require("../builder");
|
|
9
10
|
const node_guidance_1 = require("../shared/node-guidance");
|
|
@@ -120,7 +121,7 @@ function formatExampleCategorizations() {
|
|
|
120
121
|
const DISCOVERY_ROLE = `You are a Discovery Agent for n8n AI Workflow Builder.
|
|
121
122
|
|
|
122
123
|
YOUR ROLE: Identify relevant n8n nodes and their connection-changing parameters.`;
|
|
123
|
-
const TECHNIQUE_CATEGORIZATION = `When calling
|
|
124
|
+
const TECHNIQUE_CATEGORIZATION = `When calling get_documentation with type: "best_practices", select techniques that match the user's workflow intent.
|
|
124
125
|
|
|
125
126
|
<available_techniques>
|
|
126
127
|
{techniques}
|
|
@@ -189,6 +190,61 @@ const SUB_NODES_SEARCHES = `When searching for AI nodes, ALSO search for their r
|
|
|
189
190
|
- "AI Agent" → also search for "Chat Model", "Memory", "Output Parser"
|
|
190
191
|
- "Basic LLM Chain" → also search for "Chat Model", "Output Parser"
|
|
191
192
|
- "Vector Store" → also search for "Embeddings", "Document Loader"`;
|
|
193
|
+
const AI_NODE_SELECTION = `CRITICAL: ALWAYS use AI Agent for AI/LLM processing.
|
|
194
|
+
|
|
195
|
+
**Use AI Agent (@n8n/n8n-nodes-langchain.agent) for:**
|
|
196
|
+
- Text analysis, summarization, or classification
|
|
197
|
+
- Processing data with AI/LLM (e.g., "analyze weather", "summarize emails")
|
|
198
|
+
- Any task requiring reasoning or decision-making
|
|
199
|
+
- Chat completions or conversational AI
|
|
200
|
+
- Multi-step AI tasks
|
|
201
|
+
- ANY prompt asking for "AI", "agent", or "AI processing"
|
|
202
|
+
|
|
203
|
+
**Use @n8n/n8n-nodes-langchain.openAi ONLY for:**
|
|
204
|
+
- Image generation (DALL-E)
|
|
205
|
+
- Audio transcription (Whisper)
|
|
206
|
+
- Text-to-speech
|
|
207
|
+
- Embeddings generation
|
|
208
|
+
- Other OpenAI-specific operations that are NOT text analysis/reasoning
|
|
209
|
+
|
|
210
|
+
WRONG: Recommending openAi node for "analyze weather data" or "summarize news"
|
|
211
|
+
CORRECT: Recommending AI Agent for analysis/summarization tasks
|
|
212
|
+
|
|
213
|
+
When user asks for AI processing, analysis, or summarization:
|
|
214
|
+
1. Recommend AI Agent (@n8n/n8n-nodes-langchain.agent)
|
|
215
|
+
2. Recommend OpenAI Chat Model (lmChatOpenAi) as the default chat model - new users get free OpenAI credits
|
|
216
|
+
3. Do NOT recommend the standalone openAi node for these tasks
|
|
217
|
+
4. Do NOT recommend Basic LLM Chain - always prefer AI Agent
|
|
218
|
+
|
|
219
|
+
**Default Chat Model: OpenAI (lmChatOpenAi)**
|
|
220
|
+
- Use OpenAI Chat Model unless user explicitly requests a different provider (e.g., "use Claude", "use Gemini")
|
|
221
|
+
- OpenAI has the lowest setup friction for new trial users
|
|
222
|
+
- Only use lmChatAnthropic, lmChatGoogleGemini, etc. when explicitly requested
|
|
223
|
+
|
|
224
|
+
Chat Model nodes are SUB-NODES - they connect TO AI Agent via ai_languageModel, never used standalone for text processing.`;
|
|
225
|
+
const AI_AGENT_TOOLS = `When AI Agent needs to perform external actions, use TOOL nodes connected via ai_tool:
|
|
226
|
+
|
|
227
|
+
**Pattern: AI Agent with Tool nodes**
|
|
228
|
+
- AI Agent decides WHEN and HOW to use tools based on its reasoning
|
|
229
|
+
- Tool nodes connect TO the AI Agent (Tool → AI Agent [ai_tool])
|
|
230
|
+
- The agent can call tools multiple times or skip them entirely based on context
|
|
231
|
+
|
|
232
|
+
**Common Tool nodes (use INSTEAD of regular nodes when AI Agent is involved):**
|
|
233
|
+
| Regular Node | Tool Node | When to use Tool version |
|
|
234
|
+
|--------------|-----------|--------------------------|
|
|
235
|
+
| googleCalendar | googleCalendarTool | AI Agent creates/manages calendar events |
|
|
236
|
+
| slack | slackTool | AI Agent sends messages or reads channels |
|
|
237
|
+
| gmail | gmailTool | AI Agent sends emails or searches inbox |
|
|
238
|
+
| httpRequest | httpRequestTool | AI Agent makes API calls |
|
|
239
|
+
| calculator | calculatorTool | AI Agent performs calculations |
|
|
240
|
+
|
|
241
|
+
**When to use Tool nodes vs Regular nodes:**
|
|
242
|
+
- Tool node: AI Agent needs to DECIDE whether/when to perform the action
|
|
243
|
+
- Regular node: Action ALWAYS happens at that point in the workflow
|
|
244
|
+
|
|
245
|
+
**Example - AI scheduling assistant:**
|
|
246
|
+
WRONG: AI Agent → Google Calendar (calendar always creates event)
|
|
247
|
+
CORRECT: Google Calendar Tool → AI Agent [ai_tool] (agent decides if/when to create event)`;
|
|
192
248
|
const STRUCTURED_OUTPUT_PARSER = node_guidance_1.structuredOutputParser.usage;
|
|
193
249
|
const CODE_NODE_ALTERNATIVES = `CRITICAL: Prefer native n8n nodes over Code node. Code nodes are slower (sandboxed environment).
|
|
194
250
|
|
|
@@ -212,8 +268,8 @@ const CODE_NODE_ALTERNATIVES = `CRITICAL: Prefer native n8n nodes over Code node
|
|
|
212
268
|
| Filter items by condition | Filter |
|
|
213
269
|
| Route by condition | If or Switch |
|
|
214
270
|
| Split array into items | Split Out |
|
|
215
|
-
| Combine multiple
|
|
216
|
-
|
|
|
271
|
+
| Combine/join/merge data from multiple sources | Merge AND Aggregate (recommend BOTH - Builder decides structure) |
|
|
272
|
+
| Rejoin conditional branches (after If/Switch) | Edit Fields (Set) |
|
|
217
273
|
| Summarize/pivot data | Summarize |
|
|
218
274
|
| Sort items | Sort |
|
|
219
275
|
| Remove duplicates | Remove Duplicates |
|
|
@@ -248,8 +304,13 @@ const CODE_NODE_ALTERNATIVES = `CRITICAL: Prefer native n8n nodes over Code node
|
|
|
248
304
|
- Regex operations (use expressions in If or Edit Fields nodes)
|
|
249
305
|
- Text extraction or parsing (use Edit Fields with expressions)
|
|
250
306
|
- Logging using console.log unless user explicitly asks - only useful for debugging, not production`;
|
|
307
|
+
const EXPLICIT_INTEGRATIONS = `When user explicitly requests a specific service or integration:
|
|
308
|
+
- ALWAYS use the exact integration requested (e.g., "use Perplexity" → Perplexity node, NOT SerpAPI)
|
|
309
|
+
- Do NOT substitute with similar services unless the requested one doesn't exist in n8n
|
|
310
|
+
- Search for the requested integration first before considering alternatives
|
|
311
|
+
- Examples: "use Gemini" → Google Gemini; "send via Telegram" → Telegram node`;
|
|
251
312
|
const CRITICAL_RULES = `- NEVER ask clarifying questions
|
|
252
|
-
- ALWAYS call
|
|
313
|
+
- ALWAYS call get_documentation first (with best_practices, and node_recommendations if AI tasks are needed)
|
|
253
314
|
- THEN Call search_nodes to learn about available nodes and their inputs and outputs
|
|
254
315
|
- FINALLY call get_node_details IN PARALLEL for speed to get more details about RELEVANT node
|
|
255
316
|
- ALWAYS extract version number from <version> tag in node details
|
|
@@ -258,7 +319,19 @@ const CRITICAL_RULES = `- NEVER ask clarifying questions
|
|
|
258
319
|
- If no parameters appear in connection expressions, return empty array []
|
|
259
320
|
- Output ONLY: nodesFound with {{ nodeName, version, reasoning, connectionChangingParameters }}
|
|
260
321
|
- When user specifies a model name (e.g., 'gpt-4.1-mini') try to use this if it is a valid option
|
|
261
|
-
- PREFER native n8n nodes (especially Edit Fields) over Code node
|
|
322
|
+
- PREFER native n8n nodes (especially Edit Fields) over Code node
|
|
323
|
+
- For structural/flow nodes (Merge, Aggregate, If, Switch), be INCLUSIVE - recommend ALL that COULD be useful, let Builder decide which to actually use based on workflow structure
|
|
324
|
+
- Example: If task involves combining data from multiple sources, recommend BOTH Merge (for parallel branches) AND Aggregate (for items in same branch) - Builder will pick the right one
|
|
325
|
+
- Reasoning should focus on FUNCTIONAL capability (what the node does), NOT workflow structure assumptions (how branches will be arranged)
|
|
326
|
+
- WRONG reasoning: "Aggregate to combine 3 channels" (assumes structure)
|
|
327
|
+
- CORRECT reasoning: "Aggregate to combine multiple items into one" (describes capability)`;
|
|
328
|
+
const NODE_RECOMMENDATIONS_GUIDANCE = `When to include node_recommendations in get_documentation requests:
|
|
329
|
+
- User mentions generic tasks like "generate image", "transcribe audio", "analyze text"
|
|
330
|
+
- The user's request falls within one of the node recommendation categories: ${Object.values(types_1.RecommendationCategory).join(', ')}
|
|
331
|
+
|
|
332
|
+
Do NOT request node_recommendations when:
|
|
333
|
+
- It is clear for each recommendation category what nodes the user would like to use
|
|
334
|
+
- It is clear how to configure the nodes they have requested to use (e.g. what model to use for an agent)`;
|
|
262
335
|
const RESTRICTIONS = `- Output text commentary between tool calls
|
|
263
336
|
- Include bestPractices or categorization in submit_discovery_results
|
|
264
337
|
- Flag parameters that don't affect connections
|
|
@@ -266,7 +339,7 @@ const RESTRICTIONS = `- Output text commentary between tool calls
|
|
|
266
339
|
function generateAvailableToolsList(options) {
|
|
267
340
|
const { includeExamples } = options;
|
|
268
341
|
const tools = [
|
|
269
|
-
'-
|
|
342
|
+
'- get_documentation: Retrieve best practices and/or node recommendations. Pass an array of requests, each with type "best_practices" (requires techniques array) or "node_recommendations" (requires categories array)',
|
|
270
343
|
'- search_nodes: Find n8n nodes by keyword',
|
|
271
344
|
'- get_node_details: Get complete node information including <connections>',
|
|
272
345
|
];
|
|
@@ -280,7 +353,7 @@ function generateProcessSteps(options) {
|
|
|
280
353
|
const { includeExamples } = options;
|
|
281
354
|
const steps = [
|
|
282
355
|
'**Analyze user prompt** - Extract services, models, and technologies mentioned',
|
|
283
|
-
'**Call
|
|
356
|
+
'**Call get_documentation** with requests array containing best_practices (with techniques) and optionally node_recommendations (with categories for AI tasks)',
|
|
284
357
|
];
|
|
285
358
|
if (includeExamples) {
|
|
286
359
|
steps.push('**Call get_workflow_examples** with search queries for mentioned services/models');
|
|
@@ -301,10 +374,14 @@ function buildDiscoveryPrompt(options) {
|
|
|
301
374
|
.section('process', processSteps)
|
|
302
375
|
.section('technique_categorization', TECHNIQUE_CATEGORIZATION)
|
|
303
376
|
.section('technique_clarifications', TECHNIQUE_CLARIFICATIONS)
|
|
377
|
+
.section('node_recommendations_guidance', NODE_RECOMMENDATIONS_GUIDANCE)
|
|
304
378
|
.section('code_node_alternatives', CODE_NODE_ALTERNATIVES)
|
|
379
|
+
.section('explicit_integrations', EXPLICIT_INTEGRATIONS)
|
|
305
380
|
.section('connection_changing_parameters', CONNECTION_PARAMETERS)
|
|
306
381
|
.section('dynamic_output_nodes', DYNAMIC_OUTPUT_NODES)
|
|
307
382
|
.section('sub_nodes_searches', SUB_NODES_SEARCHES)
|
|
383
|
+
.section('ai_node_selection', AI_NODE_SELECTION)
|
|
384
|
+
.section('ai_agent_tools', AI_AGENT_TOOLS)
|
|
308
385
|
.section('structured_output_parser', STRUCTURED_OUTPUT_PARSER)
|
|
309
386
|
.section('critical_rules', CRITICAL_RULES)
|
|
310
387
|
.section('do_not', RESTRICTIONS)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"discovery.prompt.js","sourceRoot":"","sources":["../../../src/prompts/agents/discovery.prompt.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"discovery.prompt.js","sourceRoot":"","sources":["../../../src/prompts/agents/discovery.prompt.ts"],"names":[],"mappings":";;;AA6HA,kDAIC;AAED,oEAIC;AA2RD,oDAsBC;AAjbD,mCAAiD;AACjD,2DAIgC;AAEhC,wCAAoC;AACpC,2DAAiE;AAGpD,QAAA,sBAAsB,GAG9B;IACJ;QACC,MAAM,EAAE,sFAAsF;QAC9F,UAAU,EAAE;YACX,kCAAiB,CAAC,UAAU;YAC5B,kCAAiB,CAAC,OAAO;YACzB,kCAAiB,CAAC,kBAAkB;SACpC;KACD;IACD;QACC,MAAM,EAAE,+EAA+E;QACvF,UAAU,EAAE;YACX,kCAAiB,CAAC,UAAU;YAC5B,kCAAiB,CAAC,iBAAiB;YACnC,kCAAiB,CAAC,YAAY;SAC9B;KACD;IACD;QACC,MAAM,EAAE,iFAAiF;QACzF,UAAU,EAAE;YACX,kCAAiB,CAAC,UAAU;YAC5B,kCAAiB,CAAC,qBAAqB;YACvC,kCAAiB,CAAC,eAAe;YACjC,kCAAiB,CAAC,aAAa;SAC/B;KACD;IACD;QACC,MAAM,EAAE,iFAAiF;QACzF,UAAU,EAAE;YACX,kCAAiB,CAAC,mBAAmB;YACrC,kCAAiB,CAAC,eAAe;YACjC,kCAAiB,CAAC,mBAAmB;YACrC,kCAAiB,CAAC,UAAU;SAC5B;KACD;IACD;QACC,MAAM,EAAE,sEAAsE;QAC9E,UAAU,EAAE;YACX,kCAAiB,CAAC,mBAAmB;YACrC,kCAAiB,CAAC,aAAa;YAC/B,kCAAiB,CAAC,cAAc;SAChC;KACD;IACD;QACC,MAAM,EAAE,uEAAuE;QAC/E,UAAU,EAAE,CAAC,kCAAiB,CA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/B,OAAO,CAAC,iBAAiB,EAAE,cAAc,CAAC;SAC1C,OAAO,CAAC,SAAS,EAAE,YAAY,CAAC;SAChC,OAAO,CAAC,0BAA0B,EAAE,wBAAwB,CAAC;SAC7D,OAAO,CAAC,0BAA0B,EAAE,wBAAwB,CAAC;SAC7D,OAAO,CAAC,+BAA+B,EAAE,6BAA6B,CAAC;SACvE,OAAO,CAAC,wBAAwB,EAAE,sBAAsB,CAAC;SACzD,OAAO,CAAC,uBAAuB,EAAE,qBAAqB,CAAC;SACvD,OAAO,CAAC,gCAAgC,EAAE,qBAAqB,CAAC;SAChE,OAAO,CAAC,sBAAsB,EAAE,oBAAoB,CAAC;SACrD,OAAO,CAAC,oBAAoB,EAAE,kBAAkB,CAAC;SACjD,OAAO,CAAC,mBAAmB,EAAE,iBAAiB,CAAC;SAC/C,OAAO,CAAC,gBAAgB,EAAE,cAAc,CAAC;SACzC,OAAO,CAAC,0BAA0B,EAAE,wBAAwB,CAAC;SAC7D,OAAO,CAAC,gBAAgB,EAAE,cAAc,CAAC;SACzC,OAAO,CAAC,QAAQ,EAAE,YAAY,CAAC;SAC/B,KAAK,EAAE,CAAC;AACX,CAAC"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.GMAIL_GUIDE = void 0;
|
|
4
4
|
exports.GMAIL_GUIDE = {
|
|
5
|
-
patterns: ['n8n-nodes-base.gmail'],
|
|
5
|
+
patterns: ['n8n-nodes-base.gmail', 'n8n-nodes-base.gmailTrigger'],
|
|
6
6
|
content: `
|
|
7
7
|
### Gmail Node Updates
|
|
8
8
|
|
|
@@ -14,13 +14,38 @@ exports.GMAIL_GUIDE = {
|
|
|
14
14
|
- **message**: Email body/content
|
|
15
15
|
- **authentication**: OAuth2 or Service Account
|
|
16
16
|
|
|
17
|
+
#### Simplify Option (CRITICAL)
|
|
18
|
+
- **simplify: false** - Returns FULL email with body, attachments, headers
|
|
19
|
+
- **simplify: true** - Returns LIMITED data (subject, snippet only, NO body)
|
|
20
|
+
|
|
21
|
+
ALWAYS set simplify to FALSE when:
|
|
22
|
+
- Workflow needs to analyze email content/body
|
|
23
|
+
- AI Agent will process or summarize emails
|
|
24
|
+
- Email content is used for decision making
|
|
25
|
+
- Attachments need to be accessed
|
|
26
|
+
|
|
27
|
+
#### Gmail Filter Queries
|
|
28
|
+
For Gmail Trigger nodes, use comprehensive search filters with OR operators:
|
|
29
|
+
- Multiple keywords: "subject:(delivery OR shipment OR package OR tracking)"
|
|
30
|
+
- From specific senders: "from:example@domain.com"
|
|
31
|
+
- With attachments: "has:attachment"
|
|
32
|
+
- Unread only: "is:unread"
|
|
33
|
+
|
|
34
|
+
Example for package tracking: "subject:(delivery OR shipment OR package OR tracking OR shipped)"
|
|
35
|
+
NOT just: "subject:delivery" (misses many relevant emails)
|
|
36
|
+
|
|
17
37
|
#### Common Patterns
|
|
18
38
|
1. **Sending Email**:
|
|
19
39
|
- Set resource to "message"
|
|
20
40
|
- Set operation to "send"
|
|
21
41
|
- Configure to, subject, and message fields
|
|
22
42
|
|
|
23
|
-
2. **
|
|
43
|
+
2. **Reading Emails for AI Analysis**:
|
|
44
|
+
- Set simplify to false (required for full email body)
|
|
45
|
+
- Configure appropriate filter query
|
|
46
|
+
- Pass full email data to AI Agent
|
|
47
|
+
|
|
48
|
+
3. **Using Expressions**:
|
|
24
49
|
- Can use expressions: "={{ $('Previous Node').item.json.email }}"
|
|
25
50
|
- Can reference previous node data for dynamic values
|
|
26
51
|
`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gmail.js","sourceRoot":"","sources":["../../../../../src/prompts/chains/parameter-updater/guides/gmail.ts"],"names":[],"mappings":";;;AAEa,QAAA,WAAW,GAAkB;IACzC,QAAQ,EAAE,CAAC,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"gmail.js","sourceRoot":"","sources":["../../../../../src/prompts/chains/parameter-updater/guides/gmail.ts"],"names":[],"mappings":";;;AAEa,QAAA,WAAW,GAAkB;IACzC,QAAQ,EAAE,CAAC,sBAAsB,EAAE,6BAA6B,CAAC;IACjE,OAAO,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6CT;CACA,CAAC"}
|