> For the complete documentation index, see [llms.txt](https://docs.maiagent.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.maiagent.ai/teams/setup.md).

# 建立與編排團隊

本頁說明如何從零建立一個 Agent Team：新建團隊、在畫布上加入助理、設定它們之間的連線與互動方式、指定入口節點，並開始與整個團隊對話。

{% hint style="info" %}
**先備好要加入團隊的 AI 助理。** 團隊裡的每個節點都是一個既有的 AI 助理，所以請先在〈AI 助理〉建立好各專長的助理（例如分流、訂單、退換貨助理），再回到這裡把它們組成團隊。
{% endhint %}

## <mark style="color:blue;">一、新建團隊</mark> <a href="#create-team" id="create-team"></a>

### 1. 進入團隊列表 <a href="#team-list" id="team-list"></a>

從左側選單進入 <mark style="color:blue;">AI 功能</mark> →〈<mark style="color:blue;">團隊</mark>〉。列表會顯示目前組織所有的團隊，包含**團隊名稱、代理數、狀態**等資訊，右上角可搜尋團隊。

<figure><img src="/files/mFf9SoVmIvSi9WoGsYPk" alt="團隊列表頁"><figcaption><p>團隊列表：可看到每個團隊的名稱、包含幾位代理與啟用狀態</p></figcaption></figure>

### 2. 建立團隊 <a href="#new-team" id="new-team"></a>

點右上角 <mark style="color:blue;">新建團隊</mark>，填入**團隊名稱**（必填）與**說明**，即可建立。

<figure><img src="/files/fiiYP6tmuLJUKJdXxhb4" alt="新建團隊視窗"><figcaption><p>新建團隊：填入團隊名稱與說明</p></figcaption></figure>

{% hint style="success" %}
建立成功後，系統會自動幫這個團隊建立一個**入口助理**與對應的 **Web Chat 對話平台**，讓你之後可以直接與整個團隊對話。
{% endhint %}

## <mark style="color:blue;">二、在畫布上編排團隊</mark> <a href="#compose-canvas" id="compose-canvas"></a>

點進團隊後，預設進入 <mark style="color:blue;">畫布編排</mark> 檢視。畫面分成三個區域：左側〈**助理列表**〉、中間**畫布**、右側**設定面板**（點選節點或連線時出現）。

<figure><img src="/files/YxpqAiwjxKzBzB5DtY9t" alt="團隊圖（放大）"><figcaption><p>放大後的團隊圖：入口節點「客服分流助理」透過「移交」分流到訂單查詢／退換貨／商品推薦助理，訂單查詢助理再「委派」倉儲查詢助理。每個節點顯示助理名稱、模型與 Agent／RAG 模式，入口節點標示「入口」（實際畫面左側另有〈助理列表〉、右側為設定面板）</p></figcaption></figure>

{% hint style="warning" %}
**畫布編排建議使用桌機瀏覽器操作。** 在手機等小螢幕上，畫布編排區會顯示提示，請改用桌機完成編排。
{% endhint %}

### 1. 加入助理節點 <a href="#add-nodes" id="add-nodes"></a>

在左側〈助理列表〉找到要加入的助理，**拖曳到畫布**，或**點擊**它即可加入。已經在團隊裡的助理會標示〈已在團隊中〉，點它可以定位到畫布上對應的節點。助理多時可用上方搜尋框過濾。

每個節點會顯示助理名稱、使用的模型，以及它是 <mark style="color:blue;">Agent</mark> 或 <mark style="color:blue;">RAG</mark> 模式，方便你辨識。

{% hint style="info" %}
若節點位置雜亂，可點畫布上的 <mark style="color:blue;">自動排版</mark> 讓系統重新整理版面。節點位置會自動儲存。
{% endhint %}

### 2. 設定節點 <a href="#node-settings" id="node-settings"></a>

點選一個節點，右側會出現〈**節點設定**〉。可調整：

| 設定                | 說明                                                                                        |
| ----------------- | ----------------------------------------------------------------------------------------- |
| **入口節點**          | 開啟後，團隊收到訊息時從此節點開始處理對話。**一個團隊只能有一個入口節點。**                                                  |
| **每次呼叫 Token 上限** | 限制此節點單次回應的 Token 量（選填）。                                                                   |
| **最大迭代次數**        | 限制此節點單次處理的迭代次數（選填）。                                                                       |
| **上下文策略**         | 控制這個助理看得到什麼：〈**可見原始使用者輸入**〉決定它能否讀到使用者的原始訊息（關閉時只看得到上游助理整理後的輸出）；〈**可見輸出來源**〉可指定它看得到哪些節點的輸出。 |

<figure><img src="/files/P4wleQ6Bprm672qhBf4t" alt="節點設定面板"><figcaption><p>節點設定：指定入口節點、Token／迭代上限與上下文策略</p></figcaption></figure>

### 3. 拉連線並設定互動方式 <a href="#add-edges" id="add-edges"></a>

從一個節點的連接點拖到另一個節點，建立一條**有向連線**（來源 → 目標）。點選連線，右側會出現〈**連線設定**〉：

| 設定                 | 說明                                                |
| ------------------ | ------------------------------------------------- |
| **觸發條件描述**         | 用白話描述「什麼時候該走這條連線」。這段描述會提供給 AI 作為判斷依據，寫清楚有助於路由更準確。 |
| **互動方式**           | 選擇〈**自動**〉〈**移交**〉或〈**委派**〉（三者差異見下表）。             |
| **繼承來源 Agent 的工具** | 開啟後，目標助理可使用來源助理的所有工具與資源。                          |

**互動方式**（各選項在設定面板中的說明）：

| 互動方式       | 說明                      |
| ---------- | ----------------------- |
| **自動（預設）** | 由 LLM 自動判斷最適合的互動方式。     |
| **移交**     | 移交控制權——來源代理休眠，目標代理接管對話。 |
| **委派**     | 委派任務——目標代理執行後回傳結果給來源。   |

<figure><img src="/files/GBhEBWdQr0YxHqpEeFqd" alt="連線設定面板"><figcaption><p>連線設定：填觸發條件描述、選互動方式（自動／移交／委派），並可選擇是否繼承來源助理的工具</p></figcaption></figure>

{% hint style="info" %}
**留意畫布上方的語意警告。** 當團隊圖有問題時，畫布上方會出現黃色提示，例如：〈尚未設定入口節點〉〈有多個入口節點，應只保留一個〉〈有重複的連線〉〈連線形成循環〉。建議在對話前先把這些警告排除。
{% endhint %}

## <mark style="color:blue;">三、設定基本資訊與安全護欄</mark> <a href="#settings-guardrails" id="settings-guardrails"></a>

在團隊頁切換到〈**基本資訊**〉檢視，可調整團隊層級的設定：

* **基本資訊**：團隊名稱、說明、是否啟用。
* **安全護欄**：
  * **最大迭代數**（預設 `25`）——一次對話中，助理之間最多可以來回幾次，避免無限循環。
  * **整體 Token 上限**（預設 `200000`）——整個團隊處理單則使用者訊息的 Token 預算上限。
  * **逾時秒數**（預設 `600`）——整個團隊處理流程的硬性逾時。

<figure><img src="/files/CPGLt4vGaTF44QI9s1BG" alt="團隊基本資訊與安全護欄"><figcaption><p>基本資訊與安全護欄：調整團隊名稱、啟用狀態，以及最大迭代數、整體 Token 上限與逾時秒數</p></figcaption></figure>

## <mark style="color:blue;">四、與團隊對話</mark> <a href="#talk-to-team" id="talk-to-team"></a>

編排完成、確認團隊為〈啟用中〉後，就能透過團隊的 **Web Chat 對話平台** 與整個團隊對話。使用者只面對一個入口，系統會自動把問題路由給合適的助理。

當團隊在助理之間移交或委派時，對話介面會顯示切換提示，例如〈**正在移交給**〉〈**正在委派給**〉〈**正在切換至**〉，讓使用者知道目前由哪個助理服務中。

## <mark style="color:blue;">五、刪除團隊</mark> <a href="#delete-team" id="delete-team"></a>

在〈基本資訊〉檢視最下方的危險區可以〈**刪除團隊**〉。刪除會一併移除此團隊的入口助理，且**此操作無法復原**，請確認後再執行。

## <mark style="color:blue;">六、下一步</mark> <a href="#next" id="next"></a>

團隊開始運作後，你可以在 [團隊執行記錄](/teams/traces.md) 查看每一次執行經過了哪些助理、各自花了多少 Token、以及耗時，確認團隊如預期分工。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.maiagent.ai/teams/setup.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
