इसे छोड़कर कंटेंट पर जाएं
AggregaAggregaAggregaAggrega
भाषा चुने: हिन्दी
इस पेज का मशीन अनुवाद किया गया है। मूल अंग्रेज़ी पढ़ें।

एक n8n वर्कफ़्लो इम्पोर्ट करें

यह वॉकथ्रू n8n से एक्सपोर्ट किए गए एक वर्कफ़्लो को — एक AI एजेंट जो एक OpenAI चैट मॉडल और एक मेमोरी के साथ चैट संदेशों का उत्तर देता है — एक Aggregate, एक Release और एक Manifest में इम्पोर्ट करता है, जो जैसे लिखे गए हैं वैसे ही, Docker Compose के लिए वर्कफ़्लो वहन करने वाले n8n को बिल्ड करते हैं, फिर उन्हें बिल्ड करता है और परिणाम को चलाता है। नीचे की हर फ़ाइल और आउटपुट का हर ब्लॉक एक वास्तविक रन से आता है; वर्कफ़्लो और वॉकथ्रू का हर चरण import-n8n उदाहरण में है, जहाँ एक जाँच स्क्रिप्ट इम्पोर्ट को फिर से चलाती है, वह जो लिखता है, जो प्रिंट करता है और इस पेज में उद्धृत ब्लॉकों की तुलना वहाँ रखी फ़ाइलों से करती है, और इम्पोर्ट ने जो लिखा उसे वैलिडेट और बिल्ड करती है।

उदाहरण ड्राफ़्ट करें

आप यह इम्पोर्ट इस पेज के कमांडों से चला सकते हैं, या इसे अपने AI असिस्टेंट से चलवा सकते हैं।

उदाहरण को उसी के नाम वाले एक नए फ़ोल्डर में लिखें:

Terminal window
aggrega draft --example import-n8n

फिर यह आगे चलाने के लिए कमांड प्रिंट करता है। पहला कमांड नए फ़ोल्डर में ले जाता है; उसके बाद वाला, नीचे दिया गया, उसके source फ़ोल्डर में ले जाता है, जिसमें वह है जिसे यह पेज इम्पोर्ट करता है और जहाँ इम्पोर्ट चलता है:

Terminal window
cd import-n8n

तैयार किए गए उदाहरण का स्रोत फ़ोल्डर Visual Studio Code में खुला है, जो एक सपोर्ट एजेंट का n8n वर्कफ़्लो एक्सपोर्ट दिखाता है, जो उसके चैट ट्रिगर और AI Agent नोड्स से शुरू होता है।

वर्कफ़्लो

support-agent.json, जो इस वॉकथ्रू के लिए उसी आकार में लिखी गई है जिसमें n8n कोई वर्कफ़्लो एक्सपोर्ट करता है, चार नोड्स रखती है: एक चैट ट्रिगर, एक छोटे सिस्टम संदेश वाला एक AI Agent, gpt-4o-mini चुनने वाला एक OpenAI Chat Model नोड, और एक Simple Memory नोड, जो उन कनेक्शनों से जुड़े हैं जिन्हें n8n उस नोड के नाम से सूचीबद्ध करता है जिससे हर कनेक्शन निकलता है। चैट ट्रिगर सार्वजनिक है, इसलिए उसके URL पर भेजा गया चैट संदेश वर्कफ़्लो शुरू करता है, और वह भेजने वाले से एक उपयोगकर्ता और पासवर्ड माँगता है, जिन्हें वह n8n में संग्रहीत एक बेसिक-ऑथेंटिकेशन क्रेडेंशियल से जाँचता है:

