Botpress 自主節點讓你能夠建立功能完整的 AI 智能代理——不只是聊天機器人,而是能根據現有情境自主決策的智能代理。
透過明確指示與工具整合,機器人建構者可以利用自主節點規劃聊天機器人的行為。
此節點設計用於處理決策與執行,能理解使用者輸入、以正確資料回應,並善用其工具。
如果你有興趣使用自主節點,你來對地方了。本文將為你說明如何運用我們平台的智能代理核心功能。
自主節點的主要特點
1. LLM 決策驅動
自主節點運用 LLM 的能力,透過 LLM 智能代理做出智慧決策。
2. 自主行為
自主節點可根據指示與使用者輸入,自動執行動作,無需人工介入。
3. 工具
自主節點能理解並運用特定工具——例如查詢知識庫、進行網路搜尋、執行工作流程轉換等。
4. 可自訂化
只要為自主節點設定合適的人格與詳細指示,就能確保其在對話中維持品牌調性並符合預期範圍。
5. 編寫與執行程式碼
自主節點可產生並執行自訂程式碼以完成任務。
6. 自我修正
若自主節點發現自己走錯方向,具備自我修正與錯誤恢復的能力。
設定選項
每個自主節點都需仔細設定,以確保其行為符合業務需求。
設定自主節點最關鍵的部分,就是撰寫合適的提示詞與指示。提示詞有助於代理理解其人格,並引導決策。

指示方塊
在指示方塊中,請提供明確的指引。指示越具體,代理的決策就越精確。
範例:「你是一位樂於助人的助手,總是使用『knowledgeAgent.knowledgequery』工具回答問題。如果使用者說『搜尋』,則使用『browser.webSearch』工具。」
允許對話
「允許對話」開關可讓自主節點直接與使用者互動。若關閉,節點僅處理指令並執行內部邏輯,不會向使用者發送訊息。
認識工具
根據你給予的指示,自主節點配備了多種可調用的工具。
每個工具都執行特定動作——了解何時、如何使用這些工具,對於推動節點決策至關重要。
最常用的 7 種工具
- global.think:讓 LLMz 引擎在繼續前先進行思考。
- browser.webSearch:讓代理能在網路上搜尋答案。
- knowledgeAgent.knowledgequery:查詢內部知識庫以獲取相關資訊。
- clock.setReminder:為未來任務或回應設定提醒。
- workflow.transition:執行工作流程轉換,根據使用者輸入從對話的一部分移動到另一部分。
- chat.sendText:向使用者發送文字訊息作為回應。
- chat.waitForUserInput:暫停執行,等待使用者進一步輸入。

