> 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/build/integrate.md).

# 應用實例：外部資料串接

外部資料串接

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

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

* **公開資料平台介接**：例如政府開放資料（農業、氣象、交通、財政），讓 Agent 即時取得最新公開數據。
* **企業內部系統查詢**：串接 ERP、CRM、HR、ticket 系統等內部 API，讓 Agent 依據員工或客戶身分提供個人化資訊。
* **第三方 SaaS 整合**：連結 Slack、Notion、Google Drive、Salesforce 等服務，將 Agent 整合進現有工作流程。
* **動態查詢與報表**：當資料量大或變動頻繁、不適合放在知識庫時，可改以 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. **配置 Agent**：將工具加入 Agent 的可用工具清單，並透過角色指令引導 Agent 在合適時機呼叫工具。
4. **測試與上線**：透過對話測試工具呼叫流程，並至 AgentOps 下的 <mark style="color:blue;">工具執行紀錄</mark> 查看執行狀況與錯誤訊息，確認回覆正確性後即可上線使用。

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

* [農業數據資料查詢](/build/integrate/farmingsearch.md)：透過介接農業部公開 API，打造即時農產品交易行情查詢助理。
* [Google Workspace 連接器](/build/integrate/google-workspace-connector.md)：用平台內建的 Google Workspace 連接器（MCP），讓 Agent 查詢 Gmail 信件與附件、Google 日曆行程與雲端硬碟文件。

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


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.maiagent.ai/build/integrate.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