"parameters": {
"public": true,
"authentication": "basicAuth",
"options": {}
},
[… omitted: the node's identifier, name, type, version, position and webhook identifier]
"credentials": {
"httpBasicAuth": {
"id": "Vx3mQ8rLb2Nk7Tz5",
"name": "Chat basic auth"
}
}

मॉडल नोड अपना क्रेडेंशियल भी इसी तरह, संदर्भ से, चुनता है — एक्सपोर्ट हर क्रेडेंशियल का पहचानकर्ता और नाम वहन करता है, कभी उपयोगकर्ता, पासवर्ड या कुंजी नहीं:

"parameters": {
"model": {
"__rl": true,
"value": "gpt-4o-mini",
"mode": "list",
"cachedResultName": "gpt-4o-mini"
},
"options": {}
},
"id": "6f1d2c3a-7b4e-4a8f-9c21-0d3e5f6a7b03",
"name": "OpenAI Chat Model",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"typeVersion": 1.2,
"position": [120, 220],
"credentials": {
"openAiApi": {
"id": "Rb7nW2xQ9kT4mZ1c",
"name": "OpenAI account"
}
}

वर्कफ़्लो के बगल में, एक .aggrega-config.yaml फ़ोल्डर को वर्कस्पेस बनाता है:

# The workspace key marks this directory as the workspace root, so an import run
# here writes its drafts beside support-agent.json.
workspace: {}
# The registry the importer is fetched from the first time an import needs it.
default_registry: hub.aggrega.ai

और import-answers.yaml उन चीज़ों के उत्तर रखती है जिन्हें कोई वर्कफ़्लो नहीं रख सकता। Docker Compose के लिए इम्पोर्ट को किसी की ज़रूरत नहीं होती: वह OpenAI कुंजी को एक वेरिएबल संदर्भ से अटैच करता है जिसे Docker Compose आपके शेल से भरता है। Kubernetes के लिए इम्पोर्ट उसे एक Kubernetes Secret के नाम से अटैच करता है, जिसका नाम केवल आप दे सकते हैं, इसलिए फ़ाइल उस Secret का नाम देती है (Kubernetes पर देखें):

# Values the import could not draft from the source, keyed by the drafted file and the key path inside
# it. Write each one beside its key; an import of the same source, and a sync, read them from here and
# ask nothing. A secret is never written here: its key asks where the secret comes from — a variable
# name, ${NAME}, or the name of a Kubernetes Secret.
release.yaml:
# The origin of the secret value, written by the operator in the Release. Read exactly as
# values.origin is. Write it here or in values.origin, never in both. A secret: name where it comes
# from, never the value.
spec.components.n8n.uses.model.openai-chat-model.features.credential.infra.origin: "openai-api-key"

इम्पोर्ट उत्तर फ़ाइल फ़ाइल का पूरा वर्णन करती है।

इम्पोर्ट हर नोड को वर्कस्पेस के कैटलॉग के Components के सामने तौलता है, और --target उसके Recipes से एक Manifest ड्राफ़्ट करता है। वर्कस्पेस किसी कैटलॉग फ़ोल्डर का नाम नहीं देता, इसलिए इम्पोर्ट स्टैंडर्ड लाइब्रेरी का कैटलॉग उसी रजिस्ट्री से पढ़ता है जिससे वह अपना इम्पोर्टर लाता है: प्रकाशित कैटलॉग का एक हस्ताक्षरित स्नैपशॉट, जिसे पहला इम्पोर्ट लाता है, सत्यापित करता है और वर्कस्पेस के कंटेंट कैश में रखता है, और जिसका नाम उसके डाइजेस्ट से उस रिकॉर्ड में दिया जाता है जिसे इम्पोर्ट अपने ड्राफ़्ट के बगल में लिखता है। जो वर्कस्पेस अपने स्वयं के कैटलॉग फ़ोल्डरों का नाम देता है — AGGREGA_CATALOG_DIRS में, या workspace.catalog_dirs के अंतर्गत — वह इसके बजाय उनके विरुद्ध इम्पोर्ट करता है। source में जाएँ:

Terminal window
cd source

इम्पोर्ट चलाएं

Terminal window
aggrega import support-agent.json --target compose

स्टैंडर्ड आउटपुट पर यह सूची देता है कि इसने क्या लिखा:

wrote aggregate.yaml
wrote release.yaml
wrote manifest.yaml
wrote .aggrega-import.json

स्टैंडर्ड एरर पर, जहाँ <workspace> उस फ़ोल्डर के स्थान पर है जिसमें आपने इसे चलाया:

[… omitted: a warning that the importer runs unverified, printed where its module is read from beside its Plugin entity in a catalog folder rather than fetched]
read as the n8n format, with drafted paths relative to <workspace>
warn: the value of credentials.httpBasicAuth.id of node When chat message received is carried as written in the flow the draft carries: its format marks the field as a credential, and setting empty_credentials to marked or all writes it empty
warn: the value of credentials.openAiApi.id of node OpenAI Chat Model is carried as written in the flow the draft carries: its format marks the field as a credential, and setting empty_credentials to marked or all writes it empty
warn: node OpenAI Chat Model reaches openai-chat-model, wired to the model socket of core/ai-agent/n8n as openai-chat-model, other than through that connection: an n8n @n8n/n8n-nodes-langchain.lmChatOpenAi node reaches the part at the address the stored credential it selects, or its own parameters, give; the platform delivers this connection as OPENAI_BASE_URL and OPENAI_API_KEY, but an n8n workflow reads a variable of the platform's environment only through an expression reading $env, which the platform refuses while values.allow_env_access_in_nodes is false, the value the draft leaves it at; setting it true lets every workflow, and every user who can edit one, read every variable of the platform's environment, the delivered credentials included
made no choice for When chat message received (@n8n/n8n-nodes-langchain.chatTrigger)
made no choice for AI Agent (@n8n/n8n-nodes-langchain.agent)
mapped OpenAI Chat Model (@n8n/n8n-nodes-langchain.lmChatOpenAi) to core/ai-model/openai as a reference, HIGH at 0.9143
made no choice for Simple Memory (@n8n/n8n-nodes-langchain.memoryBufferWindow)
warning: node "n8n" (provider "compose"): artifact "n8n-flow.compose-fragment.yaml": skipped provenance label injection — the fragment declares no compose service. Compose carries build provenance as service labels, so a fragment contributing only top-level networks, volumes or configs carries none; the services this component emits elsewhere carry the full set.
Pull complete: <workspace>/release.lock (entities=8, source_artifacts=0, external_inputs=0)

एडिटर से चलाया गया इम्पोर्ट: ड्राफ़्ट किए गए Aggregate, Release और Manifest वर्कफ़्लो एक्सपोर्ट के बगल में दिखाई देते हैं, Aggrega आउटपुट सूचीबद्ध करता है कि हर नोड कैसे मैप किया गया और कौन-सी फ़ाइलें लिखी गईं, और एक नोटिफ़िकेशन बताता है कि इम्पोर्ट ने 3 फ़ाइलें ड्राफ़्ट कीं, जिन्हें n8n के रूप में पहचाना गया।

  • mapped पंक्ति बताती है कि OpenAI Chat Model नोड स्टैंडर्ड लाइब्रेरी का OpenAI मॉडल, core/ai-model/openai, बन गया, जिसका ड्राफ़्ट करने के बजाय संदर्भ दिया गया, क्योंकि वह उच्च स्तर में, 0.9143 पर, मैच हुआ: अपने आप में एक अलग घटक, जो प्लेटफ़ॉर्म के model सॉकेट से वायर किया गया है।
  • made no choice पंक्तियाँ बताती हैं कि ट्रिगर, एजेंट और मेमोरी वर्कफ़्लो के भीतर रहते हैं, जिसे n8n स्वयं चलाता है।
  • पहली दो warn पंक्तियाँ उन संग्रहीत क्रेडेंशियल्स के पहचानकर्ताओं के नाम देती हैं जिन्हें ट्रिगर और मॉडल नोड चुनते हैं, और जिन्हें n8n क्रेडेंशियल के रूप में चिह्नित करता है। वे संदर्भ हैं, सीक्रेट नहीं, और उन्हें ज्यों-का-त्यों वहन किया जाता है।
  • तीसरी warn पंक्ति ध्यान से पढ़ने वाली है: मॉडल नोड OpenAI तक उस संग्रहीत क्रेडेंशियल के साथ पहुँचता है जिसे वह चुनता है, न कि उस कनेक्शन के ज़रिए जिसे ड्राफ़्ट वायर करता है। प्लेटफ़ॉर्म कनेक्शन को n8n के एनवायरनमेंट में पहुँचाता है, और जब तक Aggregate values.allow_env_access_in_nodes को false पर छोड़ता है, जैसा ड्राफ़्ट करता है, तब तक n8n किसी वर्कफ़्लो को अपना एनवायरनमेंट पढ़ने से मना करता है। इसे true सेट करने से हर वर्कफ़्लो, और हर वह व्यक्ति जो किसी वर्कफ़्लो को संपादित कर सकता है, प्लेटफ़ॉर्म का हर वेरिएबल पढ़ सकता है, जिसमें पहुँचाई गई कुंजी भी शामिल है। इसलिए वर्कफ़्लो जिस कुंजी का उपयोग करता है वह वही है जिसे n8n संग्रहीत करता है, जैसा कि इसे चलाएं दिखाता है।
  • अंतिम दो पंक्तियाँ पुल हैं। उत्तर देने के लिए कुछ नहीं बचा था, इसलिए इम्पोर्ट ने ड्राफ़्ट किए गए Release की डिपेंडेंसी पुल कीं, जैसा aggrega pull करता है, और release.lock लिखी; नीचे के बिल्ड को और कुछ नहीं चाहिए। warning पंक्ति ऐसी है जिसे बिल्ड भी प्रिंट करता है, और वैलिडेट और बिल्ड करें उसे समझाता है।

उत्तर फ़ाइल एक ऐसे Secret का नाम देती है जिसके बारे में यह इम्पोर्ट नहीं पूछता: यह उसके लिए कुछ भी खाली नहीं छोड़ता, इसलिए यह कोई उत्तर लागू नहीं करता और फ़ाइल को जैसी है वैसी छोड़ देता है।

यह क्या लिखता है

Aggregate, Release और Manifest का नाम imported/support-agent रखा जाता है, वर्कफ़्लो के अपने नाम, Support agent, के आधार पर, जिसे घटाकर support-agent किया जाता है — बिना नाम वाले वर्कफ़्लो का नाम उसकी फ़ाइल के नाम पर रखा जाता है — उस नेमस्पेस के अंतर्गत जिसे इम्पोर्टर की target_namespace सेटिंग तय करती है, जो imported है जब तक आप कोई और सेट न करें (सेटिंग्स)।

aggregate.yaml — स्टैंडर्ड लाइब्रेरी के n8n प्लेटफ़ॉर्म, core/ai-agent/n8n, का एक इंस्टेंस, जो वर्कफ़्लो को वैसे ही वहन करता है जैसे वह एक्सपोर्ट किया गया था, जिसका अधिकांश हिस्सा यहाँ छोड़ दिया गया है, और उसके model सॉकेट से वायर किया गया मॉडल:

apiVersion: aggrega.ai/v1beta1
kind: Aggregate
metadata:
name: imported/support-agent
version: 0.1.0
description: Draft Aggregate imported from a source in the n8n format.
spec:
components:
n8n:
type: core/ai-agent/n8n
values:
workflow_id: 'sQ4vT8nKp2LmX7bR'
flow_definition: |
{
"id": "sQ4vT8nKp2LmX7bR",
"name": "Support agent",
[… omitted: the rest of the workflow, as exported]
}
uses:
model:
openai-chat-model:
target: openai-chat-model
# For the compose target, the lines below declare credential on openai-chat-model: a secret the Release alone attaches arrives under the key value, so each is declared with a key of its own and no two arrive under one; the Release attaches its origin, naming this type or none.
features:
credential:
type: core/secret-value
values:
key: OPENAI_API_KEY
# swap to core/ai-model/azure-openai (score 0.4125) by setting type: core/ai-model/azure-openai
openai-chat-model:
type: core/ai-model/openai
values:
model: |-
gpt-4o-mini

workflow_id वह पहचानकर्ता है जो एक्सपोर्ट वर्कफ़्लो को देता है। मॉडल core/ai-model/openai है, उस मॉडल के साथ जिसे नोड चुनता है, gpt-4o-mini; उसके ऊपर की टिप्पणी कैटलॉग के एक अन्य Component का नाम देती है जिससे नोड मिलता-जुलता है, उसके स्कोर के साथ। वह OpenAI कुंजी जिसे प्लेटफ़ॉर्म मॉडल के सामने प्रस्तुत करता है, कनेक्शन पर उस वेरिएबल के साथ घोषित की गई है जिसके अंतर्गत वह n8n के एनवायरनमेंट में पहुँचती है, OPENAI_API_KEY; Release बताता है कि वह कहाँ से आती है।

release.yaml — Release, जो Aggregate को Manifest के साथ डिप्लॉय करता है:

apiVersion: aggrega.ai/v1beta1
kind: Release
metadata:
name: imported/support-agent
# environment is a drafted default, since no source names the environment this Release deploys to; change it to name the one it deploys to.
environment: development
version: 0.1.0
description: Draft Release imported from a source in the n8n format.
spec:
aggregate: imported/support-agent
manifest: imported/support-agent
components:
n8n:
infra:
# The image running core/ai-agent/n8n, at the version this importer drafts, which the catalog's Recipes for it are known to run; the import does not raise or lower it to follow the source.
image: "n8nio/n8n:1.110.1"
# Published on this machine's loopback address, 127.0.0.1: reachable from this machine only, by any process running on it. Delete this line to keep the service internal.
published_port: 5678
uses:
model:
openai-chat-model:
features:
credential:
type: core/secret-value
infra:
# Attached by reference, never as a value: the credential n8n presents to openai-chat-model on its model connection, read from the variable OPENAI_API_KEY, which a target substituting variable references, as Docker Compose does when the stack starts, reads from the environment, so no file carries the value.
origin: "${OPENAI_API_KEY}"
openai-chat-model: {}
  • environment development है, एक डिफ़ॉल्ट जिसे, उसके ऊपर की टिप्पणी के अनुसार, उस एनवायरनमेंट में बदलना है जिसमें Release डिप्लॉय होता है।
  • इमेज n8n 1.110.1 है, वह संस्करण जिसे कैटलॉग के n8n के लिए Recipes चलाते हैं।
  • published_port 5678 है, वह पोर्ट जिस पर n8n सर्व करता है, इसलिए एडिटर आपकी मशीन पर http://127.0.0.1:5678 पर उत्तर देता है। जैसा कि उसकी टिप्पणी कहती है, इस मशीन की कोई भी प्रोसेस वहाँ उस तक पहुँच सकती है और कोई अन्य नहीं; n8n को केवल स्टैक के नेटवर्क पर रखने के लिए यह पंक्ति हटा दें। 5678 के अलावा कोई अन्य published_port होने पर उसके बगल में infra.external_base_url: http://127.0.0.1:<published_port> चाहिए, अन्यथा n8n अपने एडिटर और वेबहुक पते localhost:5678 पर बताता है।
  • कुंजी एक वेरिएबल संदर्भ है, ${OPENAI_API_KEY}, जिसे Docker Compose स्टैक शुरू होने पर आपके शेल से भरता है। स्टैंडर्ड लाइब्रेरी का OpenAI मॉडल एक होस्टेड सेवा है, और उससे कनेक्शन को एक क्रेडेंशियल वहन करना होता है, इसलिए Release एक क्रेडेंशियल अटैच करता है, भले ही वर्कफ़्लो अपनी कुंजी n8n के स्टोर से पढ़ता है।

manifest.yaml — प्लेटफ़ॉर्म और मॉडल की Compose Recipes, और वह रियलाइज़ेशन जो कुंजी के वेरिएबल संदर्भ को Compose फ़ाइल में ज्यों-का-त्यों लिखता है:

apiVersion: aggrega.ai/v1beta1
kind: Manifest
metadata:
name: imported/support-agent
version: 0.1.0
spec:
mappings:
components:
type:
core/ai-agent/n8n: compose/n8n
core/ai-model/openai: compose/openai
features:
type:
core/secret-value: compose/dotenv-secret

.aggrega-import.json इस बात का रिकॉर्ड है कि इम्पोर्ट ने क्या लिखा, जिसे बाद में कोई aggrega import --sync पढ़ता है, और release.lock हर उस कैटलॉग एंटिटी को, संस्करण और डाइजेस्ट के साथ, पिन करती है जिस पर Release रिज़ॉल्व होता है।

वैलिडेट और बिल्ड करें

Terminal window
aggrega validate --release release.yaml
aggrega build --release release.yaml

वैलिडेट करने के बाद एडिटर में खुला ड्राफ़्ट किया गया Release, जिसमें Aggrega आउटपुट और एक नोटिफ़िकेशन दोनों बताते हैं कि कोई समस्या नहीं मिली।

ड्राफ़्ट किए गए Release का बिल्ड: Explorer में एक dist फ़ोल्डर दिखाई देता है, Aggrega आउटपुट लिखी गई Docker Compose फ़ाइल सूचीबद्ध करता है, और एक नोटिफ़िकेशन बताता है कि 1 फ़ाइल लिखी गई।

वैलिडेशन प्रिंट करता है:

notice: LINT: Feature "core/secret-value" at core/secret-value:1.0.0 declares property "origin" in both values: and infra: pillars (path: origin)
release dependency validation passed: release.yaml (schema-pillar + dependency pillars)

और बिल्ड, जहाँ <workspace> उस फ़ोल्डर के स्थान पर है जिसमें ड्राफ़्ट हैं:

warning: node "n8n" (provider "compose"): artifact "n8n-flow.compose-fragment.yaml": skipped provenance label injection — the fragment declares no compose service. Compose carries build provenance as service labels, so a fragment contributing only top-level networks, volumes or configs carries none; the services this component emits elsewhere carry the full set.
notice: LINT: Feature "core/secret-value" at core/secret-value:1.0.0 declares property "origin" in both values: and infra: pillars (path: origin)
[… omitted: a total build time, which differs per run]
Build completed: 1 file written to <workspace>/dist

warning पंक्ति Compose फ़ाइल के उस हिस्से के बारे में है जो वर्कफ़्लो को वहन करता है, एक टॉप-लेवल configs प्रविष्टि, जिसके पास बिल्ड के लेबल लगाने के लिए कोई सेवा नहीं है। notice पंक्ति सलाहकारी है: सीक्रेट Feature अपना origin Aggregate के values से या Release के infra से स्वीकार करता है, और नोटिस बताता है कि एक लीफ़ दोनों में घोषित है। दोनों में से कोई भी निर्णय नहीं बदलता।

dist/compose/docker-compose.yaml में n8n और एक सेवा है जो n8n के शुरू होने से पहले वर्कफ़्लो इम्पोर्ट करती है:

services:
n8n:
image: n8nio/n8n:1.110.1
environment:
OPENAI_BASE_URL: https://api.openai.com/v1
OPENAI_API_KEY: ${OPENAI_API_KEY}
N8N_BLOCK_ENV_ACCESS_IN_NODE: "true"
ports:
- 127.0.0.1:5678:5678
[… omitted: the labels the build writes on every service, naming the Aggregate, the component, the environment and the compiler's version]
volumes:
- type: volume
source: n8n--data
target: /home/node/.n8n
networks:
- compose
depends_on:
n8n--import-flow:
condition: service_completed_successfully
[… omitted: the service's health check]
n8n--import-flow:
image: n8nio/n8n:1.110.1
command:
- import:workflow
- --input=/flows/workflow.json
entrypoint:
- n8n
[… omitted: the labels the build writes on every service]
volumes:
- type: volume
source: n8n--data
target: /home/node/.n8n
networks:
- compose
restart: "no"
configs:
- source: n8n-flow
target: /flows/workflow.json

वर्कफ़्लो n8n तक n8n import:workflow के ज़रिए पहुँचता है, जो हर बार स्टैक शुरू होने पर, स्वयं n8n से पहले, उसी डेटा वॉल्यूम पर चलाया जाता है। N8N_BLOCK_ENV_ACCESS_IN_NODE "true" है, जो किसी वर्कफ़्लो के अपना एनवायरनमेंट पढ़ने पर n8n की रोक है, क्योंकि Aggregate allow_env_access_in_nodes को false पर छोड़ता है। इसलिए OpenAI Chat Model नोड अपनी कुंजी n8n के अपने क्रेडेंशियल स्टोर से पढ़ता है, जैसे चैट ट्रिगर अपना उपयोगकर्ता और पासवर्ड पढ़ता है, और नीचे का रन दोनों को संग्रहीत करता है। n8n का Compose Recipe आपकी मशीन पर पोर्ट केवल वहीं प्रकाशित करता है जहाँ Release n8n के infra में published_port सेट करता है, और तब भी केवल लूपबैक पते, 127.0.0.1, पर; इसके बिना, सेवा तक केवल स्टैक के नेटवर्क पर पहुँचा जाता है।

AI असिस्टेंट के साथ

Aggrega के टूल के साथ सेट अप किया गया AI असिस्टेंट भी यही कर सकता है: यह प्रॉम्प्ट उसमें पेस्ट करें।

केवल Aggrega टूल का उपयोग करें, और स्वयं कोई फ़ोल्डर न बनाएं। यदि Workspace फ़ोल्डर में अभी कोई `import-n8n` फ़ोल्डर नहीं है, तो `draft` टूल को एक बार कॉल करें, `example` को `import-n8n` पर सेट करके और बिना `dir` के: यह उदाहरण को एक नए `import-n8n` फ़ोल्डर में लिखता है, जिसका `source` फ़ोल्डर वह रखता है जिसे यह पेज इम्पोर्ट करता है। फिर `import` टूल को कॉल करें, `workspace_root` को `import-n8n/source` पर, `source` को `support-agent.json` पर और `target` को `compose` पर सेट करके: यह जिन उत्तरों की उसे ज़रूरत है उन्हें `support-agent.json` के बगल में `import-answers.yaml` से पढ़ता है, अपने ड्राफ़्ट `import-n8n/source` में लिखता है और उनकी ज़रूरत की चीज़ें पुल करता है। फिर `validate` टूल को कॉल करें, `workspace_root` को `import-n8n/source` पर और `release` को `release.yaml` पर सेट करके, और `build` टूल को, `workspace_root` को `import-n8n/source` पर, `release` को `release.yaml` पर और `write` को true पर सेट करके। मुझे बताएं कि बिल्ड ने कौन-सी फ़ाइलें लिखीं; वे `import-n8n/source/dist/` के अंतर्गत हैं।

इसे VS Code में खोलें

Visual Studio Code के लिए Aggrega एक्सटेंशन इंस्टॉल होने पर, VS Code में import-n8n/source फ़ोल्डर खोलें, जहाँ इम्पोर्ट ने अपने ड्राफ़्ट लिखे। फ़ोल्डर में एक Release है, ड्राफ़्ट की गई release.yaml, इसलिए एडिटर उसे आपके लिए चुन लेता है, और जैसे-जैसे आप ड्राफ़्ट संपादित करते हैं वह उन्हें उस Release के विरुद्ध जाँचता है, और जो कुछ पाता है उसे फ़ाइल में और Problems पैनल में चिह्नित करता है। कमांड पैलेट में Aggrega: Show topology graph Release के घटकों और उनके बीच के कनेक्शनों को बनाता है। Aggrega: Build, Aggrega: Preview build और Aggrega: Pull उसी Release पर काम करते हैं, और हर एक एक्टिविटी बार के Aggrega व्यू के Commands पैनल पर एक बटन भी है; Build अपनी फ़ाइलें फ़ोल्डर के dist/ में लिखता है। बाकी सब Visual Studio Code में Aggrega का उपयोग करें में है।

इसे चलाएं

n8n वर्कफ़्लो द्वारा चुने गए दोनों क्रेडेंशियल्स को अपने स्टोर से, उनके पहचानकर्ताओं से, पढ़ता है: OpenAI कुंजी Rb7nW2xQ9kT4mZ1c के अंतर्गत, और चैट का उपयोगकर्ता और पासवर्ड Vx3mQ8rLb2Nk7Tz5 के अंतर्गत। n8n की अपनी कमांड लाइन उन्हें, उन्हीं पहचानकर्ताओं के अंतर्गत, एक फ़ाइल से संग्रहीत करती है। उन्हें अपने स्वयं के मानों के साथ credentials.json में लिखें:

[
{"id": "Rb7nW2xQ9kT4mZ1c", "name": "OpenAI account", "type": "openAiApi", "data": {"apiKey": "your OpenAI key"}},
{"id": "Vx3mQ8rLb2Nk7Tz5", "name": "Chat basic auth", "type": "httpBasicAuth", "data": {"user": "a user of your own", "password": "a password of your own"}}
]

अपने शेल में कुंजी सेट करें, जैसे ड्राफ़्ट किया गया Release उसे पढ़ता है, और स्टैक शुरू करें:

Terminal window
export OPENAI_API_KEY='your OpenAI key'
docker compose -p support-agent -f dist/compose/docker-compose.yaml up -d --wait

-p प्रोजेक्ट का नाम देता है, जैसा कि इम्पोर्ट कैसे चलता है का रन चरण समझाता है। --wait तब लौटता है जब n8n स्वस्थ होने की सूचना देता है, वर्कफ़्लो इम्पोर्ट करने वाली सेवा के चलकर बाहर निकल जाने के बाद। क्रेडेंशियल्स को n8n के कंटेनर में कॉपी करें, उन्हें इम्पोर्ट करें, और कॉपी हटा दें:

Terminal window
docker compose -p support-agent -f dist/compose/docker-compose.yaml exec -T n8n sh -c 'umask 077; cat > /tmp/credentials.json' < credentials.json
docker compose -p support-agent -f dist/compose/docker-compose.yaml exec n8n n8n import:credentials --input=/tmp/credentials.json
docker compose -p support-agent -f dist/compose/docker-compose.yaml exec n8n rm /tmp/credentials.json
[… omitted: n8n's notices about its settings file's permissions, error tracking and deprecated settings]
Successfully imported 2 credentials.

अब n8n के पास दोनों क्रेडेंशियल्स हैं, इसलिए credentials.json हटा दें:

Terminal window
rm credentials.json

फिर वर्कफ़्लो को सक्रिय करें, और n8n को रीस्टार्ट करें ताकि सक्रियण प्रभावी हो:

Terminal window
docker compose -p support-agent -f dist/compose/docker-compose.yaml exec n8n n8n update:workflow --id=sQ4vT8nKp2LmX7bR --active=true
docker compose -p support-agent -f dist/compose/docker-compose.yaml restart n8n

जब docker compose -p support-agent -f dist/compose/docker-compose.yaml ps n8n n8n को फिर से (healthy) दिखाता है, तो docker compose -p support-agent -f dist/compose/docker-compose.yaml logs n8n में Activated workflow "Support agent" (ID: sQ4vT8nKp2LmX7bR) लिखा होता है।

इसे जाँचें

http://127.0.0.1:5678 खोलें, वह पता जिसे published_port प्रकाशित करता है: n8n का एडिटर पहली बार आने पर एक ओनर खाता माँगता है, फिर Support agent दिखाता है।

चैट ट्रिगर कोई संदेश केवल ऊपर संग्रहीत उपयोगकर्ता और पासवर्ड के साथ लेता है; उनके बिना वह HTTP/1.1 401 Unauthorized और Authorization is required! उत्तर देता है, और गलत पासवर्ड के साथ HTTP/1.1 403 Forbidden। जब दोनों CHAT_USER और CHAT_PASSWORD में हों, तो curl उन्हें अपने स्टैंडर्ड इनपुट से पढ़ता है, इसलिए वे किसी कमांड लाइन पर दिखाई नहीं देते:

Terminal window
printf 'user = "%s:%s"\n' "$CHAT_USER" "$CHAT_PASSWORD" | curl --config - -sS -i -X POST \
http://127.0.0.1:5678/webhook/a3c9e1f2-4b5d-4e6f-8a7b-9c0d1e2f3a04/chat -H 'Content-Type: application/json' \
-d '{"action": "sendMessage", "sessionId": "s1", "chatInput": "In one short sentence: what does a support plan cover?"}'
HTTP/1.1 500 Internal Server Error
[… omitted: the response's other headers]
{"message":"Error in workflow"}

रन ने OpenAI कुंजी के लिए एक प्लेसहोल्डर संग्रहीत किया, इसलिए वर्कफ़्लो मॉडल को कॉल करने पर रुक गया। n8n इस एक्ज़िक्यूशन को रखता है, जिसे एडिटर वर्कफ़्लो के एक्ज़िक्यूशन्स के अंतर्गत सूचीबद्ध करता है, OpenAI के अस्वीकरण के साथ: Incorrect API key provided: sk-place*****************-key. आपकी कुंजी के साथ, उत्तर HTTP/1.1 200 OK होता है और एजेंट का जवाब, {"output": "…"} के रूप में।

Kubernetes पर, Kubernetes पर में वर्णित बिल्ड लागू होने के बाद, n8n अपना डेटा एक ऐसे वॉल्यूम में रखता है जो उतने ही समय तक रहता है जितना उसका पॉड, इसलिए एक नया पॉड आपके द्वारा संग्रहीत चीज़ों के बिना शुरू होता है; इसके बजाय क्रेडेंशियल्स को चल रहे इंस्टेंस पर संग्रहीत करें और वर्कफ़्लो को वहीं सक्रिय करें। credentials.json को वैसे लिखें जैसे इसे चलाएं करता है, उसे kubectl exec के ज़रिए, उसके स्टैंडर्ड इनपुट से, उस नेमस्पेस में इम्पोर्ट करें जिसमें आपने लागू किया, और बाद में उसे हटा दें:

Terminal window
kubectl exec -i -n <namespace> deploy/n8n -- n8n import:credentials --input=/dev/stdin < credentials.json
Defaulted container "main" out of: main, import-flow (init)
[… omitted: n8n's notices about its settings file's permissions, error tracking and deprecated settings]
Successfully imported 2 credentials.

n8n की Service, n8n-default, पर एक लोकल पोर्ट फ़ॉरवर्ड करें, और कमांड को चलता छोड़ दें:

Terminal window
kubectl port-forward -n <namespace> svc/n8n-default 5678:5678

दूसरे टर्मिनल से, n8n के API के ज़रिए ओनर खाता सेट करें, जो आपको साइन इन करता है और सेशन को cookies.txt में रखता है, फिर वर्कफ़्लो को सक्रिय करें:

Terminal window
curl -sS -c cookies.txt -X POST http://127.0.0.1:5678/rest/owner/setup -H 'Content-Type: application/json' \
-d '{"email": "owner@example.com", "firstName": "Your", "lastName": "Name", "password": "a password of your own"}'
curl -sS -b cookies.txt -X PATCH http://127.0.0.1:5678/rest/workflows/sQ4vT8nKp2LmX7bR \
-H 'Content-Type: application/json' -d '{"active": true}'

दूसरा उत्तर वर्कफ़्लो है, "active":true के साथ। इसके बाद ऊपर दिया गया चैट संदेश उसी पते पर, बिना बदलाव के, उस तक पहुँचता है; रन को वही {"message":"Error in workflow"} और एक्ज़िक्यूशन में वही अस्वीकरण मिला।

नीचे दिए गए कमांड से स्टैक रोकें। -v n8n का डेटा वॉल्यूम भी हटा देता है, और उसके साथ संग्रहीत क्रेडेंशियल्स और सक्रियण:

Terminal window
docker compose -p support-agent -f dist/compose/docker-compose.yaml down -v

Kubernetes पर

यही वर्कफ़्लो helm टार्गेट के साथ Kubernetes के लिए इम्पोर्ट होता है। Docker Compose के लिए ड्राफ़्ट पहले से source में हैं, और इम्पोर्ट वहाँ किसी Aggregate को कभी अधिलेखित नहीं करता, इसलिए इन्हें --output-dir के साथ एक अलग फ़ोल्डर में ड्राफ़्ट करें, फिर उसी से वैलिडेट और बिल्ड करें:

Terminal window
aggrega import support-agent.json --target helm --output-dir helm
cd helm
aggrega validate --release release.yaml
aggrega build --release release.yaml

ड्राफ़्ट वहीं भिन्न होते हैं जहाँ टार्गेट भिन्न होता है। Manifest प्लेटफ़ॉर्म को helm/n8n से, मॉडल को helm/openai से, और कुंजी को helm/k8s-existing-secret से मैप करता है, जो उसे नेमस्पेस में पहले से मौजूद एक Secret से पढ़ता है। Release कुंजी को core/referenced-secret के रूप में अटैच करता है, जो उत्तर फ़ाइल से उस Secret, openai-api-key, का नाम देता है।

बिल्ड सादे Kubernetes मैनिफ़ेस्ट वर्कस्पेस रूट, source, पर dist/helm/ के अंतर्गत लिखता है, जो helm से ../dist/helm/ है। जिस नेमस्पेस में आप लागू करते हैं उसमें Secret बनाएं, जिसमें कुंजी डेटा कुंजी value के अंतर्गत हो, फिर फ़ोल्डर को वैसे लागू करें जैसा इम्पोर्ट कैसे चलता है का रन चरण समझाता है। वर्कफ़्लो अब भी अपने क्रेडेंशियल्स n8n के अपने स्टोर से पढ़ता है, जिसे Kubernetes पर इसे जाँचें भरता है।