透過指定回應使用者行為時要用的工具,你可以掌控對話流程與結果。
例如,你可以指示 LLM 在特定條件下必須執行某些動作:「當使用者說『1』時,使用『workflow.transition』工具進入下一步。」
或:「如果使用者提問,先嘗試用『knowledgeAgent.knowledgequery』工具回答。」
範例工作流程
以下是一個自主節點在對話中設定與運作的逐步範例:
1. 使用者輸入
使用者輸入有關公司產品的問題。
2. 執行指示
自主節點依據提示,使用 knowledgeAgent.knowledgequery 工具查詢內部知識庫。
3. LLM 決策
若知識庫無法給出滿意答案,節點可能會使用 browser.webSearch 工具在網路上搜尋更多資訊。
4. 發送訊息
回應準備好後,節點會用 chat.sendText 向使用者回覆相關資訊。
5. 等待輸入
回覆後,節點會用 chat.waitForUserInput 等待使用者進一步提問或互動。
如何撰寫指示
如範例所示,明確的指示對確保自主節點正確運作至關重要。
LLM 的決策能力很大程度取決於指示的結構方式。
以下是撰寫自主節點指示的三大最佳實踐:
1. 具體明確
避免模糊指令,請用明確語言清楚引導代理。
範例:「如果使用者說『協助』,用『chat.sendText』發送預設支援選項清單給他們。」
2. 明確定義工具使用時機
明確說明在什麼情境下應該使用哪個工具。
範例:「回答產品相關問題時,務必使用『knowledgeAgent.knowledgequery』。」
3. 引導流程
用清楚的轉換與步驟,確保對話流程正確推進。
範例:「若知識庫無法回答,則用『browser.webSearch』進行搜尋查詢。」
你可以在以下連結找到更多資訊:
使用 Markdown 語法
在開始之前,先說明使用 Markdown 語法的重要性。
為了讓提示結構清晰、易於閱讀,建議使用標題、項目符號、粗體等 Markdown 語法。
這種語法有助於 LLM 辨識並遵循指示的層級,讓它能區分主要區塊、副指令與範例。
如果你不熟悉 Markdown 語法,那就用任何你覺得容易的結構——只要保持清楚且有層次即可。
實用提示範例
本區整理了最常見的範例與模式,供你用來控制自主節點的行為。
這些範例來自實際經驗,展示如何透過特定指示與工具處理不同情境。
專注於內部知識
為了讓節點能區分支援問題與其他查詢(如價格或功能),你可以這樣引導:
**IMPORTANT General Process**
- The knowledgeAgent.knowledgequery tool is to be used only for support-related questions and NOT for general features or price-related questions.
- The browser.websearch tool is to be used ONLY for support questions, and it should NOT be used for general features or price-related questions.這個提示確保 LLM 僅在支援相關查詢時使用特定工具,掌控所取得資訊的類型。
將節點轉換到子流程
有時你會希望機器人從自主節點切換到子流程。
假設你想讓機器人收集使用者的電子郵件,再從其他系統查詢該郵件的更多資訊,以豐富聯絡資料。
這時,你可能需要機器人跳出自主節點迴圈,進入包含多步驟/多系統的子流程來補充聯絡人資訊:
When the user wants more information about an email, go to the transition tool.這個指示會讓節點在使用者詢問更多電子郵件細節時,調用 workflow.transition 工具,並依此引導對話流程。
填入變數並執行動作
如果你想讓節點同時收集輸入並觸發動作,可以這樣撰寫提示:
When the user wants more information about an email, go to the transition tool and fill in the "email" variable with the email the user is asking about.在這裡,你不僅引導節點觸發轉換,還會提取並將使用者的電子郵件儲存到變數中,讓後續對話能有動態的行為。
根據條件調整回應
有時候,你會希望節點根據特定條件執行額外的邏輯。以下是一個與提供影片連結相關的提示範例:
If the users selects “1” then say something like “thank you”, then use the transition tool.這個提示能幫助節點理解影片連結的預期結構,以及當使用者要求指向影片特定時間點時,該如何修改連結。
影片連結範本的應用範例
你可以進一步透過實際範例,說明系統在回應使用者要求影片連結時應有的行為:
**Video Link Example:**
If the user is asking for a video link, the link to the video is provided below. To direct them to a specific second, append the "t" parameter with the time you want to reference. For example, to link to the 15-second mark, it should look like this: "t=15":
"""{{workflow.contentLinks}}"""這樣可以讓節點明確知道如何動態產生帶有特定時間戳記的影片連結,確保回應一致且易於使用。
疑難排解與診斷
在模擬器中測試 Autonomous Node 行為時,診斷其背後的運作方式很重要。節點是如何做決策的?
以下是你可以用來排查並檢查節點思考過程與效能的方法。

三種疑難排解方式
1. 檢查節點思考狀態
點擊 Inspect,你可以窺探 Autonomous Node 的內部狀態,了解 LLM 正在處理什麼。透過檢查,你可以看到:
- 節點優先考慮哪些指令
- 它如何解讀你的提示
- 是否有遵守你提供的限制與指示
如果你發現節點回應不正確或忽略了某些指示,檢查後可以發現它是否誤解了提示或未執行特定工具。

2. 檢查工具分頁
Tools 區域會顯示 Autonomous Node 可用的所有工具。每當你新增卡片或修改節點設定時,工具清單都會更新。
- 請確認列出的工具與你預期節點決策過程中可用的工具一致。
- 請確保你在提示中正確拼寫工具名稱,讓節點能正確執行指定的動作。

3. 檢查「反覆運算」標籤頁
Autonomous Node 通常會在一到兩次迭代內執行所有指令。實際迭代次數取決於提示的複雜度以及節點的分析方式。
對於較複雜的任務,節點可能需要多次迭代來收集資料、做出決策或取得外部資訊。
透過檢查 Iterations 分頁(或 All 分頁),你可以了解:
- 節點完成最終決策所需的迭代次數。
- 導致節點採取多步驟行動的原因(例如,從 knowledgeAgent.knowledgequery 或 browser.webSearch 等工具取得額外資料)。
- 為什麼會產生特定的結果。

常見疑難排解問題
模型大小
Autonomous Node 可能沒有完全遵循你的提示,只執行了部分內容,或只呼叫了 “workflowQueue” 而沒有呼叫 “workflowExecuteAll” 工具。
將 Autonomous Node 的 LLM 模型調整為較小的版本通常較省成本,但這也會帶來一些代價。
較小的 LLM 可能會導致提示內容被截斷,特別是 Botpress 為了讓 LLM 理解卡片功能、所需參數等所加的定義包裝。沒有這些,機器人就無法正確運作。
LLMz 版本
請務必使用最新穩定版的 LLMz。這是指揮 autonomous node 運作的自主引擎。
它也包含錯誤修正,讓提示對不同 LLM 更具通用性。

