# 外部資料串接

在實際應用情境中，AI 助理常需要存取知識庫以外的「即時資料」或「外部系統資料」，才能提供精準且具時效性的回覆。透過 MaiAgent 的工具（API 工具、MCP 工具）功能，您可以將企業內部系統或第三方平台的資料源串接至 AI 助理，打造能夠跨系統查詢、即時回應的智慧應用。

### 適用情境 <a href="#use-cases" id="use-cases"></a>

* **公開資料平台介接**：例如政府開放資料（農業、氣象、交通、財政），讓 AI 助理即時取得最新公開數據。
* **企業內部系統查詢**：串接 ERP、CRM、HR、ticket 系統等內部 API，讓 AI 助理依據員工或客戶身份提供個人化資訊。
* **第三方 SaaS 整合**：連結 Slack、Notion、Google Drive、Salesforce 等服務，將 AI 助理整合進現有工作流程。
* **動態查詢與報表**：當資料量大或變動頻繁、不適合放在知識庫時，可改以 API 即時查詢的方式回覆。

### 串接流程 <a href="#integration-workflow" id="integration-workflow"></a>

1. **取得資料來源**：確認欲串接的 API 或 MCP 服務，並準備好端點、HTTP 方法、標頭與參數結構。
2. **建立工具**：於 MaiAgent 平台 <mark style="color:blue;">工具</mark> 頁面點選 <mark style="color:blue;">新增 API 工具</mark> 或 <mark style="color:blue;">新增 MCP 工具</mark>。新增 API 工具時可直接貼上 cURL 指令，系統會自動解析 URL、標頭與 HTTP 方法。
3. **配置 AI 助理**：將工具加入 AI 助理的可用工具清單，並透過角色指令引導 AI 助理在合適時機呼叫工具。
4. **測試與上線**：透過對話測試工具呼叫流程，並至 AgentOps 下的 <mark style="color:blue;">工具執行紀錄</mark> 查看執行狀況與錯誤訊息，確認回覆正確性後即可上線使用。

### 應用範例 <a href="#examples" id="examples"></a>

* [農業數據資料查詢](/application/integrate/farmingsearch.md)：透過介接農業部公開 API，打造即時農產品交易行情查詢助理。

接下來各小節將以實際案例示範如何完成外部資料的串接，協助您快速套用至自身的業務情境。


---

# Agent Instructions: 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:

```
GET https://docs.maiagent.ai/application/integrate.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
