> 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/maiagent-user-guide/en/serve/text.md).

# Use Cases: Text Customer Service

Build an external-facing AI text customer service Agent with a knowledge base and FAQ, connect it to your website and messaging platforms, and hand off to a human agent when necessary

In enterprise customer service, handling a large volume of frequent customer inquiries manually not only causes delays but also overloads support staff and hurts overall service efficiency. Many repetitive questions come up again and again and consume a great deal of time, making it hard for the team to focus on more complex customer needs and problem solving.

Now you can use MaiAgent to build an external-facing AI text customer service assistant for your business, effectively reducing support costs and improving service quality and customer satisfaction!

## Use Cases <a href="#use-cases" id="use-cases"></a>

* **Website and messaging platform support**: Embed the Agent in your website, or connect it to messaging platforms your customers already use, such as LINE, Facebook Messenger, and WhatsApp, to provide instant replies 24 hours a day.
* **Regulation and policy inquiries**: Government agencies and highly regulated industries need to let the public and internal staff quickly find answers in a large body of regulatory announcements, and replies must include their sources.
* **Product specifications and recommendations**: Catalogs, spec sheets, and comparison tables are large and frequently updated, and customer questions are varied, so looking up answers manually is time-consuming.
* **Order and after-sales inquiries**: You need real-time access to external system data such as order status, warranty coverage, and repair progress, which static documents alone cannot answer.

{% hint style="info" %}
The same knowledge base can be used by multiple Agents at once. A common approach is to create one Agent for "external customers" and another for "internal support staff," sharing the knowledge base but giving each a different role instruction so that the level of detail and tone of their replies differ.
{% endhint %}

## How It Works <a href="#how-it-works" id="how-it-works"></a>

| Step                           | Description                                                                                                                                                                            |
| ------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **① Customer asks a question** | The customer asks a question on a connected platform such as the website Web Chat, LINE, or Facebook Messenger                                                                         |
| **② Agent takes over**         | Based on the role instruction, the Agent decides which data sources to use to answer                                                                                                   |
| **③ Find the answer**          | Retrieves relevant passages from the knowledge base through semantic search and matches them against FAQ entries; when real-time data is needed, calls tools to query external systems |
| **④ Generate a reply**         | Combines the retrieval results into a reply and, depending on your settings, attaches citation sources                                                                                 |
| **⑤ When it cannot answer**    | Triggers handoff to a human agent, passing the conversation to support staff                                                                                                           |

After receiving a question, the Agent first uses semantic search to find relevant passages in the knowledge base, then has the language model combine them into a reply and, depending on your settings, attaches [citation sources](/maiagent-user-guide/en/build/choose-channel/web-chat/citation-display.md) so customers can trace and verify the answer. If a question falls outside the scope of the knowledge, you can set up [human handoff notifications](/maiagent-user-guide/en/build/conversation-settings/human-handoff/handoff-notification.md) to pass the conversation to support staff and prevent the AI from giving made-up answers.

## Setup Workflow <a href="#setup-workflow" id="setup-workflow"></a>

### 1. Create an Agent <a href="#step1-create-agent" id="step1-create-agent"></a>

On the <mark style="color:blue;">AI Assistants</mark> page, enter a name, select RAG and a language model, and set the answer mode. For general text customer service, "RAG Q\&A" is sufficient. See [Create an Agent](/maiagent-user-guide/en/build/agent/setup.md) for details.

### 2. Write the Role Instruction <a href="#step2-system-prompt" id="step2-system-prompt"></a>

The role instruction determines the AI's identity, output format, and answer boundaries, and is the key to support quality. We recommend stating explicitly that "information outside the knowledge base must not be answered" and providing a standard reply for when the Agent cannot answer. For guidance on writing it, see the [Role Instruction Design Guide](/maiagent-user-guide/en/build/agent/system-prompt.md).

### 3. Build the Knowledge Base and FAQ <a href="#step3-knowledge-base" id="step3-knowledge-base"></a>

Upload catalogs, spec sheets, announcements, and other documents to build a [knowledge base](/maiagent-user-guide/en/build/knowledge-base/km.md), or use the [crawler feature](/maiagent-user-guide/en/build/knowledge-base/scrape-website.md) to extract website content automatically. For frequently asked questions with fixed answers, create a separate [FAQ](/maiagent-user-guide/en/build/knowledge-base/faq.md) to keep replies consistent. Before going live, you can use [search testing](/maiagent-user-guide/en/build/knowledge-base/test-search-result.md) to confirm that retrieval returns the right results.

### 4. Configure Tools (Optional) <a href="#step4-configure-tools" id="step4-configure-tools"></a>

If support needs real-time data such as orders or inventory, you can [configure tools for the Agent](/maiagent-user-guide/en/build/tools/configure_tools.md) so the AI can call your internal APIs directly to get the latest results.

### 5. Connect a Messaging Platform and Go Live <a href="#step5-connect-channel" id="step5-connect-channel"></a>

[Choose a platform to connect](/maiagent-user-guide/en/build/choose-channel.md) based on where your customers are. You can connect Web Chat, LINE, Facebook Messenger, Telegram, Microsoft Teams, WhatsApp, Email, and Slack at the same time.

### 6. Monitor and Optimize <a href="#step6-monitor" id="step6-monitor"></a>

After going live, use AgentOps for [automated evaluation and Agent monitoring](/maiagent-user-guide/en/build/agent-ops/evaluations.md), and follow the recommendations in [AI Customer Service Quality Management](/maiagent-user-guide/en/serve/ai-quality-guide.md) to keep expanding the knowledge base and refining the role instruction.

## Application Examples <a href="#examples" id="examples"></a>

* [Regulation Search Assistant](/maiagent-user-guide/en/serve/text/lawsearch.md): Using government regulatory announcements as an example, explains how to use a single knowledge base to design two different reply styles for internal staff and the general public.
* [Product Search Assistant](/maiagent-user-guide/en/serve/text/productsearch.md): Using a computer brand's product catalog as an example, walks through the complete process from creating an Agent and uploading the catalog to embedding it in your website.

The following sections demonstrate the setup process with real cases to help you quickly apply it to your own business scenarios.


---

# 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/maiagent-user-guide/en/serve/text.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.