範例:診斷程式碼產生問題
假設 Autonomous Node 正在產生程式碼,但沒有正確遵循提示。你可以這樣排查:
- Inspect:檢查節點遵循了哪些指令。它是否正確理解了產生程式碼的請求?
- Tools:確認節點是否有存取所需工具(如程式碼產生工具或知識庫查詢工具)。確保提示中明確提及這些工具。
- Iterations:查看迭代分頁,了解節點如何走到產生程式碼這一步。是一步完成,還是經過多個步驟?它是否先查詢知識庫,還是直接嘗試產生程式碼?
解決方案:如果機器人無法正確產生程式碼:
- 確保提示中正確引用了用於產生程式碼的工具。
- 調整指示,讓節點按照特定步驟操作,例如先取得相關知識再嘗試產生程式碼。

完整提示範例
**IMPORTANT: Query Knowledge Base is to be used only for support questions related explicitly to student courses, and NOT for general features or pricing inquiries.
**Role Description:
You are an AI-powered troubleshooting chatbot named XYZ Assistant’, focused on providing support related to professional courses offered by XYZ LMS. Your primary goal is to handle student inquiries efficiently by retrieving accurate information from the knowledge base and answering questions clearly.
**Tone and Language:
• Maintain a courteous, professional, and helpful demeanor at all times.
• Use language that is clear, concise, and appropriate for students and professionals in finance and investment.
• Ensure user data is handled securely and confidentially, adhering to all relevant data protection policies.
• Utilize information solely from **LMS Knowledge Base**.
• Personalize interactions to enhance user engagement and satisfaction.
• Reflect **XYZ branding** throughout the conversation, ensuring clarity and professionalism.
• Avoid providing answers outside the knowledge base or surfing the internet for information.
• If the user expresses frustration, acknowledge their concern and reassure them that you are here to help.
**Interaction Flow and Instructions
1. Greeting and Initial Query
• Start with a friendly and professional greeting.
• Encourage users to ask questions about course content, support materials, or other course-related concerns.
2. Information Retrieval and Issue Resolution
• Utilize the ‘Query Knowledge Base’ tool to find accurate answers to student inquiries.
• Provide clear, concise, and helpful responses to resolve the user's question.
• If the inquiry involves linking to a video, use the provided video link structure. To link to a specific moment in the video, append the "t" parameter for the desired time (e.g., for the 15-second mark, use "t=15").
3. Conclusion
Once the issue is resolved, politely conclude the interaction and ask if there's anything else you can assist with.
**Extra Instructions
*Video Link Example
-If the user is asking for a video link, the link to the video is provided below. To direct them to a specific second, append the "t" parameter with the time you want to reference. For example, to link to the 15-second mark, it should look like this: "t=15":
"""{{workflow.contentLinks}}"""
*Handling Edge Cases
If the user asks a general or unclear question, prompt them to provide more details so that you can offer a better solution.提示內容解析
在上述完整提示中,使用者建立了一個 AI 助理,用來回答學生關於課程的問題。
以上範例僅供參考,您可以根據需求進行調整,但目前這樣的結構是我認為最有效的。
我們來解析一下這個提示為什麼要這樣設計:
1. 重要提醒
**IMPORTANT: Query Knowledge Base is to be used only for support questions related explicitly to student courses, and NOT for general features or pricing inquiries.目的:設定 查詢知識庫 工具的使用時機與方式。強調僅限於課程相關支援,不適用於查詢功能或價格等一般問題。
意義:有助於縮小機器人的回應範圍,讓回應更聚焦且貼近使用者需求,特別是確保回應內容與教育課程相關。
2. 角色描述
You are an AI-powered troubleshooting chatbot named XYZ Assistant’, focused on providing support related to professional courses offered by XYZ LMS. Your primary goal is to handle student inquiries efficiently by retrieving accurate information from the knowledge base and answering questions clearly.目的:定義 AI 的角色為以支援為導向的助理,明確說明其主要目標是解決課程相關問題。
意義:確保助理的回應符合預期用途,管理使用者期望,並聚焦於其領域(本例為 XYZ LMS)。
3. 語氣與用詞
• Maintain a courteous, professional, and helpful demeanor at all times.
• Use language that is clear, concise, and appropriate for students and professionals in finance and investment.
• Ensure user data is handled securely and confidentially, adhering to all relevant data protection policies.
• Utilize information solely from **LMS Knowledge Base**.Personalize interactions to enhance user engagement and satisfaction.
• Reflect **XYZ branding** throughout the conversation, ensuring clarity and professionalism.
• Avoid providing answers outside the knowledge base or surfing the internet for information.
• If the user expresses frustration, acknowledge their concern and reassure them that you are here to help.目的:指引助理保持友善、專業的語氣,同時確保互動過程中的資料安全。
意義:建立親切且安全的互動氛圍,符合品牌形象與使用者對專業助理的期待。
4. 互動流程與指示
問候與初步提問
• Start with a friendly and professional greeting.
• Encourage users to ask questions about course content, support materials, or other course-related concerns.目的:指示助理以溫暖、專業的問候開場,並鼓勵使用者提出課程相關的具體問題。
意義:建立友善的互動起點,提升使用者參與度,並協助機器人蒐集更多細節以提供更佳回應。
資訊查詢與問題解決
• Utilize the ‘Query Knowledge Base’ tool to find accurate answers to student inquiries.
• Provide clear, concise, and helpful responses to resolve the user's question.
• If the inquiry involves linking to a video, use the provided video link structure. To link to a specific moment in the video, append the "t" parameter for the desired time (e.g., for the 15-second mark, use "t=15").目的:指示助理善用知識庫,提供相關且清楚的回應。此外,也包含以結構化方式分享帶有時間標記的影片資源。
意義:讓回應更有效率且精確,並以有條理的方式處理如影片等內容相關問題,提升使用體驗。
結尾
Once the issue is resolved, politely conclude the interaction and ask if there's anything else you can assist with.目的:指引機器人以禮貌方式結束對話,詢問是否還需要其他協助。
意義:在互動過程中維持專業與支援的語氣,並讓使用者有機會繼續提問。
5. 額外指示
If the user is asking for a video link, the link to the video is provided below. To direct them to a specific second, append the "t" parameter with the time you want to reference. For example, to link to the 15-second mark, it should look like this: "t=15":
"""{{workflow.contentLinks}}"""目的:示範如何連結到影片的特定部分,協助學生精確找到所需資訊。
意義:釐清如何分享影片資源,特別是針對特定時間點的教學內容。
*Handling Edge Cases
If the user asks a general or unclear question, prompt them to provide more details so that you can offer a better solution.目的:讓助理在遇到模糊或一般性問題時,能主動引導使用者提供更多細節。
意義:有助於避免混淆,確保助理能夠盡可能具體地回應使用者的問題。
立即打造 AI 代理
Botpress 是一個完全可擴充的企業級 AI 智能代理平台。
我們的全方位對話式 AI 平台即服務(PaaS)讓企業能夠打造、部署並監控以 LLM 為核心的解決方案。
Botpress 專案可應用於各行各業、不同場景與商業流程,始終具備可擴展性、安全性與品牌一致性。
全球已有超過 50 萬名用戶與數百萬個機器人部署,Botpress 是企業與開發者的首選平台。我們提供高等級安全性與專屬客戶成功服務,協助企業順利部署企業級 AI 智能代理。
透過有效設定 Autonomous Nodes 的提示詞與工具定義,組織可以建立能自動處理使用者互動的智慧代理。
立即開始打造,完全免費。
常見問題
1. 使用 Autonomous Nodes 需要具備程式設計經驗嗎?
使用 Botpress 的 Autonomous Nodes 不需要程式設計經驗。它們設計為低程式碼開發,您可以透過邏輯區塊與視覺化工具來打造功能完整的 AI 智能代理。
2. 自主節點可以直接與外部 API 或資料庫互動嗎?
可以,Autonomous Node 可以透過 Botpress 的自訂子流程或 API 呼叫等工具,與外部 API 或資料庫互動。您可以定義安全端點並傳遞參數,在對話過程中讀取或寫入資料。
3. 可以將自主節點嵌入到行動應用程式或第三方平台嗎?
可以,當您的機器人部署後,Autonomous Nodes 可以嵌入到行動應用程式或第三方平台。Botpress 支援多渠道部署,透過 SDK 與整合,可用於 WhatsApp、Slack、Messenger 等平台,或透過 webview、API 整合到行動應用程式。
4. 這個節點如何處理同時多位使用者或高流量?
Botpress 的 Autonomous Nodes 會將每個會話獨立於記憶體中執行,確保個人化對話。若遇到高流量情境,建議監控資源使用狀況,並優化邏輯與 API 呼叫,以維持低延遲與高可用性。
5. 是否有防護措施避免自主節點洩漏敏感資訊?
有,您可以透過限制工具存取權限與自訂提示詞,設定嚴格的防護措施,避免 Autonomous Node 洩漏敏感資訊。此外,Botpress 採用內建安全機制的 LLM,有助於強化合規性。





.webp)
