# How the AI assistant works

What the AI assistant answers, what it knows, when it hands a conversation to your team, and what it costs.

The AI assistant answers your customers on every channel of the business: the website widget, your mobile app, email, Zalo, Facebook Messenger, Instagram, TikTok, WhatsApp, Telegram, LINE and X. It answers only from the knowledge you give it, and hands the conversation to a person when it cannot help or should not try.

There is one assistant per business. The same name, instructions and knowledge serve every channel. You set it up under **Customer Support → AI assistant**, in five tabs: **Assistant**, **Knowledge**, **Situations**, **Tests** and **AI runs**.

## What it can do

- **Answer questions** from your FAQs, policies, website pages, documents, Google Docs and Sheets, and Notion pages.
- **Show products** from your catalog as product cards, with prices taken from the catalog.
- **Record a draft order** when a customer clearly wants to buy, for an agent to confirm and send a payment request.
- **Save customer details** the customer mentions (name, phone number, email, and custom fields marked **AI fills it in**), and ask for a phone number or email when a follow-up would help.
- **Suggest replies** to your agents instead of answering, in **Draft only** mode or after a hand-off.
- **Hand off** to your team, with a short summary for the agent.

It does not take payments, change orders, issue refunds or promise anything that is not written in your knowledge.

## What it knows

The assistant does not know your business on its own. Each time a customer writes, it looks up the six passages of your knowledge that best match the customer's last messages, plus up to five matching products if you have a catalog. It writes its reply from those passages only. If the answer is not there, it says so and hands off instead of guessing.

That is why the quality of the answers depends almost entirely on your knowledge. See [Add knowledge for the AI](https://hatang.dev/help/ai/knowledge-sources).

## How it decides to answer or hand off

Every customer message goes through these checks, in order:

1. **Flows first.** If one of your [flows](https://hatang.dev/help/automation/flows) matches the message, or is waiting for the customer's answer, the flow replies and the assistant stays out of it.
2. **Should it speak at all?** It stays silent when the mode is **Off**, when the mode is **When nobody is online** and an agent is online, when a person on your team owns the conversation, when an agent clicked **Stop AI**, or after it has already handed this conversation off.
3. **Your situations.** Rules you write on the **Situations** tab apply now. A rule triggered by keywords can hand off, stop the AI or mark spam right away, without the AI writing anything.
4. **Limits.** After the maximum number of replies in one conversation (6 by default), it hands off. If the business has used its AI budget for the day or month, it stops answering and the customer gets your usual offline experience.
5. **The answer.** It writes a short reply (one to four sentences, in the customer's language) from the knowledge it found, or hands off.

It always hands off when the customer asks for a person, complains, wants a refund or cancellation, has a problem with a payment they made, wants to change personal or account data, or asks something your knowledge does not cover. Questions about prices, plans or how to buy are answered, not handed off. See [When the AI hands off to your team](https://hatang.dev/help/ai/handoff).

When the knowledge base is empty, it hands every conversation off.

## The four modes

| Mode | What happens |
|---|---|
| **Off** | The assistant never answers. |
| **When nobody is online** | It answers only while no agent is online. An agent takes over as soon as they reply. |
| **First responder** | It answers every new customer first and hands off when it cannot help. The widget shows your team as online. |
| **Draft only** | It never talks to customers. For each customer message it suggests a reply that the agent can insert, edit and send. |

## Costs and limits

Each answer is a call to an AI model, and every call has a cost in US dollars. Ha Tang uses the platform's AI key by default, or your own key if you add one. The business has a **daily cap** and a **monthly cap**: when one is reached, the assistant stops answering, owners and admins get one email a day, and customers fall back to the offline experience until the next day or month.

Everything the AI does for the business counts toward the same caps: replies and drafts, the **Chat with the AI** panel, tests, AI follow-ups, the **AI writes a message** workflow step, AI comment replies, automatic tagging and reading scanned PDFs. The **AI runs** tab shows what each call cost. See [Check what the AI did](https://hatang.dev/help/ai/ai-runs).

## Other places the AI helps

- **Follow-ups**: on a website's **Automation** tab, the AI can write the follow-up sent to a customer who went quiet.
- **Workflows**: the **AI writes a message** step writes a message from the conversation. See [Workflows](https://hatang.dev/help/automation/workflows).
- **Comments**: public and private replies to comments on Facebook, Instagram, TikTok and X can be written by the AI. See [Auto-reply to comments](https://hatang.dev/help/automation/comment-auto-replies).
- **Tags**: conversation tags marked **AI applies it** are added when a conversation matches the tag's description. See [Conversation tags](https://hatang.dev/help/inbox/conversation-tags).
